diff --git a/deluge/ui/web/js/Deluge.Details.Details.js b/deluge/ui/web/js/Deluge.Details.Details.js index 63590a1e1..0d10a4259 100644 --- a/deluge/ui/web/js/Deluge.Details.Details.js +++ b/deluge/ui/web/js/Deluge.Details.Details.js @@ -33,56 +33,57 @@ Copyright: */ Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, { - title: _('Details'), - bodyStyle: 'padding 5px', - - onRender: function(ct, position) { - Ext.deluge.details.DetailsTab.superclass.onRender.call(this, ct, position); - this.load({ - url: '/render/tab_details.html', - text: _('Loading') + '...' - }); - this.body.setStyle('padding', '5px'); - 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) { - 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]; - } + title: _('Details'), + bodyStyle: 'padding 5px', + + onRender: function(ct, position) { + Ext.deluge.details.DetailsTab.superclass.onRender.call(this, ct, position); + this.load({ + url: '/render/tab_details.html', + text: _('Loading') + '...' + }); + this.body.setStyle('padding', '5px'); + 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) { + 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 = Ext.escapeHTML(data[field]); + 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.js b/deluge/ui/web/js/Deluge.js index c17100cf0..63ea8816b 100644 --- a/deluge/ui/web/js/Deluge.js +++ b/deluge/ui/web/js/Deluge.js @@ -38,39 +38,44 @@ Ext.namespace('Ext.deluge'); Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); (function() { - /* Add some helper functions to Ext */ - Ext.apply(Function.prototype, { - bind: function(scope) { - var self = this; - return function() { - return self.apply(scope, arguments); - } - } - }); + /* Add some helper functions to Ext */ + Ext.apply(Function.prototype, { + bind: function(scope) { + var self = this; + return function() { + return self.apply(scope, arguments); + } + } + }); + + Ext.apply(Ext, { + escapeHTML: function(text) { + text = String(text); + return text.replace('&', '&'); + }, - Ext.apply(Ext, { - isObjectEmpty: function(obj) { - for(var i in obj) { return false; } - return true; - }, - - keys: function(obj) { - var keys = []; - for (i in obj) if (obj.hasOwnProperty(i)) - { - keys.push(i); - } - return keys; - }, - - splat: function(obj) { - var type = Ext.type(obj); - return (type) ? ((type != 'array') ? [obj] : obj) : []; - } - }); - Ext.getKeys = Ext.keys; - - Ext.BLANK_IMAGE_URL = '/images/s.gif'; + isObjectEmpty: function(obj) { + for(var i in obj) { return false; } + return true; + }, + + keys: function(obj) { + var keys = []; + for (i in obj) if (obj.hasOwnProperty(i)) + { + keys.push(i); + } + return keys; + }, + + splat: function(obj) { + var type = Ext.type(obj); + return (type) ? ((type != 'array') ? [obj] : obj) : []; + } + }); + Ext.getKeys = Ext.keys; + + Ext.BLANK_IMAGE_URL = '/images/s.gif'; })(); (function() {