diff options
Diffstat (limited to 'deluge/ui/web/js/deluge-all/details')
-rw-r--r-- | deluge/ui/web/js/deluge-all/details/DetailsPanel.js | 18 | ||||
-rw-r--r-- | deluge/ui/web/js/deluge-all/details/DetailsTab.js | 18 | ||||
-rw-r--r-- | deluge/ui/web/js/deluge-all/details/FilesTab.js | 39 | ||||
-rw-r--r-- | deluge/ui/web/js/deluge-all/details/OptionsTab.js | 24 | ||||
-rw-r--r-- | deluge/ui/web/js/deluge-all/details/PeersTab.js | 18 | ||||
-rw-r--r-- | deluge/ui/web/js/deluge-all/details/StatusTab.js | 14 |
6 files changed, 67 insertions, 64 deletions
diff --git a/deluge/ui/web/js/deluge-all/details/DetailsPanel.js b/deluge/ui/web/js/deluge-all/details/DetailsPanel.js index 1c51de4..3f28b25 100644 --- a/deluge/ui/web/js/deluge-all/details/DetailsPanel.js +++ b/deluge/ui/web/js/deluge-all/details/DetailsPanel.js @@ -16,7 +16,7 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { id: 'torrentDetails', activeTab: 0, - initComponent: function() { + initComponent: function () { Deluge.details.DetailsPanel.superclass.initComponent.call(this); this.add(new Deluge.details.StatusTab()); this.add(new Deluge.details.DetailsTab()); @@ -25,8 +25,8 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { this.add(new Deluge.details.OptionsTab()); }, - clear: function() { - this.items.each(function(panel) { + clear: function () { + this.items.each(function (panel) { if (panel.clear) { panel.clear.defer(100, panel); panel.disable(); @@ -34,14 +34,14 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { }); }, - update: function(tab) { + update: function (tab) { var torrent = deluge.torrents.getSelected(); if (!torrent) { this.clear(); return; } - this.items.each(function(tab) { + this.items.each(function (tab) { if (tab.disabled) tab.enable(); }); @@ -52,7 +52,7 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { /* Event Handlers */ // We need to add the events in onRender since Deluge.Torrents has not been created yet. - onRender: function(ct, position) { + onRender: function (ct, position) { Deluge.details.DetailsPanel.superclass.onRender.call( this, ct, @@ -64,18 +64,18 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { deluge.torrents.getSelectionModel().on( 'selectionchange', - function(selModel) { + function (selModel) { if (!selModel.hasSelection()) this.clear(); }, this ); }, - onTabChange: function(panel, tab) { + onTabChange: function (panel, tab) { this.update(tab); }, - onTorrentsClick: function(grid, rowIndex, e) { + onTorrentsClick: function (grid, rowIndex, e) { this.update(); }, }); diff --git a/deluge/ui/web/js/deluge-all/details/DetailsTab.js b/deluge/ui/web/js/deluge-all/details/DetailsTab.js index 84929ae..f1da178 100644 --- a/deluge/ui/web/js/deluge-all/details/DetailsTab.js +++ b/deluge/ui/web/js/deluge-all/details/DetailsTab.js @@ -18,7 +18,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { oldData: {}, - initComponent: function() { + initComponent: function () { Deluge.details.DetailsTab.superclass.initComponent.call(this); this.addItem('torrent_name', _('Name:')); this.addItem('hash', _('Hash:')); @@ -31,7 +31,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { this.addItem('creator', _('Created By:')); }, - onRender: function(ct, position) { + onRender: function (ct, position) { Deluge.details.DetailsTab.superclass.onRender.call(this, ct, position); this.body.setStyle('padding', '10px'); this.dl = Ext.DomHelper.append(this.body, { tag: 'dl' }, true); @@ -41,7 +41,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { } }, - addItem: function(id, label) { + addItem: function (id, label) { if (!this.rendered) { this.queuedItems[id] = label; } else { @@ -50,7 +50,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { }, // private - doAddItem: function(id, label) { + doAddItem: function (id, label) { Ext.DomHelper.append(this.dl, { tag: 'dt', cls: id, html: label }); this.fields[id] = Ext.DomHelper.append( this.dl, @@ -59,7 +59,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { ); }, - clear: function() { + clear: function () { if (!this.fields) return; for (var k in this.fields) { this.fields[k].dom.innerHTML = ''; @@ -67,7 +67,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { this.oldData = {}; }, - update: function(torrentId) { + update: function (torrentId) { deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Details, { success: this.onRequestComplete, scope: this, @@ -75,7 +75,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { }); }, - onRequestComplete: function(torrent, request, response, options) { + onRequestComplete: function (torrent, request, response, options) { var data = { torrent_name: torrent.name, hash: options.options.torrentId, @@ -91,7 +91,9 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { for (var field in this.fields) { if (!Ext.isDefined(data[field])) continue; // This is a field we are not responsible for. if (data[field] == this.oldData[field]) continue; - this.fields[field].dom.innerHTML = Ext.escapeHTML(data[field]); + this.fields[field].dom.innerHTML = Ext.util.Format.htmlEncode( + data[field] + ); } this.oldData = data; }, diff --git a/deluge/ui/web/js/deluge-all/details/FilesTab.js b/deluge/ui/web/js/deluge-all/details/FilesTab.js index 3a212fa..60de832 100644 --- a/deluge/ui/web/js/deluge-all/details/FilesTab.js +++ b/deluge/ui/web/js/deluge-all/details/FilesTab.js @@ -18,13 +18,14 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { header: _('Filename'), width: 330, dataIndex: 'filename', + tpl: new Ext.XTemplate('{filename:htmlEncode}'), }, { header: _('Size'), width: 150, dataIndex: 'size', tpl: new Ext.XTemplate('{size:this.fsize}', { - fsize: function(v) { + fsize: function (v) { return fsize(v); }, }), @@ -34,7 +35,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { header: _('Progress'), width: 150, dataIndex: 'progress', - renderer: function(v) { + renderer: function (v) { var progress = v * 100; return Deluge.progressBar( progress, @@ -54,11 +55,11 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { '{priority:this.getName}' + '</div></tpl>', { - getClass: function(v) { + getClass: function (v) { return FILE_PRIORITY_CSS[v]; }, - getName: function(v) { + getName: function (v) { return _(FILE_PRIORITY[v]); }, } @@ -68,15 +69,15 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { selModel: new Ext.tree.MultiSelectionModel(), - initComponent: function() { + initComponent: function () { Deluge.details.FilesTab.superclass.initComponent.call(this); this.setRootNode(new Ext.tree.TreeNode({ text: _('Files') })); }, - clear: function() { + clear: function () { var root = this.getRootNode(); if (!root.hasChildNodes()) return; - root.cascade(function(node) { + root.cascade(function (node) { var parentNode = node.parentNode; if (!parentNode) return; if (!parentNode.ownerTree) return; @@ -84,7 +85,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { }); }, - createFileTree: function(files) { + createFileTree: function (files) { function walk(files, parentNode) { for (var file in files.contents) { var item = files.contents[file]; @@ -123,7 +124,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { root.firstChild.expand(); }, - update: function(torrentId) { + update: function (torrentId) { if (this.torrentId != torrentId) { this.clear(); this.torrentId = torrentId; @@ -136,7 +137,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { }); }, - updateFileTree: function(files) { + updateFileTree: function (files) { function walk(files, parentNode) { for (var file in files.contents) { var item = files.contents[file]; @@ -153,7 +154,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { walk(files, this.getRootNode()); }, - onRender: function(ct, position) { + onRender: function (ct, position) { Deluge.details.FilesTab.superclass.onRender.call(this, ct, position); deluge.menus.filePriorities.on('itemclick', this.onItemClick, this); this.on('contextmenu', this.onContextMenu, this); @@ -162,7 +163,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { }); }, - onContextMenu: function(node, e) { + onContextMenu: function (node, e) { e.stopEvent(); var selModel = this.getSelectionModel(); if (selModel.getSelectedNodes().length < 2) { @@ -172,14 +173,14 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { deluge.menus.filePriorities.showAt(e.getPoint()); }, - onItemClick: function(baseItem, e) { + onItemClick: function (baseItem, e) { switch (baseItem.id) { case 'expandAll': this.expandAll(); break; default: var indexes = {}; - var walk = function(node) { + var walk = function (node) { if (Ext.isEmpty(node.attributes.fileIndex)) return; indexes[node.attributes.fileIndex] = node.attributes.priority; @@ -187,9 +188,9 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { this.getRootNode().cascade(walk); var nodes = this.getSelectionModel().getSelectedNodes(); - Ext.each(nodes, function(node) { + Ext.each(nodes, function (node) { if (!node.isLeaf()) { - var setPriorities = function(node) { + var setPriorities = function (node) { if (Ext.isEmpty(node.attributes.fileIndex)) return; indexes[node.attributes.fileIndex] = baseItem.filePriority; @@ -211,8 +212,8 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { [this.torrentId], { file_priorities: priorities }, { - success: function() { - Ext.each(nodes, function(node) { + success: function () { + Ext.each(nodes, function (node) { node.setColumnValue(3, baseItem.filePriority); }); }, @@ -223,7 +224,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { } }, - onRequestComplete: function(files, options) { + onRequestComplete: function (files, options) { if (!this.getRootNode().hasChildNodes()) { this.createFileTree(files); } else { diff --git a/deluge/ui/web/js/deluge-all/details/OptionsTab.js b/deluge/ui/web/js/deluge-all/details/OptionsTab.js index b11486b..7e59cba 100644 --- a/deluge/ui/web/js/deluge-all/details/OptionsTab.js +++ b/deluge/ui/web/js/deluge-all/details/OptionsTab.js @@ -9,7 +9,7 @@ */ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { autoScroll: true, @@ -30,7 +30,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { Deluge.details.OptionsTab.superclass.constructor.call(this, config); }, - initComponent: function() { + initComponent: function () { Deluge.details.OptionsTab.superclass.initComponent.call(this); (this.fieldsets = {}), (this.fields = {}); @@ -339,7 +339,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { }); }, - onRender: function(ct, position) { + onRender: function (ct, position) { Deluge.details.OptionsTab.superclass.onRender.call(this, ct, position); // This is another hack I think, so keep an eye out here when upgrading. @@ -348,17 +348,17 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { this.doLayout(); }, - clear: function() { + clear: function () { if (this.torrentId == null) return; this.torrentId = null; this.optionsManager.changeId(null); }, - reset: function() { + reset: function () { if (this.torrentId) this.optionsManager.reset(); }, - update: function(torrentId) { + update: function (torrentId) { if (this.torrentId && !torrentId) this.clear(); // we want to clear the pane if we get a null torrent torrentIds if (!torrentId) return; // We do not care about null torrentIds. @@ -373,33 +373,33 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { }); }, - onApply: function() { + onApply: function () { var changed = this.optionsManager.getDirty(); deluge.client.core.set_torrent_options([this.torrentId], changed, { - success: function() { + success: function () { this.optionsManager.commit(); }, scope: this, }); }, - onEditTrackers: function() { + onEditTrackers: function () { deluge.editTrackers.show(); }, - onMoveCompletedChecked: function(checkbox, checked) { + onMoveCompletedChecked: function (checkbox, checked) { this.fields.move_completed_path.setDisabled(!checked); if (!checked) return; this.fields.move_completed_path.focus(); }, - onStopRatioChecked: function(checkbox, checked) { + onStopRatioChecked: function (checkbox, checked) { this.fields.remove_at_ratio.setDisabled(!checked); this.fields.stop_ratio.setDisabled(!checked); }, - onRequestComplete: function(torrent, options) { + onRequestComplete: function (torrent, options) { this.fields['private'].setValue(torrent['private']); this.fields['private'].setDisabled(true); delete torrent['private']; diff --git a/deluge/ui/web/js/deluge-all/details/PeersTab.js b/deluge/ui/web/js/deluge-all/details/PeersTab.js index 515e533..a191963 100644 --- a/deluge/ui/web/js/deluge-all/details/PeersTab.js +++ b/deluge/ui/web/js/deluge-all/details/PeersTab.js @@ -8,13 +8,13 @@ * See LICENSE for more details. */ -(function() { +(function () { function flagRenderer(value) { if (!value.replace(' ', '').replace(' ', '')) { return ''; } return String.format( - '<img src="{0}flag/{1}" />', + '<img alt="{1}" title="{1}" src="{0}flag/{1}" />', deluge.config.base, value ); @@ -40,7 +40,7 @@ // fast way to figure out if we have a peer already. peers: {}, - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { title: _('Peers'), @@ -73,7 +73,7 @@ header: _('Client'), width: 125, sortable: true, - renderer: fplain, + renderer: 'htmlEncode', dataIndex: 'client', }, { @@ -107,19 +107,19 @@ Deluge.details.PeersTab.superclass.constructor.call(this, config); }, - clear: function() { + clear: function () { this.getStore().removeAll(); this.peers = {}; }, - update: function(torrentId) { + update: function (torrentId) { deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Peers, { success: this.onRequestComplete, scope: this, }); }, - onRequestComplete: function(torrent, options) { + onRequestComplete: function (torrent, options) { if (!torrent) return; var store = this.getStore(); @@ -129,7 +129,7 @@ // Go through the peers updating and creating peer records Ext.each( torrent.peers, - function(peer) { + function (peer) { if (this.peers[peer.ip]) { var record = store.getById(peer.ip); record.beginEdit(); @@ -150,7 +150,7 @@ store.add(newPeers); // Remove any peers that should not be left in the store. - store.each(function(record) { + store.each(function (record) { if (!addresses[record.id]) { store.remove(record); delete this.peers[record.id]; diff --git a/deluge/ui/web/js/deluge-all/details/StatusTab.js b/deluge/ui/web/js/deluge-all/details/StatusTab.js index a8753bb..6055161 100644 --- a/deluge/ui/web/js/deluge-all/details/StatusTab.js +++ b/deluge/ui/web/js/deluge-all/details/StatusTab.js @@ -17,7 +17,7 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, { title: _('Status'), autoScroll: true, - onRender: function(ct, position) { + onRender: function (ct, position) { Deluge.details.StatusTab.superclass.onRender.call(this, ct, position); this.progressBar = this.add({ @@ -33,7 +33,7 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, { width: 1000, listeners: { render: { - fn: function(panel) { + fn: function (panel) { panel.load({ url: deluge.config.base + 'render/tab_status.html', text: _('Loading') + '...', @@ -48,14 +48,14 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, { }); }, - clear: function() { + clear: function () { this.progressBar.updateProgress(0, ' '); for (var k in this.fields) { this.fields[k].innerHTML = ''; } }, - update: function(torrentId) { + update: function (torrentId) { if (!this.fields) this.getFields(); deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Status, { success: this.onRequestComplete, @@ -63,18 +63,18 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, { }); }, - onPanelUpdate: function(el, response) { + onPanelUpdate: function (el, response) { this.fields = {}; Ext.each( Ext.query('dd', this.status.body.dom), - function(field) { + function (field) { this.fields[field.className] = field; }, this ); }, - onRequestComplete: function(status) { + onRequestComplete: function (status) { seeds = status.total_seeds > -1 ? status.num_seeds + ' (' + status.total_seeds + ')' |