From 7b4402b2d7a07cc1c4689e0b3ba34fffcf13cf15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Rodr=C3=ADguez?= Date: Fri, 1 Jan 2016 22:53:14 -0500 Subject: [PATCH] v0.9.0 & compiled --- compiled/app.js | 42 +++++++++++++++++++++++++++++++----------- compiled/index.html | 22 +++++++++++++++++----- compiled/style.css | 26 ++++++++++++++++++++++++++ index.jade | 2 +- 4 files changed, 75 insertions(+), 17 deletions(-) diff --git a/compiled/app.js b/compiled/app.js index dc5ee95..2574a9e 100644 --- a/compiled/app.js +++ b/compiled/app.js @@ -46,11 +46,11 @@ rtcConfig: rtcConfig }); - dbg = function(string, torrent, color) { + dbg = function(string, item, color) { color = color != null ? color : '#333333'; if (window.localStorage.getItem('debug') != null) { - if ((torrent != null) && torrent.name) { - console.debug('%cβTorrent:torrent:' + torrent.name + ' (' + torrent.infoHash + ') %c' + string, 'color: #33C3F0', 'color: ' + color); + if ((item != null) && item.name) { + console.debug('%cβTorrent:' + (item.infoHash != null ? 'torrent ' : 'torrent ' + item._torrent.name + ':file ') + item.name + (item.infoHash != null ? ' (' + item.infoHash + ')' : '') + ' %c' + string, 'color: #33C3F0', 'color: ' + color); return; } else { console.debug('%cβTorrent:client %c' + string, 'color: #33C3F0', 'color: ' + color); @@ -131,7 +131,7 @@ ]; $scope.gridOptions = { columnDefs: $scope.columns, - data: $scope.client.validTorrents, + data: $scope.client.torrents, enableColumnResizing: true, enableColumnMenus: false, enableRowSelection: true, @@ -155,11 +155,19 @@ } }); }; - $scope.seedFile = function(file) { - if (file != null) { - dbg('Seeding file ' + file.name); + $scope.seedFiles = function(files) { + var name; + if (files != null) { + if (files.length === 1) { + dbg('Seeding file ' + files[0].name); + } else { + dbg('Seeding ' + files.length + ' files'); + name = prompt('Please name your torrent', 'My Awesome Torrent') || 'My Awesome Torrent'; + opts.name = name; + } $scope.client.processing = true; - $scope.client.seed(file, opts, $scope.onSeed); + $scope.client.seed(files, opts, $scope.onSeed); + delete opts.name; } }; $scope.openTorrentFile = function(file) { @@ -183,11 +191,21 @@ } }; $scope.destroyedTorrent = function(err) { - $scope.client.processing = false; if (err) { throw err; } - dbg('Destroyed torrent'); + dbg('Destroyed torrent', $scope.selectedTorrent); + $scope.selectedTorrent = null; + $scope.client.processing = false; + }; + $scope.changePriority = function(file) { + if (file.priority === '-1') { + dbg('Deselected', file); + return file.deselect(); + } else { + dbg('Selected ', file); + return file.select(); + } }; $scope.onTorrent = function(torrent, isSeed) { torrent.safeTorrentFileURL = torrent.torrentFileURL; @@ -206,7 +224,9 @@ } if (isSeed) { dbg('Started seeding', torrent); - $scope.client.validTorrents.push(torrent); + if ($scope.client.validTorrents.indexOf(torrent) === -1) { + $scope.client.validTorrents.push(torrent); + } if (!($scope.selectedTorrent != null)) { $scope.selectedTorrent = torrent; } diff --git a/compiled/index.html b/compiled/index.html index b314ff1..d58074e 100644 --- a/compiled/index.html +++ b/compiled/index.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@
-

βTorrent v0.8.1

+

βTorrent v0.9.0

@@ -30,13 +30,17 @@
- +
-
{{selectedTorrent.name}}
+
{{selectedTorrent.name}} + + + +
Share
  • βTorrent
  • @@ -52,13 +56,21 @@ Name Size + Priority {{file.name}} {{file.name}} - {{file.length | pbytes}} + {{file.length | pbytes}} + + + diff --git a/compiled/style.css b/compiled/style.css index 46b621b..43957f4 100644 --- a/compiled/style.css +++ b/compiled/style.css @@ -33,6 +33,9 @@ footer { .download-button { margin-left: 10px; } +.no-margin { + margin: 0px; } + .spinner { position: absolute; top: 30%; @@ -51,3 +54,26 @@ footer { margin-top: -100px; font-size: 200px; transform: translateY(-50%); } + +.button.button-danger, +button.button-danger, +input[type="submit"].button-danger, +input[type="reset"].button-danger, +input[type="button"].button-danger { + color: #FFF; + background-color: #D9534F; + border-color: #D9534F; } + +.button.button-danger:hover, +button.button-danger:hover, +input[type="submit"].button-danger:hover, +input[type="reset"].button-danger:hover, +input[type="button"].button-danger:hover, +.button.button-danger:focus, +button.button-danger:focus, +input[type="submit"].button-danger:focus, +input[type="reset"].button-danger:focus, +input[type="button"].button-danger:focus { + color: #FFF; + background-color: #C43E3A; + border-color: #C43E3A; } diff --git a/index.jade b/index.jade index 7b16bc4..278c941 100644 --- a/index.jade +++ b/index.jade @@ -8,7 +8,7 @@ html(ng-app='bTorrent', lang='en') meta(name='keywords', content='βTorrent, btorrent, client, webtorrent, browser, torrent, stream, bittorrent') meta(name='author', content='Diego Rodríguez Baquero - DiegoRBaquero') meta(name='viewport', content='width=device-width, initial-scale=1') - script(src='https://cdn.jsdelivr.net/g/webtorrent@0.66,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0,angular.ng-notify@0.7,angular.file-upload@10.1') + script(src='https://cdn.jsdelivr.net/g/webtorrent@0.67.1,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0,angular.ng-notify@0.7,angular.file-upload@10.1') link(rel='stylesheet', href='https://cdn.jsdelivr.net/g/normalize@3.0,skeleton@2.0,angular.ng-notify@0.7(ng-notify.min.css)') link(rel='stylesheet', href='https://cdn.jsdelivr.net/fontawesome/4.5/css/font-awesome.min.css') link(rel='stylesheet', href='https://cdn.jsdelivr.net/angular.ui-grid/3.0.7/ui-grid.min.css')