2008-05-17 12:44:42 +00:00
|
|
|
/* -----------------------------------------------------------------
|
|
|
|
|
|
|
|
ATTACH MOCHA LINK EVENTS
|
|
|
|
Notes: Here is where you define your windows and the events that open them.
|
|
|
|
If you are not using links to run Mocha methods you can remove this function.
|
|
|
|
|
|
|
|
If you need to add link events to links within windows you are creating, do
|
|
|
|
it in the onContentLoaded function of the new window.
|
|
|
|
|
|
|
|
----------------------------------------------------------------- */
|
|
|
|
|
2008-12-23 23:47:30 +00:00
|
|
|
initializeWindows = function(){
|
2008-05-17 12:44:42 +00:00
|
|
|
|
|
|
|
function addClickEvent(el, fn){
|
|
|
|
['Link','Button'].each(function(item) {
|
|
|
|
if ($(el+item)){
|
|
|
|
$(el+item).addEvent('click', fn);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
addClickEvent('download', function(e){
|
|
|
|
new Event(e).stop();
|
2008-12-23 23:47:30 +00:00
|
|
|
new MochaUI.Window({
|
2008-05-17 12:44:42 +00:00
|
|
|
id: 'downloadPage',
|
2011-01-14 19:01:11 +00:00
|
|
|
title: "_(Download from urls)",
|
2008-05-17 12:44:42 +00:00
|
|
|
loadMethod: 'iframe',
|
|
|
|
contentURL:'download.html',
|
2009-12-05 14:19:37 +00:00
|
|
|
scrollbars: true,
|
2008-05-17 12:44:42 +00:00
|
|
|
resizable: false,
|
|
|
|
maximizable: false,
|
2008-12-23 23:47:30 +00:00
|
|
|
closable: true,
|
2008-05-17 12:44:42 +00:00
|
|
|
paddingVertical: 0,
|
|
|
|
paddingHorizontal: 0,
|
|
|
|
width: 500,
|
2010-03-12 20:24:12 +00:00
|
|
|
height: 300
|
2008-05-17 12:44:42 +00:00
|
|
|
});
|
|
|
|
});
|
2008-07-31 12:03:28 +00:00
|
|
|
|
2009-11-26 08:10:23 +00:00
|
|
|
addClickEvent('preferences', function(e) {
|
|
|
|
new Event(e).stop();
|
|
|
|
new MochaUI.Window({
|
|
|
|
id: 'preferencesPage',
|
2010-06-29 08:08:43 +00:00
|
|
|
title: "_(Options)",
|
* Replace priority combo boxes by check boxes in Web UI as in Regular UI
* Prepare http server and preferences classes to add new settings to Web UI
* Tabified Program preferences in Web UI since there will be a lot of settings soon
* Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing
* Added a command line parameter to change the web ui port
* Fix PeerGuardian .p2b binary filter support
2009-12-28 19:39:47 +00:00
|
|
|
loadMethod: 'xhr',
|
|
|
|
toolbar: true,
|
|
|
|
contentURL: 'preferences_content.html',
|
|
|
|
require: {
|
|
|
|
css: ['css/Tabs.css']
|
|
|
|
},
|
|
|
|
toolbarURL: 'preferences.html',
|
|
|
|
resizable: true,
|
2009-11-26 08:10:23 +00:00
|
|
|
maximizable: false,
|
|
|
|
closable: true,
|
|
|
|
paddingVertical: 0,
|
|
|
|
paddingHorizontal: 0,
|
* Replace priority combo boxes by check boxes in Web UI as in Regular UI
* Prepare http server and preferences classes to add new settings to Web UI
* Tabified Program preferences in Web UI since there will be a lot of settings soon
* Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing
* Added a command line parameter to change the web ui port
* Fix PeerGuardian .p2b binary filter support
2009-12-28 19:39:47 +00:00
|
|
|
width: 700,
|
2009-11-26 09:49:57 +00:00
|
|
|
height: 300
|
2009-11-26 08:10:23 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2008-07-31 12:03:28 +00:00
|
|
|
addClickEvent('upload', function(e){
|
|
|
|
new Event(e).stop();
|
2008-12-23 23:47:30 +00:00
|
|
|
new MochaUI.Window({
|
2008-07-31 12:03:28 +00:00
|
|
|
id: 'uploadPage',
|
2009-11-23 13:35:46 +00:00
|
|
|
title: "_(Download local torrent)",
|
2008-07-31 12:03:28 +00:00
|
|
|
loadMethod: 'iframe',
|
|
|
|
contentURL:'upload.html',
|
2009-12-05 14:19:37 +00:00
|
|
|
scrollbars: true,
|
2008-07-31 12:03:28 +00:00
|
|
|
resizable: false,
|
|
|
|
maximizable: false,
|
|
|
|
paddingVertical: 0,
|
|
|
|
paddingHorizontal: 0,
|
2011-09-24 21:37:34 +03:00
|
|
|
width: 600,
|
|
|
|
height: 170
|
2008-07-31 12:03:28 +00:00
|
|
|
});
|
|
|
|
});
|
2009-11-17 08:15:26 +00:00
|
|
|
|
2010-02-15 20:57:55 +00:00
|
|
|
globalUploadLimitFN = function() {
|
|
|
|
new MochaUI.Window({
|
|
|
|
id: 'uploadLimitPage',
|
|
|
|
title: "_(Global Upload Speed Limiting)",
|
|
|
|
loadMethod: 'iframe',
|
|
|
|
contentURL:'uploadlimit.html?hash=global',
|
|
|
|
scrollbars: false,
|
|
|
|
resizable: false,
|
|
|
|
maximizable: false,
|
|
|
|
paddingVertical: 0,
|
|
|
|
paddingHorizontal: 0,
|
|
|
|
width: 424,
|
|
|
|
height: 80
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2009-11-25 10:03:04 +00:00
|
|
|
uploadLimitFN = function() {
|
|
|
|
var h = myTable.selectedIds();
|
|
|
|
if(h.length){
|
|
|
|
var hash = h[0];
|
|
|
|
new MochaUI.Window({
|
|
|
|
id: 'uploadLimitPage',
|
|
|
|
title: "_(Torrent Upload Speed Limiting)",
|
|
|
|
loadMethod: 'iframe',
|
|
|
|
contentURL:'uploadlimit.html?hash='+hash,
|
|
|
|
scrollbars: false,
|
|
|
|
resizable: false,
|
|
|
|
maximizable: false,
|
|
|
|
paddingVertical: 0,
|
|
|
|
paddingHorizontal: 0,
|
|
|
|
width: 424,
|
|
|
|
height: 80
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2009-11-17 08:15:26 +00:00
|
|
|
|
2010-02-15 20:57:55 +00:00
|
|
|
globalDownloadLimitFN = function() {
|
|
|
|
new MochaUI.Window({
|
|
|
|
id: 'downloadLimitPage',
|
|
|
|
title: "_(Global Download Speed Limiting)",
|
|
|
|
loadMethod: 'iframe',
|
|
|
|
contentURL:'downloadlimit.html?hash=global',
|
|
|
|
scrollbars: false,
|
|
|
|
resizable: false,
|
|
|
|
maximizable: false,
|
|
|
|
paddingVertical: 0,
|
|
|
|
paddingHorizontal: 0,
|
|
|
|
width: 424,
|
|
|
|
height: 80
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2009-11-25 10:03:04 +00:00
|
|
|
downloadLimitFN = function() {
|
|
|
|
var h = myTable.selectedIds();
|
|
|
|
if(h.length){
|
|
|
|
var hash = h[0];
|
|
|
|
new MochaUI.Window({
|
|
|
|
id: 'downloadLimitPage',
|
|
|
|
title: "_(Torrent Download Speed Limiting)",
|
|
|
|
loadMethod: 'iframe',
|
|
|
|
contentURL:'downloadlimit.html?hash='+hash,
|
|
|
|
scrollbars: false,
|
|
|
|
resizable: false,
|
|
|
|
maximizable: false,
|
|
|
|
paddingVertical: 0,
|
|
|
|
paddingHorizontal: 0,
|
|
|
|
width: 424,
|
|
|
|
height: 80
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2009-11-17 08:15:26 +00:00
|
|
|
|
2009-11-24 19:41:31 +00:00
|
|
|
deleteFN = function() {
|
2009-11-23 09:16:32 +00:00
|
|
|
var h = myTable.selectedIds();
|
2010-12-15 19:51:19 +00:00
|
|
|
/*if(h.length && confirm('_(Are you sure you want to delete the selected torrents from the transfer list?)')) {
|
2008-09-27 10:08:07 +00:00
|
|
|
h.each(function(item, index){
|
|
|
|
new Request({url: '/command/delete', method: 'post', data: {hash: item}}).send();
|
|
|
|
});
|
2010-12-15 19:51:19 +00:00
|
|
|
}*/
|
|
|
|
if(h.length) {
|
|
|
|
new MochaUI.Window({
|
|
|
|
id: 'confirmDeletionPage',
|
|
|
|
title: "_(Deletion confirmation - qBittorrent)",
|
|
|
|
loadMethod: 'iframe',
|
2011-10-02 00:53:00 +03:00
|
|
|
contentURL:'confirmdeletion.html?hashes='+h.join(','),
|
2010-12-15 19:51:19 +00:00
|
|
|
scrollbars: false,
|
|
|
|
resizable: false,
|
|
|
|
maximizable: false,
|
|
|
|
padding: 10,
|
|
|
|
width: 424,
|
|
|
|
height: 140
|
|
|
|
});
|
|
|
|
}
|
2009-11-24 19:41:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
addClickEvent('delete', function(e){
|
|
|
|
new Event(e).stop();
|
|
|
|
deleteFN();
|
2008-05-17 12:44:42 +00:00
|
|
|
});
|
2009-11-17 08:15:26 +00:00
|
|
|
|
2009-11-24 19:41:31 +00:00
|
|
|
pauseFN = function() {
|
|
|
|
var h = myTable.selectedIds();
|
|
|
|
if(h.length){
|
|
|
|
h.each(function(hash, index){
|
|
|
|
new Request({url: '/command/pause', method: 'post', data: {hash: hash}}).send();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
startFN = function() {
|
|
|
|
var h = myTable.selectedIds();
|
|
|
|
if(h.length){
|
|
|
|
h.each(function(hash, index){
|
|
|
|
new Request({url: '/command/resume', method: 'post', data: {hash: hash}}).send();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
recheckFN = function() {
|
|
|
|
var h = myTable.selectedIds();
|
|
|
|
if(h.length){
|
|
|
|
h.each(function(hash, index){
|
|
|
|
new Request({url: '/command/recheck', method: 'post', data: {hash: hash}}).send();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2008-12-28 21:12:49 +00:00
|
|
|
|
2010-12-19 13:37:12 +00:00
|
|
|
['pause','resume', 'recheck'].each(function(item) {
|
2008-05-17 12:44:42 +00:00
|
|
|
addClickEvent(item, function(e){
|
|
|
|
new Event(e).stop();
|
2009-11-23 09:16:32 +00:00
|
|
|
var h = myTable.selectedIds();
|
2008-09-27 10:08:07 +00:00
|
|
|
if(h.length){
|
2008-09-27 19:28:09 +00:00
|
|
|
h.each(function(hash, index){
|
|
|
|
new Request({url: '/command/'+item, method: 'post', data: {hash: hash}}).send();
|
2008-09-27 10:08:07 +00:00
|
|
|
});
|
2008-05-17 12:44:42 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
addClickEvent(item+'All', function(e){
|
|
|
|
new Event(e).stop();
|
2008-09-14 10:14:54 +00:00
|
|
|
new Request({url: '/command/'+item+'all'}).send();
|
2008-05-17 12:44:42 +00:00
|
|
|
});
|
|
|
|
});
|
2010-12-19 13:37:12 +00:00
|
|
|
|
|
|
|
['decreasePrio','increasePrio', 'topPrio', 'bottomPrio'].each(function(item) {
|
|
|
|
addClickEvent(item, function(e){
|
|
|
|
new Event(e).stop();
|
|
|
|
setPriorityFN(item);
|
|
|
|
});
|
|
|
|
});
|
2008-05-17 12:44:42 +00:00
|
|
|
|
2010-08-15 08:49:19 +00:00
|
|
|
setPriorityFN = function(cmd) {
|
|
|
|
var h = myTable.selectedIds();
|
2010-12-19 13:37:12 +00:00
|
|
|
if(h.length) {
|
|
|
|
new Request({url: '/command/'+cmd, method: 'post', data: {hashes: h.join("|")}}).send();
|
2010-08-15 08:49:19 +00:00
|
|
|
}
|
|
|
|
}
|
2009-11-17 08:15:26 +00:00
|
|
|
|
2008-05-17 12:44:42 +00:00
|
|
|
addClickEvent('bug', function(e){
|
|
|
|
new Event(e).stop();
|
2008-12-23 23:47:30 +00:00
|
|
|
new MochaUI.Window({
|
2008-05-17 12:44:42 +00:00
|
|
|
id: 'bugPage',
|
2009-11-23 13:35:46 +00:00
|
|
|
title: '_(Report a bug)',
|
2008-05-17 12:44:42 +00:00
|
|
|
loadMethod: 'iframe',
|
|
|
|
contentURL: 'http://bugs.qbittorrent.org/',
|
|
|
|
width: 650,
|
2008-09-27 20:31:50 +00:00
|
|
|
height: 400
|
2008-05-17 12:44:42 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
addClickEvent('site', function(e){
|
|
|
|
new Event(e).stop();
|
2008-12-23 23:47:30 +00:00
|
|
|
new MochaUI.Window({
|
2008-05-17 12:44:42 +00:00
|
|
|
id: 'sitePage',
|
|
|
|
title: 'qBittorrent Website',
|
|
|
|
loadMethod: 'iframe',
|
|
|
|
contentURL: 'http://www.qbittorrent.org/',
|
|
|
|
width: 650,
|
2008-09-27 20:31:50 +00:00
|
|
|
height: 400
|
2008-05-17 12:44:42 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
addClickEvent('docs', function(e){
|
|
|
|
new Event(e).stop();
|
2008-12-23 23:47:30 +00:00
|
|
|
new MochaUI.Window({
|
2008-05-17 12:44:42 +00:00
|
|
|
id: 'docsPage',
|
|
|
|
title: 'qBittorrent official wiki',
|
|
|
|
loadMethod: 'iframe',
|
|
|
|
contentURL: 'http://wiki.qbittorrent.org/',
|
|
|
|
width: 650,
|
2008-09-27 20:31:50 +00:00
|
|
|
height: 400
|
2008-05-17 12:44:42 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
addClickEvent('about', function(e){
|
|
|
|
new Event(e).stop();
|
2008-12-23 23:47:30 +00:00
|
|
|
new MochaUI.Window({
|
2008-05-17 12:44:42 +00:00
|
|
|
id: 'aboutpage',
|
|
|
|
title: 'About',
|
2011-09-24 21:37:34 +03:00
|
|
|
loadMethod: 'xhr',
|
2008-05-17 12:44:42 +00:00
|
|
|
contentURL: 'about.html',
|
|
|
|
width: 650,
|
2011-09-24 21:37:34 +03:00
|
|
|
height: 200,
|
2010-12-15 19:51:19 +00:00
|
|
|
padding: 10
|
2008-05-17 12:44:42 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Deactivate menu header links
|
|
|
|
$$('a.returnFalse').each(function(el){
|
|
|
|
el.addEvent('click', function(e){
|
|
|
|
new Event(e).stop();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|