fix actually escaping (foolish me had left it commented out) and also only update if there has been a change

This commit is contained in:
Damien Churchill 2009-10-27 10:34:07 +00:00
parent de82302c67
commit e17bd472a8
1 changed files with 6 additions and 4 deletions

View File

@ -42,6 +42,7 @@ Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
url: '/render/tab_details.html', url: '/render/tab_details.html',
text: _('Loading') + '...' text: _('Loading') + '...'
}); });
this.oldData = {};
this.body.setStyle('padding', '5px'); this.body.setStyle('padding', '5px');
this.getUpdater().on('update', this.onPanelUpdate, this); this.getUpdater().on('update', this.onPanelUpdate, this);
}, },
@ -68,10 +69,10 @@ Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
}, this); }, this);
}, },
onRequestComplete: function(torrent, options) { onRequestComplete: function(torrent, request, response, options) {
var data = { var data = {
torrent_name: torrent.name, torrent_name: torrent.name,
hash: options.torrentId, hash: options.options.torrentId,
path: torrent.save_path, path: torrent.save_path,
size: fsize(torrent.total_size), size: fsize(torrent.total_size),
files: torrent.num_files, files: torrent.num_files,
@ -81,9 +82,10 @@ Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
}; };
for (var field in this.fields) { for (var field in this.fields) {
//this.fields[field].innerHTML = Ext.escapeHTML(data[field]); if (data[field] == this.oldData[field]) continue;
this.fields[field].innerHTML = data[field]; this.fields[field].innerHTML = Ext.escapeHTML(data[field]);
} }
this.oldData = data;
} }
}); });
Deluge.Details.add(new Ext.deluge.details.DetailsTab()); Deluge.Details.add(new Ext.deluge.details.DetailsTab());