|
|
@ -24,63 +24,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
myTable = new dynamicTable(); |
|
|
|
myTable = new dynamicTable(); |
|
|
|
|
|
|
|
|
|
|
|
window.addEvent('load', function () { |
|
|
|
var stateToImg = function (state) { |
|
|
|
|
|
|
|
|
|
|
|
var saveColumnSizes = function () { |
|
|
|
|
|
|
|
var filters_width = $('Filters').getSize().x; |
|
|
|
|
|
|
|
var properties_height = $('propertiesPanel').getSize().y; |
|
|
|
|
|
|
|
localStorage.setItem('filters_width', filters_width); |
|
|
|
|
|
|
|
localStorage.setItem('properties_height', properties_height); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*MochaUI.Desktop = new MochaUI.Desktop(); |
|
|
|
|
|
|
|
MochaUI.Desktop.desktop.setStyles({ |
|
|
|
|
|
|
|
'background': '#fff', |
|
|
|
|
|
|
|
'visibility': 'visible' |
|
|
|
|
|
|
|
});*/ |
|
|
|
|
|
|
|
MochaUI.Desktop.initialize(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var filt_w = localStorage.getItem('filters_width'); |
|
|
|
|
|
|
|
if ($defined(filt_w)) |
|
|
|
|
|
|
|
filt_w = filt_w.toInt(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
filt_w = 120; |
|
|
|
|
|
|
|
new MochaUI.Column({ |
|
|
|
|
|
|
|
id : 'filtersColumn', |
|
|
|
|
|
|
|
placement : 'left', |
|
|
|
|
|
|
|
onResize : saveColumnSizes, |
|
|
|
|
|
|
|
width : filt_w, |
|
|
|
|
|
|
|
resizeLimit : [100, 300] |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
new MochaUI.Column({ |
|
|
|
|
|
|
|
id : 'mainColumn', |
|
|
|
|
|
|
|
placement : 'main', |
|
|
|
|
|
|
|
width : null, |
|
|
|
|
|
|
|
resizeLimit : [100, 300] |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
MochaUI.Desktop.setDesktopSize(); |
|
|
|
|
|
|
|
new MochaUI.Panel({ |
|
|
|
|
|
|
|
id : 'Filters', |
|
|
|
|
|
|
|
title : 'Panel', |
|
|
|
|
|
|
|
header : false, |
|
|
|
|
|
|
|
padding : { |
|
|
|
|
|
|
|
top : 0, |
|
|
|
|
|
|
|
right : 0, |
|
|
|
|
|
|
|
bottom : 0, |
|
|
|
|
|
|
|
left : 0 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
loadMethod : 'xhr', |
|
|
|
|
|
|
|
contentURL : 'filters.html', |
|
|
|
|
|
|
|
column : 'filtersColumn', |
|
|
|
|
|
|
|
height : 300 |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
initializeWindows(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var speedInTitle = localStorage.getItem('speed_in_browser_title_bar') == "true"; |
|
|
|
|
|
|
|
if (!speedInTitle) |
|
|
|
|
|
|
|
$('speedInBrowserTitleBarLink').firstChild.style.opacity = '0'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var stateToImg = function (state) { |
|
|
|
|
|
|
|
if (state == "pausedUP" || state == "pausedDL") { |
|
|
|
if (state == "pausedUP" || state == "pausedDL") { |
|
|
|
state = "paused"; |
|
|
|
state = "paused"; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -93,50 +37,10 @@ window.addEvent('load', function () { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return 'images/skin/' + state + '.png'; |
|
|
|
return 'images/skin/' + state + '.png'; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var loadTransferInfoTimer; |
|
|
|
|
|
|
|
var loadTransferInfo = function () { |
|
|
|
|
|
|
|
var url = 'json/transferInfo'; |
|
|
|
|
|
|
|
var request = new Request.JSON({ |
|
|
|
|
|
|
|
url : url, |
|
|
|
|
|
|
|
noCache : true, |
|
|
|
|
|
|
|
method : 'get', |
|
|
|
|
|
|
|
onFailure : function () { |
|
|
|
|
|
|
|
$('error_div').set('html', '_(qBittorrent client is not reachable)'); |
|
|
|
|
|
|
|
loadTransferInfoTimer = loadTransferInfo.delay(4000); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onSuccess : function (info) { |
|
|
|
|
|
|
|
if (info) { |
|
|
|
|
|
|
|
$("DlInfos").set('html', "_(D: %1 - T: %2)" |
|
|
|
|
|
|
|
.replace("%1", friendlyUnit(info.dl_info_speed, true)) |
|
|
|
|
|
|
|
.replace("%2", friendlyUnit(info.dl_info_data, false))); |
|
|
|
|
|
|
|
$("UpInfos").set('html', "_(U: %1 - T: %2)" |
|
|
|
|
|
|
|
.replace("%1", friendlyUnit(info.up_info_speed, true)) |
|
|
|
|
|
|
|
.replace("%2", friendlyUnit(info.up_info_data, false))); |
|
|
|
|
|
|
|
if (speedInTitle) |
|
|
|
|
|
|
|
document.title = "_(D:%1 U:%2)".replace("%1", friendlyUnit(info.dl_info_speed, true)).replace("%2", friendlyUnit(info.up_info_speed, true)); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
document.title = "_(qBittorrent web User Interface)"; |
|
|
|
|
|
|
|
loadTransferInfoTimer = loadTransferInfo.delay(3000); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).send(); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var updateTransferInfo = function() { |
|
|
|
|
|
|
|
clearTimeout(loadTransferInfoTimer); |
|
|
|
|
|
|
|
loadTransferInfoTimer = loadTransferInfo(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Start fetching data now
|
|
|
|
|
|
|
|
loadTransferInfo(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('DlInfos').addEvent('click', globalDownloadLimitFN); |
|
|
|
|
|
|
|
$('UpInfos').addEvent('click', globalUploadLimitFN); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ajaxfnTimer; |
|
|
|
var loadTorrentsInfoTimer; |
|
|
|
var ajaxfn = function () { |
|
|
|
var loadTorrentsInfo = function () { |
|
|
|
var queueing_enabled = false; |
|
|
|
var queueing_enabled = false; |
|
|
|
var url = new URI('json/torrents'); |
|
|
|
var url = new URI('json/torrents'); |
|
|
|
url.setData('filter', filter); |
|
|
|
url.setData('filter', filter); |
|
|
@ -148,7 +52,7 @@ window.addEvent('load', function () { |
|
|
|
method : 'get', |
|
|
|
method : 'get', |
|
|
|
onFailure : function () { |
|
|
|
onFailure : function () { |
|
|
|
$('error_div').set('html', '_(qBittorrent client is not reachable)'); |
|
|
|
$('error_div').set('html', '_(qBittorrent client is not reachable)'); |
|
|
|
ajaxfnTimer = ajaxfn.delay(2000); |
|
|
|
loadTorrentsInfoTimer = loadTorrentsInfo.delay(2000); |
|
|
|
}, |
|
|
|
}, |
|
|
|
onSuccess : function (events) { |
|
|
|
onSuccess : function (events) { |
|
|
|
$('error_div').set('html', ''); |
|
|
|
$('error_div').set('html', ''); |
|
|
@ -223,16 +127,112 @@ window.addEvent('load', function () { |
|
|
|
|
|
|
|
|
|
|
|
myTable.altRow(); |
|
|
|
myTable.altRow(); |
|
|
|
} |
|
|
|
} |
|
|
|
ajaxfnTimer = ajaxfn.delay(1500); |
|
|
|
loadTorrentsInfoTimer = loadTorrentsInfo.delay(1500); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).send(); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var updateTransferList = function() { |
|
|
|
|
|
|
|
clearTimeout(loadTorrentsInfoTimer); |
|
|
|
|
|
|
|
loadTorrentsInfoTimer = loadTorrentsInfo(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.addEvent('load', function () { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var saveColumnSizes = function () { |
|
|
|
|
|
|
|
var filters_width = $('Filters').getSize().x; |
|
|
|
|
|
|
|
var properties_height = $('propertiesPanel').getSize().y; |
|
|
|
|
|
|
|
localStorage.setItem('filters_width', filters_width); |
|
|
|
|
|
|
|
localStorage.setItem('properties_height', properties_height); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*MochaUI.Desktop = new MochaUI.Desktop(); |
|
|
|
|
|
|
|
MochaUI.Desktop.desktop.setStyles({ |
|
|
|
|
|
|
|
'background': '#fff', |
|
|
|
|
|
|
|
'visibility': 'visible' |
|
|
|
|
|
|
|
});*/ |
|
|
|
|
|
|
|
MochaUI.Desktop.initialize(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var filt_w = localStorage.getItem('filters_width'); |
|
|
|
|
|
|
|
if ($defined(filt_w)) |
|
|
|
|
|
|
|
filt_w = filt_w.toInt(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
filt_w = 120; |
|
|
|
|
|
|
|
new MochaUI.Column({ |
|
|
|
|
|
|
|
id : 'filtersColumn', |
|
|
|
|
|
|
|
placement : 'left', |
|
|
|
|
|
|
|
onResize : saveColumnSizes, |
|
|
|
|
|
|
|
width : filt_w, |
|
|
|
|
|
|
|
resizeLimit : [100, 300] |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
new MochaUI.Column({ |
|
|
|
|
|
|
|
id : 'mainColumn', |
|
|
|
|
|
|
|
placement : 'main', |
|
|
|
|
|
|
|
width : null, |
|
|
|
|
|
|
|
resizeLimit : [100, 300] |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
MochaUI.Desktop.setDesktopSize(); |
|
|
|
|
|
|
|
new MochaUI.Panel({ |
|
|
|
|
|
|
|
id : 'Filters', |
|
|
|
|
|
|
|
title : 'Panel', |
|
|
|
|
|
|
|
header : false, |
|
|
|
|
|
|
|
padding : { |
|
|
|
|
|
|
|
top : 0, |
|
|
|
|
|
|
|
right : 0, |
|
|
|
|
|
|
|
bottom : 0, |
|
|
|
|
|
|
|
left : 0 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
loadMethod : 'xhr', |
|
|
|
|
|
|
|
contentURL : 'filters.html', |
|
|
|
|
|
|
|
column : 'filtersColumn', |
|
|
|
|
|
|
|
height : 300 |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
initializeWindows(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var speedInTitle = localStorage.getItem('speed_in_browser_title_bar') == "true"; |
|
|
|
|
|
|
|
if (!speedInTitle) |
|
|
|
|
|
|
|
$('speedInBrowserTitleBarLink').firstChild.style.opacity = '0'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var loadTransferInfoTimer; |
|
|
|
|
|
|
|
var loadTransferInfo = function () { |
|
|
|
|
|
|
|
var url = 'json/transferInfo'; |
|
|
|
|
|
|
|
var request = new Request.JSON({ |
|
|
|
|
|
|
|
url : url, |
|
|
|
|
|
|
|
noCache : true, |
|
|
|
|
|
|
|
method : 'get', |
|
|
|
|
|
|
|
onFailure : function () { |
|
|
|
|
|
|
|
$('error_div').set('html', '_(qBittorrent client is not reachable)'); |
|
|
|
|
|
|
|
loadTransferInfoTimer = loadTransferInfo.delay(4000); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onSuccess : function (info) { |
|
|
|
|
|
|
|
if (info) { |
|
|
|
|
|
|
|
$("DlInfos").set('html', "_(D: %1 - T: %2)" |
|
|
|
|
|
|
|
.replace("%1", friendlyUnit(info.dl_info_speed, true)) |
|
|
|
|
|
|
|
.replace("%2", friendlyUnit(info.dl_info_data, false))); |
|
|
|
|
|
|
|
$("UpInfos").set('html', "_(U: %1 - T: %2)" |
|
|
|
|
|
|
|
.replace("%1", friendlyUnit(info.up_info_speed, true)) |
|
|
|
|
|
|
|
.replace("%2", friendlyUnit(info.up_info_data, false))); |
|
|
|
|
|
|
|
if (speedInTitle) |
|
|
|
|
|
|
|
document.title = "_(D:%1 U:%2)".replace("%1", friendlyUnit(info.dl_info_speed, true)).replace("%2", friendlyUnit(info.up_info_speed, true)); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
document.title = "_(qBittorrent web User Interface)"; |
|
|
|
|
|
|
|
loadTransferInfoTimer = loadTransferInfo.delay(3000); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}).send(); |
|
|
|
}).send(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var updateTransferList = function() { |
|
|
|
var updateTransferInfo = function() { |
|
|
|
clearTimeout(ajaxfnTimer); |
|
|
|
clearTimeout(loadTransferInfoTimer); |
|
|
|
ajaxfnTimer = ajaxfn(); |
|
|
|
loadTransferInfoTimer = loadTransferInfo(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Start fetching data now
|
|
|
|
|
|
|
|
loadTransferInfo(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('DlInfos').addEvent('click', globalDownloadLimitFN); |
|
|
|
|
|
|
|
$('UpInfos').addEvent('click', globalUploadLimitFN); |
|
|
|
|
|
|
|
|
|
|
|
setSortedColumn = function (column) { |
|
|
|
setSortedColumn = function (column) { |
|
|
|
myTable.setSortedColumn(column); |
|
|
|
myTable.setSortedColumn(column); |
|
|
|
updateTransferList(); |
|
|
|
updateTransferList(); |
|
|
|