diff --git a/deluge/ui/web/js/Deluge.Details.Details.js b/deluge/ui/web/js/Deluge.Details.Details.js index 0c450c5af..8b3ababe9 100644 --- a/deluge/ui/web/js/Deluge.Details.Details.js +++ b/deluge/ui/web/js/Deluge.Details.Details.js @@ -21,59 +21,57 @@ Copyright: Boston, MA 02110-1301, USA. */ -(function() { - Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, { - title: _('Details'), - cls: 'x-deluge-status', - - onRender: function(ct, position) { - Ext.deluge.details.DetailsTab.superclass.onRender.call(this, ct, position); - this.load({ - url: '/render/tab_details.html', - text: _('Loading') + '...' - }); - this.getUpdater().on('update', this.onPanelUpdate, this); - }, - - clear: function() { - if (!this.fields) return; - for (var k in this.fields) { - this.fields[k].innerHTML = ''; - } - }, - - update: function(torrentId) { - if (!this.fields) this.getFields(); - Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Details, { - success: this.onRequestComplete, - scope: this, - torrentId: torrentId - }); - }, - - onPanelUpdate: function(el, response) { - this.fields = {}; - Ext.each(Ext.query('dd', this.body.dom), function(field) { - this.fields[field.className] = field; - }, this); - }, - - onRequestComplete: function(torrent, options) { - var data = { - torrent_name: torrent.name, - hash: options.torrentId, - path: torrent.save_path, - size: fsize(torrent.total_size), - files: torrent.num_files, - status: torrent.tracker_status, - tracker: torrent.tracker, - comment: torrent.comment - }; - - for (var field in this.fields) { - this.fields[field].innerHTML = data[field]; - } +Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, { + title: _('Details'), + cls: 'x-deluge-status', + + onRender: function(ct, position) { + Ext.deluge.details.DetailsTab.superclass.onRender.call(this, ct, position); + this.load({ + url: '/render/tab_details.html', + text: _('Loading') + '...' + }); + this.getUpdater().on('update', this.onPanelUpdate, this); + }, + + clear: function() { + if (!this.fields) return; + for (var k in this.fields) { + this.fields[k].innerHTML = ''; } - }); - Deluge.Details.add(new Ext.deluge.details.DetailsTab()); -})(); \ No newline at end of file + }, + + update: function(torrentId) { + if (!this.fields) this.getFields(); + Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Details, { + success: this.onRequestComplete, + scope: this, + torrentId: torrentId + }); + }, + + onPanelUpdate: function(el, response) { + this.fields = {}; + Ext.each(Ext.query('dd', this.body.dom), function(field) { + this.fields[field.className] = field; + }, this); + }, + + onRequestComplete: function(torrent, options) { + var data = { + torrent_name: torrent.name, + hash: options.torrentId, + path: torrent.save_path, + size: fsize(torrent.total_size), + files: torrent.num_files, + status: torrent.tracker_status, + tracker: torrent.tracker, + comment: torrent.comment + }; + + for (var field in this.fields) { + this.fields[field].innerHTML = data[field]; + } + } +}); +Deluge.Details.add(new Ext.deluge.details.DetailsTab()); \ No newline at end of file diff --git a/deluge/ui/web/js/Deluge.Details.Status.js b/deluge/ui/web/js/Deluge.Details.Status.js index 0fec89954..b19768625 100644 --- a/deluge/ui/web/js/Deluge.Details.Status.js +++ b/deluge/ui/web/js/Deluge.Details.Status.js @@ -21,89 +21,87 @@ Copyright: Boston, MA 02110-1301, USA. */ -(function() { - Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, { - title: _('Status'), +Ext.deluge.details.StatusTab = Ext.extend(Ext.Panel, { + title: _('Status'), + + onRender: function(ct, position) { + Ext.deluge.details.StatusTab.superclass.onRender.call(this, ct, position); - onRender: function(ct, position) { - Ext.deluge.details.StatusTab.superclass.onRender.call(this, ct, position); - - this.progressBar = this.add({ - xtype: 'fullprogressbar', - cls: 'x-deluge-status-progressbar' - }); - - this.status = this.add({ - cls: 'x-deluge-status', - border: false, - listeners: { - 'render': { - fn: function(panel) { - panel.load({ - url: '/render/tab_status.html', - text: _('Loading') + '...' - }); - panel.getUpdater().on('update', this.onPanelUpdate, this); - }, - scope: this - } + this.progressBar = this.add({ + xtype: 'fullprogressbar', + cls: 'x-deluge-status-progressbar' + }); + + this.status = this.add({ + cls: 'x-deluge-status', + border: false, + listeners: { + 'render': { + fn: function(panel) { + panel.load({ + url: '/render/tab_status.html', + text: _('Loading') + '...' + }); + panel.getUpdater().on('update', this.onPanelUpdate, this); + }, + scope: this } - }); - }, - - clear: function() { - if (!this.fields) return; - this.progressBar.updateProgress(0, ' '); - for (var k in this.fields) { - this.fields[k].innerHTML = ''; } - }, - - update: function(torrentId) { - if (!this.fields) this.getFields(); - Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Status, { - success: this.onRequestComplete, - scope: this - }); - }, - - onPanelUpdate: function(el, response) { - this.fields = {}; - Ext.each(Ext.query('dd', this.status.body.dom), function(field) { - this.fields[field.className] = field; - }, this); - }, - - onRequestComplete: function(status) { - seeders = status.total_seeds > -1 ? status.num_seeds + ' (' + status.total_seeds + ')' : status.num_seeds - peers = status.total_peers > -1 ? status.num_peers + ' (' + status.total_peers + ')' : status.num_peers - var data = { - downloaded: fsize(status.total_done) + ' (' + fsize(status.total_payload_download) + ')', - uploaded: fsize(status.total_uploaded) + ' (' + fsize(status.total_payload_upload) + ')', - share: status.ratio.toFixed(3), - announce: ftime(status.next_announce), - tracker_status: status.tracker_status, - downspeed: fspeed(status.download_payload_rate), - upspeed: fspeed(status.upload_payload_rate), - eta: ftime(status.eta), - pieces: status.num_pieces + ' (' + fsize(status.piece_length) + ')', - seeders: seeders, - peers: peers, - avail: status.distributed_copies.toFixed(3), - active_time: ftime(status.active_time), - seeding_time: ftime(status.seeding_time), - seed_rank: status.seed_rank, - auto_managed: 'False', - time_added: fdate(status.time_added) - } - if (status.is_auto_managed) {data.auto_managed = 'True'} - - for (var field in this.fields) { - this.fields[field].innerHTML = data[field]; - } - var text = status.state + ' ' + status.progress.toFixed(2) + '%'; - this.progressBar.updateProgress(status.progress, text); + }); + }, + + clear: function() { + if (!this.fields) return; + this.progressBar.updateProgress(0, ' '); + for (var k in this.fields) { + this.fields[k].innerHTML = ''; } - }); - Deluge.Details.add(new Ext.deluge.details.StatusTab()); -})(); \ No newline at end of file + }, + + update: function(torrentId) { + if (!this.fields) this.getFields(); + Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Status, { + success: this.onRequestComplete, + scope: this + }); + }, + + onPanelUpdate: function(el, response) { + this.fields = {}; + Ext.each(Ext.query('dd', this.status.body.dom), function(field) { + this.fields[field.className] = field; + }, this); + }, + + onRequestComplete: function(status) { + seeders = status.total_seeds > -1 ? status.num_seeds + ' (' + status.total_seeds + ')' : status.num_seeds + peers = status.total_peers > -1 ? status.num_peers + ' (' + status.total_peers + ')' : status.num_peers + var data = { + downloaded: fsize(status.total_done) + ' (' + fsize(status.total_payload_download) + ')', + uploaded: fsize(status.total_uploaded) + ' (' + fsize(status.total_payload_upload) + ')', + share: status.ratio.toFixed(3), + announce: ftime(status.next_announce), + tracker_status: status.tracker_status, + downspeed: fspeed(status.download_payload_rate), + upspeed: fspeed(status.upload_payload_rate), + eta: ftime(status.eta), + pieces: status.num_pieces + ' (' + fsize(status.piece_length) + ')', + seeders: seeders, + peers: peers, + avail: status.distributed_copies.toFixed(3), + active_time: ftime(status.active_time), + seeding_time: ftime(status.seeding_time), + seed_rank: status.seed_rank, + auto_managed: 'False', + time_added: fdate(status.time_added) + } + if (status.is_auto_managed) {data.auto_managed = 'True'} + + for (var field in this.fields) { + this.fields[field].innerHTML = data[field]; + } + var text = status.state + ' ' + status.progress.toFixed(2) + '%'; + this.progressBar.updateProgress(status.progress, text); + } +}); +Deluge.Details.add(new Ext.deluge.details.StatusTab()); \ No newline at end of file