WebUI: Update torrent properties immediately

Don't wait for new data to be fetched, request them as soon as
they are required, i.e. when a property tab is loaded or when a
different torrent is selected.
This commit is contained in:
Gabriele 2014-12-11 00:01:04 +01:00
parent c54271638b
commit 408cc7101e
5 changed files with 154 additions and 141 deletions

View file

@ -24,6 +24,8 @@
myTable = new dynamicTable();
var updatePropertiesPanel = function(){};
var stateToImg = function (state) {
if (state == "pausedUP" || state == "pausedDL") {
state = "paused";
@ -320,22 +322,34 @@ window.addEvent('load', function () {
tabsOnload : function() {
MochaUI.initializeTabs('propertiesTabs');
updatePropertiesPanel = function() {
if (!$('prop_general').hasClass('invisible'))
updateTorrentData();
else if (!$('prop_trackers').hasClass('invisible'))
updateTrackersData();
else if (!$('prop_files').hasClass('invisible'))
updateTorrentFilesData();
}
$('PropGeneralLink').addEvent('click', function(e){
$('prop_general').removeClass("invisible");
$('prop_trackers').addClass("invisible");
$('prop_files').addClass("invisible");
updatePropertiesPanel();
});
$('PropTrackersLink').addEvent('click', function(e){
$('prop_trackers').removeClass("invisible");
$('prop_general').addClass("invisible");
$('prop_files').addClass("invisible");
updatePropertiesPanel();
});
$('PropFilesLink').addEvent('click', function(e){
$('prop_files').removeClass("invisible");
$('prop_general').addClass("invisible");
$('prop_trackers').addClass("invisible");
updatePropertiesPanel();
});
},
column : 'mainColumn',