|
|
|
@ -24,62 +24,6 @@
@@ -24,62 +24,6 @@
|
|
|
|
|
|
|
|
|
|
myTable = new dynamicTable(); |
|
|
|
|
|
|
|
|
|
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 stateToImg = function (state) { |
|
|
|
|
if (state == "pausedUP" || state == "pausedDL") { |
|
|
|
|
state = "paused"; |
|
|
|
@ -95,48 +39,8 @@ window.addEvent('load', function () {
@@ -95,48 +39,8 @@ window.addEvent('load', function () {
|
|
|
|
|
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 ajaxfn = function () { |
|
|
|
|
var loadTorrentsInfoTimer; |
|
|
|
|
var loadTorrentsInfo = function () { |
|
|
|
|
var queueing_enabled = false; |
|
|
|
|
var url = new URI('json/torrents'); |
|
|
|
|
url.setData('filter', filter); |
|
|
|
@ -148,7 +52,7 @@ window.addEvent('load', function () {
@@ -148,7 +52,7 @@ window.addEvent('load', function () {
|
|
|
|
|
method : 'get', |
|
|
|
|
onFailure : function () { |
|
|
|
|
$('error_div').set('html', '_(qBittorrent client is not reachable)'); |
|
|
|
|
ajaxfnTimer = ajaxfn.delay(2000); |
|
|
|
|
loadTorrentsInfoTimer = loadTorrentsInfo.delay(2000); |
|
|
|
|
}, |
|
|
|
|
onSuccess : function (events) { |
|
|
|
|
$('error_div').set('html', ''); |
|
|
|
@ -223,16 +127,112 @@ window.addEvent('load', function () {
@@ -223,16 +127,112 @@ window.addEvent('load', function () {
|
|
|
|
|
|
|
|
|
|
myTable.altRow(); |
|
|
|
|
} |
|
|
|
|
ajaxfnTimer = ajaxfn.delay(1500); |
|
|
|
|
loadTorrentsInfoTimer = loadTorrentsInfo.delay(1500); |
|
|
|
|
} |
|
|
|
|
}).send(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var updateTransferList = function() { |
|
|
|
|
clearTimeout(ajaxfnTimer); |
|
|
|
|
ajaxfnTimer = ajaxfn(); |
|
|
|
|
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(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var updateTransferInfo = function() { |
|
|
|
|
clearTimeout(loadTransferInfoTimer); |
|
|
|
|
loadTransferInfoTimer = loadTransferInfo(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Start fetching data now
|
|
|
|
|
loadTransferInfo(); |
|
|
|
|
|
|
|
|
|
$('DlInfos').addEvent('click', globalDownloadLimitFN); |
|
|
|
|
$('UpInfos').addEvent('click', globalUploadLimitFN); |
|
|
|
|
|
|
|
|
|
setSortedColumn = function (column) { |
|
|
|
|
myTable.setSortedColumn(column); |
|
|
|
|
updateTransferList(); |
|
|
|
|