mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Refactor var
to let
/const
or this
This commit is contained in:
parent
b530e19a44
commit
fe0fb3a251
@ -32,7 +32,7 @@
|
|||||||
$('trackersUrls').focus();
|
$('trackersUrls').focus();
|
||||||
$('addTrackersButton').addEvent('click', function(e) {
|
$('addTrackersButton').addEvent('click', function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
var hash = new URI().getData('hash');
|
const hash = new URI().getData('hash');
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/addTrackers',
|
url: 'api/v2/torrents/addTrackers',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var hashes = new URI().getData('hashes').split('|');
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent('domready', function() {
|
||||||
|
const hashes = new URI().getData('hashes').split('|');
|
||||||
$('cancelBtn').focus();
|
$('cancelBtn').focus();
|
||||||
$('cancelBtn').addEvent('click', function(e) {
|
$('cancelBtn').addEvent('click', function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
@ -20,8 +20,8 @@
|
|||||||
$('confirmBtn').addEvent('click', function(e) {
|
$('confirmBtn').addEvent('click', function(e) {
|
||||||
parent.torrentsTable.deselectAll();
|
parent.torrentsTable.deselectAll();
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
var cmd = 'api/v2/torrents/delete';
|
const cmd = 'api/v2/torrents/delete';
|
||||||
var deleteFiles = $('deleteFromDiskCB').get('checked');
|
const deleteFiles = $('deleteFromDiskCB').get('checked');
|
||||||
new Request({
|
new Request({
|
||||||
url: cmd,
|
url: cmd,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -140,9 +140,9 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var encodedUrls = new URI().getData('urls');
|
const encodedUrls = new URI().getData('urls');
|
||||||
if (encodedUrls) {
|
if (encodedUrls) {
|
||||||
var urls = [];
|
const urls = [];
|
||||||
encodedUrls.split('|').each(function(url) {
|
encodedUrls.split('|').each(function(url) {
|
||||||
urls.push(decodeURIComponent(url));
|
urls.push(decodeURIComponent(url));
|
||||||
});
|
});
|
||||||
@ -151,7 +151,7 @@
|
|||||||
$('urls').set('value', urls.join("\n"));
|
$('urls').set('value', urls.join("\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
var submitted = false;
|
let submitted = false;
|
||||||
|
|
||||||
$('downloadForm').addEventListener("submit", function() {
|
$('downloadForm').addEventListener("submit", function() {
|
||||||
$('startTorrentHidden').value = $('startTorrent').checked ? 'false' : 'true';
|
$('startTorrentHidden').value = $('startTorrent').checked ? 'false' : 'true';
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var hashes = new URI().getData('hashes').split('|');
|
const hashes = new URI().getData('hashes').split('|');
|
||||||
var setDlLimit = function() {
|
const setDlLimit = function() {
|
||||||
var limit = $("dllimitUpdatevalue").value.toInt() * 1024;
|
const limit = $("dllimitUpdatevalue").value.toInt() * 1024;
|
||||||
if (hashes[0] == "global") {
|
if (hashes[0] == "global") {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/transfer/setDownloadLimit',
|
url: 'api/v2/transfer/setDownloadLimit',
|
||||||
|
@ -29,17 +29,17 @@
|
|||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
var currentUrl = new URI().getData('url');
|
const currentUrl = new URI().getData('url');
|
||||||
if (!currentUrl)
|
if (!currentUrl)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var decodedUrl = decodeURIComponent(currentUrl);
|
const decodedUrl = decodeURIComponent(currentUrl);
|
||||||
$('trackerUrl').value = decodedUrl;
|
$('trackerUrl').value = decodedUrl;
|
||||||
$('trackerUrl').focus();
|
$('trackerUrl').focus();
|
||||||
|
|
||||||
$('editTrackerButton').addEvent('click', function(e) {
|
$('editTrackerButton').addEvent('click', function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
var hash = new URI().getData('hash');
|
const hash = new URI().getData('hash');
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/editTracker',
|
url: 'api/v2/torrents/editTracker',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var categoriesFilterContextMenu = new CategoriesFilterContextMenu({
|
const categoriesFilterContextMenu = new CategoriesFilterContextMenu({
|
||||||
targets: '.categoriesFilterContextMenuTarget',
|
targets: '.categoriesFilterContextMenuTarget',
|
||||||
menu: 'categoriesFilterMenu',
|
menu: 'categoriesFilterMenu',
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var initInstallSearchPlugin = function() {
|
this.initInstallSearchPlugin = function() {
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: 'keydown',
|
||||||
events: {
|
events: {
|
||||||
@ -37,7 +37,7 @@
|
|||||||
// accept enter key as a click
|
// accept enter key as a click
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
var elem = e.event.srcElement;
|
const elem = e.event.srcElement;
|
||||||
if ((elem.id === "newPluginPath") || (elem.id === "newPluginOk"))
|
if ((elem.id === "newPluginPath") || (elem.id === "newPluginOk"))
|
||||||
newPluginOk();
|
newPluginOk();
|
||||||
else if (elem.id === "newPluginCancel")
|
else if (elem.id === "newPluginCancel")
|
||||||
@ -49,8 +49,8 @@
|
|||||||
$('newPluginPath').select();
|
$('newPluginPath').select();
|
||||||
};
|
};
|
||||||
|
|
||||||
var newPluginOk = function() {
|
this.newPluginOk = function() {
|
||||||
var path = $("newPluginPath").get("value").trim();
|
const path = $("newPluginPath").get("value").trim();
|
||||||
if (path)
|
if (path)
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/search/installPlugin',
|
url: 'api/v2/search/installPlugin',
|
||||||
|
@ -30,10 +30,10 @@
|
|||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent('domready', function() {
|
||||||
var uriAction = safeTrim(new URI().getData('action'));
|
const uriAction = safeTrim(new URI().getData('action'));
|
||||||
var uriHashes = safeTrim(new URI().getData('hashes'));
|
const uriHashes = safeTrim(new URI().getData('hashes'));
|
||||||
var uriCategoryName = safeTrim(new URI().getData('categoryName'));
|
const uriCategoryName = safeTrim(new URI().getData('categoryName'));
|
||||||
var uriSavePath = safeTrim(new URI().getData('savePath'));
|
const uriSavePath = safeTrim(new URI().getData('savePath'));
|
||||||
|
|
||||||
if (uriAction === "edit") {
|
if (uriAction === "edit") {
|
||||||
if (!uriCategoryName)
|
if (!uriCategoryName)
|
||||||
@ -51,10 +51,10 @@
|
|||||||
$('categoryNameButton').addEvent('click', function(e) {
|
$('categoryNameButton').addEvent('click', function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
var savePath = $('savePath').value.trim();
|
const savePath = $('savePath').value.trim();
|
||||||
var categoryName = $('categoryName').value.trim();
|
const categoryName = $('categoryName').value.trim();
|
||||||
|
|
||||||
var verifyCategoryName = function(name) {
|
const verifyCategoryName = function(name) {
|
||||||
if ((name === null) || (name === ""))
|
if ((name === null) || (name === ""))
|
||||||
return false;
|
return false;
|
||||||
if (name.match("^([^\\\\\\/]|[^\\\\\\/]([^\\\\\\/]|\\/(?=[^\\/]))*[^\\\\\\/])$") === null) {
|
if (name.match("^([^\\\\\\/]|[^\\\\\\/]([^\\\\\\/]|\\/(?=[^\\/]))*[^\\\\\\/])$") === null) {
|
||||||
|
@ -1084,34 +1084,34 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Downloads tab
|
// Downloads tab
|
||||||
var WatchedFoldersTable = new HtmlTable($("watched_folders_tab"));
|
this.WatchedFoldersTable = new HtmlTable($("watched_folders_tab"));
|
||||||
|
|
||||||
var updateTempDirEnabled = function() {
|
this.updateTempDirEnabled = function() {
|
||||||
var isTempDirEnabled = $('temppath_checkbox').getProperty('checked');
|
const isTempDirEnabled = $('temppath_checkbox').getProperty('checked');
|
||||||
$('temppath_text').setProperty('disabled', !isTempDirEnabled);
|
$('temppath_text').setProperty('disabled', !isTempDirEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var addWatchFolder = function() {
|
this.addWatchFolder = function() {
|
||||||
var new_folder = $('new_watch_folder_txt').getProperty('value').trim();
|
const new_folder = $('new_watch_folder_txt').getProperty('value').trim();
|
||||||
if (new_folder.length <= 0) return;
|
if (new_folder.length <= 0) return;
|
||||||
|
|
||||||
var new_other = $('new_watch_folder_other_txt').getProperty('value').trim();
|
const new_other = $('new_watch_folder_other_txt').getProperty('value').trim();
|
||||||
if (new_other.length <= 0) return;
|
if (new_other.length <= 0) return;
|
||||||
|
|
||||||
var new_select = $('new_watch_folder_select').getProperty('value').trim();
|
const new_select = $('new_watch_folder_select').getProperty('value').trim();
|
||||||
|
|
||||||
var i = $('watched_folders_tab').getChildren('tbody')[0].getChildren('tr').length;
|
const i = $('watched_folders_tab').getChildren('tbody')[0].getChildren('tr').length;
|
||||||
pushWatchFolder(i, new_folder, new_select, new_other);
|
pushWatchFolder(i, new_folder, new_select, new_other);
|
||||||
|
|
||||||
// Clear fields
|
// Clear fields
|
||||||
$('new_watch_folder_txt').setProperty('value', '');
|
$('new_watch_folder_txt').setProperty('value', '');
|
||||||
var elt = $('new_watch_folder_select');
|
const elt = $('new_watch_folder_select');
|
||||||
elt.setProperty('value', 'watch_folder');
|
elt.setProperty('value', 'watch_folder');
|
||||||
var text = elt.options[elt.selectedIndex].innerHTML;
|
const text = elt.options[elt.selectedIndex].innerHTML;
|
||||||
$('new_watch_folder_other_txt').setProperty('value', text);
|
$('new_watch_folder_other_txt').setProperty('value', text);
|
||||||
};
|
};
|
||||||
|
|
||||||
var changeWatchFolderSelect = function(item) {
|
this.changeWatchFolderSelect = function(item) {
|
||||||
if (item.value == "other") {
|
if (item.value == "other") {
|
||||||
item.nextElementSibling.hidden = false;
|
item.nextElementSibling.hidden = false;
|
||||||
item.nextElementSibling.value = 'QBT_TR(Type folder here)QBT_TR[CONTEXT=HttpServer]';
|
item.nextElementSibling.value = 'QBT_TR(Type folder here)QBT_TR[CONTEXT=HttpServer]';
|
||||||
@ -1119,15 +1119,15 @@
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
item.nextElementSibling.hidden = true;
|
item.nextElementSibling.hidden = true;
|
||||||
var text = item.options[item.selectedIndex].innerHTML;
|
const text = item.options[item.selectedIndex].innerHTML;
|
||||||
item.nextElementSibling.value = text;
|
item.nextElementSibling.value = text;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var pushWatchFolder = function(pos, folder, sel, other) {
|
this.pushWatchFolder = function(pos, folder, sel, other) {
|
||||||
var myinput = "<input id='text_watch_" + pos + "' type='text' value='" + folder + "'>";
|
const myinput = "<input id='text_watch_" + pos + "' type='text' value='" + folder + "'>";
|
||||||
var disableInput = (sel != "other");
|
const disableInput = (sel != "other");
|
||||||
var mycb = "<div class='select-watched-folder-editable'>"
|
const mycb = "<div class='select-watched-folder-editable'>"
|
||||||
+ "<select id ='cb_watch_" + pos + "' onchange='changeWatchFolderSelect(this)'>"
|
+ "<select id ='cb_watch_" + pos + "' onchange='changeWatchFolderSelect(this)'>"
|
||||||
+ "<option value='watch_folder'>QBT_TR(Monitored folder)QBT_TR[CONTEXT=ScanFoldersModel]</option>"
|
+ "<option value='watch_folder'>QBT_TR(Monitored folder)QBT_TR[CONTEXT=ScanFoldersModel]</option>"
|
||||||
+ "<option value='default_folder'>QBT_TR(Default save location)QBT_TR[CONTEXT=ScanFoldersModel]</option>"
|
+ "<option value='default_folder'>QBT_TR(Default save location)QBT_TR[CONTEXT=ScanFoldersModel]</option>"
|
||||||
@ -1138,20 +1138,20 @@
|
|||||||
WatchedFoldersTable.push([myinput, mycb]);
|
WatchedFoldersTable.push([myinput, mycb]);
|
||||||
$('cb_watch_' + pos).setProperty('value', sel);
|
$('cb_watch_' + pos).setProperty('value', sel);
|
||||||
if (disableInput) {
|
if (disableInput) {
|
||||||
var elt = $('cb_watch_' + pos);
|
const elt = $('cb_watch_' + pos);
|
||||||
other = elt.options[elt.selectedIndex].innerHTML;
|
other = elt.options[elt.selectedIndex].innerHTML;
|
||||||
}
|
}
|
||||||
$('cb_watch_txt_' + pos).setProperty('value', other);
|
$('cb_watch_txt_' + pos).setProperty('value', other);
|
||||||
};
|
};
|
||||||
|
|
||||||
var getWatchedFolders = function() {
|
this.getWatchedFolders = function() {
|
||||||
var nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
|
const nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
|
||||||
var folders = new Hash();
|
const folders = new Hash();
|
||||||
for (var i = 0; i < nb_folders; ++i) {
|
for (let i = 0; i < nb_folders; ++i) {
|
||||||
var fpath = $('text_watch_' + i).getProperty('value').trim();
|
const fpath = $('text_watch_' + i).getProperty('value').trim();
|
||||||
if (fpath.length > 0) {
|
if (fpath.length > 0) {
|
||||||
var other;
|
let other;
|
||||||
var sel = $('cb_watch_' + i).getProperty('value').trim();
|
const sel = $('cb_watch_' + i).getProperty('value').trim();
|
||||||
if (sel == "other") {
|
if (sel == "other") {
|
||||||
other = $('cb_watch_txt_' + i).getProperty('value').trim();
|
other = $('cb_watch_txt_' + i).getProperty('value').trim();
|
||||||
}
|
}
|
||||||
@ -1164,18 +1164,18 @@
|
|||||||
return folders;
|
return folders;
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateExportDirEnabled = function() {
|
this.updateExportDirEnabled = function() {
|
||||||
var isExportDirEnabled = $('exportdir_checkbox').getProperty('checked');
|
const isExportDirEnabled = $('exportdir_checkbox').getProperty('checked');
|
||||||
$('exportdir_text').setProperty('disabled', !isExportDirEnabled);
|
$('exportdir_text').setProperty('disabled', !isExportDirEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateExportDirFinEnabled = function() {
|
this.updateExportDirFinEnabled = function() {
|
||||||
var isExportDirFinEnabled = $('exportdirfin_checkbox').getProperty('checked');
|
const isExportDirFinEnabled = $('exportdirfin_checkbox').getProperty('checked');
|
||||||
$('exportdirfin_text').setProperty('disabled', !isExportDirFinEnabled);
|
$('exportdirfin_text').setProperty('disabled', !isExportDirFinEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateMailNotification = function() {
|
this.updateMailNotification = function() {
|
||||||
var isMailNotificationEnabled = $('mail_notification_checkbox').getProperty('checked');
|
const isMailNotificationEnabled = $('mail_notification_checkbox').getProperty('checked');
|
||||||
$('src_email_txt').setProperty('disabled', !isMailNotificationEnabled);
|
$('src_email_txt').setProperty('disabled', !isMailNotificationEnabled);
|
||||||
$('dest_email_txt').setProperty('disabled', !isMailNotificationEnabled);
|
$('dest_email_txt').setProperty('disabled', !isMailNotificationEnabled);
|
||||||
$('smtp_server_txt').setProperty('disabled', !isMailNotificationEnabled);
|
$('smtp_server_txt').setProperty('disabled', !isMailNotificationEnabled);
|
||||||
@ -1188,47 +1188,47 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateMailAuthSettings = function() {
|
this.updateMailAuthSettings = function() {
|
||||||
var isMailAuthEnabled = $('mail_auth_checkbox').getProperty('checked');
|
const isMailAuthEnabled = $('mail_auth_checkbox').getProperty('checked');
|
||||||
$('mail_username_text').setProperty('disabled', !isMailAuthEnabled);
|
$('mail_username_text').setProperty('disabled', !isMailAuthEnabled);
|
||||||
$('mail_password_text').setProperty('disabled', !isMailAuthEnabled);
|
$('mail_password_text').setProperty('disabled', !isMailAuthEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateAutoRun = function() {
|
this.updateAutoRun = function() {
|
||||||
var isAutoRunEnabled = $('autorun_checkbox').getProperty('checked');
|
const isAutoRunEnabled = $('autorun_checkbox').getProperty('checked');
|
||||||
$('autorunProg_txt').setProperty('disabled', !isAutoRunEnabled);
|
$('autorunProg_txt').setProperty('disabled', !isAutoRunEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Connection tab
|
// Connection tab
|
||||||
var updateMaxConnecEnabled = function() {
|
this.updateMaxConnecEnabled = function() {
|
||||||
var isMaxConnecEnabled = $('max_connec_checkbox').getProperty('checked');
|
const isMaxConnecEnabled = $('max_connec_checkbox').getProperty('checked');
|
||||||
$('max_connec_value').setProperty('disabled', !isMaxConnecEnabled);
|
$('max_connec_value').setProperty('disabled', !isMaxConnecEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateMaxConnecPerTorrentEnabled = function() {
|
this.updateMaxConnecPerTorrentEnabled = function() {
|
||||||
var isMaxConnecPerTorrentEnabled = $('max_connec_per_torrent_checkbox').getProperty('checked');
|
const isMaxConnecPerTorrentEnabled = $('max_connec_per_torrent_checkbox').getProperty('checked');
|
||||||
$('max_connec_per_torrent_value').setProperty('disabled', !isMaxConnecPerTorrentEnabled);
|
$('max_connec_per_torrent_value').setProperty('disabled', !isMaxConnecPerTorrentEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateMaxUploadsEnabled = function() {
|
this.updateMaxUploadsEnabled = function() {
|
||||||
var isMaxUploadsEnabled = $('max_uploads_checkbox').getProperty('checked');
|
const isMaxUploadsEnabled = $('max_uploads_checkbox').getProperty('checked');
|
||||||
$('max_uploads_value').setProperty('disabled', !isMaxUploadsEnabled);
|
$('max_uploads_value').setProperty('disabled', !isMaxUploadsEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateMaxUploadsPerTorrentEnabled = function() {
|
this.updateMaxUploadsPerTorrentEnabled = function() {
|
||||||
var isMaxUploadsPerTorrentEnabled = $('max_uploads_per_torrent_checkbox').getProperty('checked');
|
const isMaxUploadsPerTorrentEnabled = $('max_uploads_per_torrent_checkbox').getProperty('checked');
|
||||||
$('max_uploads_per_torrent_value').setProperty('disabled', !isMaxUploadsPerTorrentEnabled);
|
$('max_uploads_per_torrent_value').setProperty('disabled', !isMaxUploadsPerTorrentEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updatePeerProxySettings = function() {
|
this.updatePeerProxySettings = function() {
|
||||||
var isPeerProxyTypeSelected = $('peer_proxy_type_select').getProperty('value') != "none";
|
const isPeerProxyTypeSelected = $('peer_proxy_type_select').getProperty('value') != "none";
|
||||||
$('peer_proxy_host_text').setProperty('disabled', !isPeerProxyTypeSelected);
|
$('peer_proxy_host_text').setProperty('disabled', !isPeerProxyTypeSelected);
|
||||||
$('peer_proxy_port_value').setProperty('disabled', !isPeerProxyTypeSelected);
|
$('peer_proxy_port_value').setProperty('disabled', !isPeerProxyTypeSelected);
|
||||||
$('use_peer_proxy_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
|
$('use_peer_proxy_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
|
||||||
$('proxy_only_for_torrents_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
|
$('proxy_only_for_torrents_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
|
||||||
|
|
||||||
if (isPeerProxyTypeSelected) {
|
if (isPeerProxyTypeSelected) {
|
||||||
var isPeerProxyTypeSocks5 = $('peer_proxy_type_select').getProperty('value') == "socks5";
|
const isPeerProxyTypeSocks5 = $('peer_proxy_type_select').getProperty('value') == "socks5";
|
||||||
$('peer_proxy_auth_checkbox').setProperty('disabled', !isPeerProxyTypeSocks5);
|
$('peer_proxy_auth_checkbox').setProperty('disabled', !isPeerProxyTypeSocks5);
|
||||||
|
|
||||||
if (!isPeerProxyTypeSocks5) {
|
if (!isPeerProxyTypeSocks5) {
|
||||||
@ -1243,22 +1243,22 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var updatePeerProxyAuthSettings = function() {
|
this.updatePeerProxyAuthSettings = function() {
|
||||||
var isPeerProxyAuthEnabled = $('peer_proxy_auth_checkbox').getProperty('checked');
|
const isPeerProxyAuthEnabled = $('peer_proxy_auth_checkbox').getProperty('checked');
|
||||||
$('peer_proxy_username_text').setProperty('disabled', !isPeerProxyAuthEnabled);
|
$('peer_proxy_username_text').setProperty('disabled', !isPeerProxyAuthEnabled);
|
||||||
$('peer_proxy_password_text').setProperty('disabled', !isPeerProxyAuthEnabled);
|
$('peer_proxy_password_text').setProperty('disabled', !isPeerProxyAuthEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateFilterSettings = function() {
|
this.updateFilterSettings = function() {
|
||||||
var isIPFilterEnabled = $('ipfilter_enabled_checkbox').getProperty('checked');
|
const isIPFilterEnabled = $('ipfilter_enabled_checkbox').getProperty('checked');
|
||||||
$('ipfilter_text').setProperty('disabled', !isIPFilterEnabled);
|
$('ipfilter_text').setProperty('disabled', !isIPFilterEnabled);
|
||||||
$('ipfilter_trackers_checkbox').setProperty('disabled', !isIPFilterEnabled);
|
$('ipfilter_trackers_checkbox').setProperty('disabled', !isIPFilterEnabled);
|
||||||
$('banned_IPs_textarea').setProperty('disabled', !isIPFilterEnabled);
|
$('banned_IPs_textarea').setProperty('disabled', !isIPFilterEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Speed tab
|
// Speed tab
|
||||||
var updateSchedulingEnabled = function() {
|
this.updateSchedulingEnabled = function() {
|
||||||
var isLimitSchedulingEnabled = $('limit_sheduling_checkbox').getProperty('checked');
|
const isLimitSchedulingEnabled = $('limit_sheduling_checkbox').getProperty('checked');
|
||||||
$('schedule_from_hour').setProperty('disabled', !isLimitSchedulingEnabled);
|
$('schedule_from_hour').setProperty('disabled', !isLimitSchedulingEnabled);
|
||||||
$('schedule_from_min').setProperty('disabled', !isLimitSchedulingEnabled);
|
$('schedule_from_min').setProperty('disabled', !isLimitSchedulingEnabled);
|
||||||
$('schedule_to_hour').setProperty('disabled', !isLimitSchedulingEnabled);
|
$('schedule_to_hour').setProperty('disabled', !isLimitSchedulingEnabled);
|
||||||
@ -1267,8 +1267,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Bittorrent tab
|
// Bittorrent tab
|
||||||
var updateQueueingSystem = function() {
|
this.updateQueueingSystem = function() {
|
||||||
var isQueueingEnabled = $('queueing_checkbox').getProperty('checked');
|
const isQueueingEnabled = $('queueing_checkbox').getProperty('checked');
|
||||||
$('max_active_dl_value').setProperty('disabled', !isQueueingEnabled);
|
$('max_active_dl_value').setProperty('disabled', !isQueueingEnabled);
|
||||||
$('max_active_up_value').setProperty('disabled', !isQueueingEnabled);
|
$('max_active_up_value').setProperty('disabled', !isQueueingEnabled);
|
||||||
$('max_active_to_value').setProperty('disabled', !isQueueingEnabled);
|
$('max_active_to_value').setProperty('disabled', !isQueueingEnabled);
|
||||||
@ -1276,59 +1276,59 @@
|
|||||||
updateSlowTorrentsSettings();
|
updateSlowTorrentsSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateSlowTorrentsSettings = function() {
|
this.updateSlowTorrentsSettings = function() {
|
||||||
var isDontCountSlowTorrentsEnabled = (!$('dont_count_slow_torrents_checkbox').getProperty('disabled')) && $('dont_count_slow_torrents_checkbox').getProperty('checked');
|
const isDontCountSlowTorrentsEnabled = (!$('dont_count_slow_torrents_checkbox').getProperty('disabled')) && $('dont_count_slow_torrents_checkbox').getProperty('checked');
|
||||||
$('dl_rate_threshold').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
|
$('dl_rate_threshold').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
|
||||||
$('ul_rate_threshold').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
|
$('ul_rate_threshold').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
|
||||||
$('torrent_inactive_timer').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
|
$('torrent_inactive_timer').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateMaxRatioTimeEnabled = function() {
|
this.updateMaxRatioTimeEnabled = function() {
|
||||||
var isMaxRatioEnabled = $('max_ratio_checkbox').getProperty('checked');
|
const isMaxRatioEnabled = $('max_ratio_checkbox').getProperty('checked');
|
||||||
$('max_ratio_value').setProperty('disabled', !isMaxRatioEnabled);
|
$('max_ratio_value').setProperty('disabled', !isMaxRatioEnabled);
|
||||||
|
|
||||||
var isMaxSeedingTimeEnabled = $('max_seeding_time_checkbox').getProperty('checked');
|
const isMaxSeedingTimeEnabled = $('max_seeding_time_checkbox').getProperty('checked');
|
||||||
$('max_seeding_time_value').setProperty('disabled', !isMaxSeedingTimeEnabled);
|
$('max_seeding_time_value').setProperty('disabled', !isMaxSeedingTimeEnabled);
|
||||||
|
|
||||||
$('max_ratio_act').setProperty('disabled', !(isMaxRatioEnabled || isMaxSeedingTimeEnabled));
|
$('max_ratio_act').setProperty('disabled', !(isMaxRatioEnabled || isMaxSeedingTimeEnabled));
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateAddTrackersEnabled = function() {
|
this.updateAddTrackersEnabled = function() {
|
||||||
var isAddTrackersEnabled = $('add_trackers_checkbox').getProperty('checked');
|
const isAddTrackersEnabled = $('add_trackers_checkbox').getProperty('checked');
|
||||||
$('add_trackers_textarea').setProperty('disabled', !isAddTrackersEnabled);
|
$('add_trackers_textarea').setProperty('disabled', !isAddTrackersEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Web UI tab
|
// Web UI tab
|
||||||
var updateHttpsSettings = function() {
|
this.updateHttpsSettings = function() {
|
||||||
var isUseHttpsEnabled = $('use_https_checkbox').getProperty('checked');
|
const isUseHttpsEnabled = $('use_https_checkbox').getProperty('checked');
|
||||||
$('ssl_cert_text').setProperty('disabled', !isUseHttpsEnabled);
|
$('ssl_cert_text').setProperty('disabled', !isUseHttpsEnabled);
|
||||||
$('ssl_key_text').setProperty('disabled', !isUseHttpsEnabled);
|
$('ssl_key_text').setProperty('disabled', !isUseHttpsEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateBypasssAuthSettings = function() {
|
this.updateBypasssAuthSettings = function() {
|
||||||
var isBypassAuthSubnetWhitelistEnabled = $('bypass_auth_subnet_whitelist_checkbox').getProperty('checked');
|
const isBypassAuthSubnetWhitelistEnabled = $('bypass_auth_subnet_whitelist_checkbox').getProperty('checked');
|
||||||
$('bypass_auth_subnet_whitelist_textarea').setProperty('disabled', !isBypassAuthSubnetWhitelistEnabled);
|
$('bypass_auth_subnet_whitelist_textarea').setProperty('disabled', !isBypassAuthSubnetWhitelistEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateAlternativeWebUISettings = function() {
|
this.updateAlternativeWebUISettings = function() {
|
||||||
var isUseAlternativeWebUIEnabled = $('use_alt_webui_checkbox').getProperty('checked');
|
const isUseAlternativeWebUIEnabled = $('use_alt_webui_checkbox').getProperty('checked');
|
||||||
$('webui_files_location_textarea').setProperty('disabled', !isUseAlternativeWebUIEnabled);
|
$('webui_files_location_textarea').setProperty('disabled', !isUseAlternativeWebUIEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateHostHeaderValidationSettings = function() {
|
this.updateHostHeaderValidationSettings = function() {
|
||||||
var isHostHeaderValidationEnabled = $('host_header_validation_checkbox').getProperty('checked');
|
const isHostHeaderValidationEnabled = $('host_header_validation_checkbox').getProperty('checked');
|
||||||
$('webui_domain_textarea').setProperty('disabled', !isHostHeaderValidationEnabled);
|
$('webui_domain_textarea').setProperty('disabled', !isHostHeaderValidationEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateDynDnsSettings = function() {
|
this.updateDynDnsSettings = function() {
|
||||||
var isDynDnsEnabled = $('use_dyndns_checkbox').getProperty('checked');
|
const isDynDnsEnabled = $('use_dyndns_checkbox').getProperty('checked');
|
||||||
$('dyndns_select').setProperty('disabled', !isDynDnsEnabled);
|
$('dyndns_select').setProperty('disabled', !isDynDnsEnabled);
|
||||||
$('dyndns_domain_text').setProperty('disabled', !isDynDnsEnabled);
|
$('dyndns_domain_text').setProperty('disabled', !isDynDnsEnabled);
|
||||||
$('dyndns_username_text').setProperty('disabled', !isDynDnsEnabled);
|
$('dyndns_username_text').setProperty('disabled', !isDynDnsEnabled);
|
||||||
$('dyndns_password_text').setProperty('disabled', !isDynDnsEnabled);
|
$('dyndns_password_text').setProperty('disabled', !isDynDnsEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
var registerDynDns = function() {
|
this.registerDynDns = function() {
|
||||||
if ($('dyndns_select').getProperty('value').toInt() == 1) {
|
if ($('dyndns_select').getProperty('value').toInt() == 1) {
|
||||||
window.open("http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html", "NO-IP Registration");
|
window.open("http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html", "NO-IP Registration");
|
||||||
}
|
}
|
||||||
@ -1337,22 +1337,22 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var generateRandomPort = function() {
|
this.generateRandomPort = function() {
|
||||||
var min = 1024;
|
const min = 1024;
|
||||||
var max = 65535;
|
const max = 65535;
|
||||||
var port = Math.floor(Math.random() * (max - min + 1) + min);
|
const port = Math.floor(Math.random() * (max - min + 1) + min);
|
||||||
$('port_value').setProperty('value', port);
|
$('port_value').setProperty('value', port);
|
||||||
};
|
};
|
||||||
|
|
||||||
var time_padding = function(val) {
|
this.time_padding = function(val) {
|
||||||
var ret = val.toString();
|
let ret = val.toString();
|
||||||
if (ret.length == 1)
|
if (ret.length == 1)
|
||||||
ret = '0' + ret;
|
ret = '0' + ret;
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Advanced Tab
|
// Advanced Tab
|
||||||
var updateNetworkInterfaces = function(default_iface) {
|
this.updateNetworkInterfaces = function(default_iface) {
|
||||||
const url = 'api/v2/app/networkInterfaceList';
|
const url = 'api/v2/app/networkInterfaceList';
|
||||||
$('networkInterface').empty();
|
$('networkInterface').empty();
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
@ -1374,7 +1374,7 @@
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateInterfaceAddresses = function(iface, default_addr) {
|
this.updateInterfaceAddresses = function(iface, default_addr) {
|
||||||
const url = 'api/v2/app/networkInterfaceAddressList';
|
const url = 'api/v2/app/networkInterfaceAddressList';
|
||||||
$('optionalIPAddressToBind').empty();
|
$('optionalIPAddressToBind').empty();
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
@ -1399,8 +1399,8 @@
|
|||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
var loadPreferences = function() {
|
this.loadPreferences = function() {
|
||||||
var url = 'api/v2/app/preferences';
|
const url = 'api/v2/app/preferences';
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@ -1448,10 +1448,10 @@
|
|||||||
updateExportDirFinEnabled();
|
updateExportDirFinEnabled();
|
||||||
|
|
||||||
// Automatically add torrents from
|
// Automatically add torrents from
|
||||||
var i = 0;
|
let i = 0;
|
||||||
for (var folder in pref.scan_dirs) {
|
for (const folder in pref.scan_dirs) {
|
||||||
var sel;
|
let sel;
|
||||||
var other = "";
|
let other = "";
|
||||||
if (typeof pref.scan_dirs[folder] == "string") {
|
if (typeof pref.scan_dirs[folder] == "string") {
|
||||||
other = pref.scan_dirs[folder];
|
other = pref.scan_dirs[folder];
|
||||||
sel = "other";
|
sel = "other";
|
||||||
@ -1486,7 +1486,7 @@
|
|||||||
$('random_port_checkbox').setProperty('checked', pref.random_port);
|
$('random_port_checkbox').setProperty('checked', pref.random_port);
|
||||||
|
|
||||||
// Connections Limits
|
// Connections Limits
|
||||||
var max_connec = pref.max_connec.toInt();
|
const max_connec = pref.max_connec.toInt();
|
||||||
if (max_connec <= 0) {
|
if (max_connec <= 0) {
|
||||||
$('max_connec_checkbox').setProperty('checked', false);
|
$('max_connec_checkbox').setProperty('checked', false);
|
||||||
$('max_connec_value').setProperty('value', 500);
|
$('max_connec_value').setProperty('value', 500);
|
||||||
@ -1496,7 +1496,7 @@
|
|||||||
$('max_connec_value').setProperty('value', max_connec);
|
$('max_connec_value').setProperty('value', max_connec);
|
||||||
}
|
}
|
||||||
updateMaxConnecEnabled();
|
updateMaxConnecEnabled();
|
||||||
var max_connec_per_torrent = pref.max_connec_per_torrent.toInt();
|
const max_connec_per_torrent = pref.max_connec_per_torrent.toInt();
|
||||||
if (max_connec_per_torrent <= 0) {
|
if (max_connec_per_torrent <= 0) {
|
||||||
$('max_connec_per_torrent_checkbox').setProperty('checked', false);
|
$('max_connec_per_torrent_checkbox').setProperty('checked', false);
|
||||||
$('max_connec_per_torrent_value').setProperty('value', 100);
|
$('max_connec_per_torrent_value').setProperty('value', 100);
|
||||||
@ -1506,7 +1506,7 @@
|
|||||||
$('max_connec_per_torrent_value').setProperty('value', max_connec_per_torrent);
|
$('max_connec_per_torrent_value').setProperty('value', max_connec_per_torrent);
|
||||||
}
|
}
|
||||||
updateMaxConnecPerTorrentEnabled();
|
updateMaxConnecPerTorrentEnabled();
|
||||||
var max_uploads = pref.max_uploads.toInt();
|
const max_uploads = pref.max_uploads.toInt();
|
||||||
if (max_uploads <= 0) {
|
if (max_uploads <= 0) {
|
||||||
$('max_uploads_checkbox').setProperty('checked', false);
|
$('max_uploads_checkbox').setProperty('checked', false);
|
||||||
$('max_uploads_value').setProperty('value', 8);
|
$('max_uploads_value').setProperty('value', 8);
|
||||||
@ -1516,7 +1516,7 @@
|
|||||||
$('max_uploads_value').setProperty('value', max_uploads);
|
$('max_uploads_value').setProperty('value', max_uploads);
|
||||||
}
|
}
|
||||||
updateMaxUploadsEnabled();
|
updateMaxUploadsEnabled();
|
||||||
var max_uploads_per_torrent = pref.max_uploads_per_torrent.toInt();
|
const max_uploads_per_torrent = pref.max_uploads_per_torrent.toInt();
|
||||||
if (max_uploads_per_torrent <= 0) {
|
if (max_uploads_per_torrent <= 0) {
|
||||||
$('max_uploads_per_torrent_checkbox').setProperty('checked', false);
|
$('max_uploads_per_torrent_checkbox').setProperty('checked', false);
|
||||||
$('max_uploads_per_torrent_value').setProperty('value', 4);
|
$('max_uploads_per_torrent_value').setProperty('value', 4);
|
||||||
@ -1587,7 +1587,7 @@
|
|||||||
$('dht_checkbox').setProperty('checked', pref.dht);
|
$('dht_checkbox').setProperty('checked', pref.dht);
|
||||||
$('pex_checkbox').setProperty('checked', pref.pex);
|
$('pex_checkbox').setProperty('checked', pref.pex);
|
||||||
$('lsd_checkbox').setProperty('checked', pref.lsd);
|
$('lsd_checkbox').setProperty('checked', pref.lsd);
|
||||||
var encryption = pref.encryption.toInt();
|
const encryption = pref.encryption.toInt();
|
||||||
$('encryption_select').getChildren('option')[encryption].setAttribute('selected', '');
|
$('encryption_select').getChildren('option')[encryption].setAttribute('selected', '');
|
||||||
$('anonymous_mode_checkbox').setProperty('checked', pref.anonymous_mode);
|
$('anonymous_mode_checkbox').setProperty('checked', pref.anonymous_mode);
|
||||||
|
|
||||||
@ -1608,14 +1608,12 @@
|
|||||||
$('max_ratio_value').setProperty('value', pref.max_ratio);
|
$('max_ratio_value').setProperty('value', pref.max_ratio);
|
||||||
else
|
else
|
||||||
$('max_ratio_value').setProperty('value', 1);
|
$('max_ratio_value').setProperty('value', 1);
|
||||||
var max_ratio_act = pref.max_ratio_act.toInt();
|
|
||||||
$('max_ratio_act').getChildren('option')[max_ratio_act].setAttribute('selected', '');
|
|
||||||
$('max_seeding_time_checkbox').setProperty('checked', pref.max_seeding_time_enabled);
|
$('max_seeding_time_checkbox').setProperty('checked', pref.max_seeding_time_enabled);
|
||||||
if (pref.max_seeding_time_enabled)
|
if (pref.max_seeding_time_enabled)
|
||||||
$('max_seeding_time_value').setProperty('value', pref.max_seeding_time.toInt());
|
$('max_seeding_time_value').setProperty('value', pref.max_seeding_time.toInt());
|
||||||
else
|
else
|
||||||
$('max_seeding_time_value').setProperty('value', 1440);
|
$('max_seeding_time_value').setProperty('value', 1440);
|
||||||
var max_ratio_act = pref.max_ratio_act.toInt();
|
const max_ratio_act = pref.max_ratio_act.toInt();
|
||||||
$('max_ratio_act').getChildren('option')[max_ratio_act].setAttribute('selected', '');
|
$('max_ratio_act').getChildren('option')[max_ratio_act].setAttribute('selected', '');
|
||||||
updateMaxRatioTimeEnabled();
|
updateMaxRatioTimeEnabled();
|
||||||
|
|
||||||
@ -1703,8 +1701,8 @@
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var applyPreferences = function() {
|
this.applyPreferences = function() {
|
||||||
var settings = new Hash();
|
const settings = new Hash();
|
||||||
// Validate form data
|
// Validate form data
|
||||||
// Downloads tab
|
// Downloads tab
|
||||||
// When adding a torrent
|
// When adding a torrent
|
||||||
@ -1751,7 +1749,7 @@
|
|||||||
|
|
||||||
// Connection tab
|
// Connection tab
|
||||||
// Listening Port
|
// Listening Port
|
||||||
var listen_port = $('port_value').getProperty('value').toInt();
|
const listen_port = $('port_value').getProperty('value').toInt();
|
||||||
if (isNaN(listen_port) || listen_port < 1 || listen_port > 65535) {
|
if (isNaN(listen_port) || listen_port < 1 || listen_port > 65535) {
|
||||||
alert("QBT_TR(The port used for incoming connections must be between 1 and 65535.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(The port used for incoming connections must be between 1 and 65535.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
@ -1761,7 +1759,7 @@
|
|||||||
settings.set('random_port', $('random_port_checkbox').getProperty('checked'));
|
settings.set('random_port', $('random_port_checkbox').getProperty('checked'));
|
||||||
|
|
||||||
// Connections Limits
|
// Connections Limits
|
||||||
var max_connec = -1;
|
let max_connec = -1;
|
||||||
if ($('max_connec_checkbox').getProperty('checked')) {
|
if ($('max_connec_checkbox').getProperty('checked')) {
|
||||||
max_connec = $('max_connec_value').getProperty('value').toInt();
|
max_connec = $('max_connec_value').getProperty('value').toInt();
|
||||||
if (isNaN(max_connec) || max_connec <= 0) {
|
if (isNaN(max_connec) || max_connec <= 0) {
|
||||||
@ -1770,7 +1768,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.set('max_connec', max_connec);
|
settings.set('max_connec', max_connec);
|
||||||
var max_connec_per_torrent = -1;
|
let max_connec_per_torrent = -1;
|
||||||
if ($('max_connec_per_torrent_checkbox').getProperty('checked')) {
|
if ($('max_connec_per_torrent_checkbox').getProperty('checked')) {
|
||||||
max_connec_per_torrent = $('max_connec_per_torrent_value').getProperty('value').toInt();
|
max_connec_per_torrent = $('max_connec_per_torrent_value').getProperty('value').toInt();
|
||||||
if (isNaN(max_connec_per_torrent) || max_connec_per_torrent <= 0) {
|
if (isNaN(max_connec_per_torrent) || max_connec_per_torrent <= 0) {
|
||||||
@ -1779,7 +1777,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.set('max_connec_per_torrent', max_connec_per_torrent);
|
settings.set('max_connec_per_torrent', max_connec_per_torrent);
|
||||||
var max_uploads = -1;
|
let max_uploads = -1;
|
||||||
if ($('max_uploads_checkbox').getProperty('checked')) {
|
if ($('max_uploads_checkbox').getProperty('checked')) {
|
||||||
max_uploads = $('max_uploads_value').getProperty('value').toInt();
|
max_uploads = $('max_uploads_value').getProperty('value').toInt();
|
||||||
if (isNaN(max_uploads) || max_uploads <= 0) {
|
if (isNaN(max_uploads) || max_uploads <= 0) {
|
||||||
@ -1788,7 +1786,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.set('max_uploads', max_uploads);
|
settings.set('max_uploads', max_uploads);
|
||||||
var max_uploads_per_torrent = -1;
|
let max_uploads_per_torrent = -1;
|
||||||
if ($('max_uploads_per_torrent_checkbox').getProperty('checked')) {
|
if ($('max_uploads_per_torrent_checkbox').getProperty('checked')) {
|
||||||
max_uploads_per_torrent = $('max_uploads_per_torrent_value').getProperty('value').toInt();
|
max_uploads_per_torrent = $('max_uploads_per_torrent_value').getProperty('value').toInt();
|
||||||
if (isNaN(max_uploads_per_torrent) || max_uploads_per_torrent <= 0) {
|
if (isNaN(max_uploads_per_torrent) || max_uploads_per_torrent <= 0) {
|
||||||
@ -1799,9 +1797,9 @@
|
|||||||
settings.set('max_uploads_per_torrent', max_uploads_per_torrent);
|
settings.set('max_uploads_per_torrent', max_uploads_per_torrent);
|
||||||
|
|
||||||
// Proxy Server
|
// Proxy Server
|
||||||
var proxy_type_str = $('peer_proxy_type_select').getProperty('value');
|
const proxy_type_str = $('peer_proxy_type_select').getProperty('value');
|
||||||
var proxy_type = 0;
|
let proxy_type = 0;
|
||||||
var proxy_auth_enabled = false;
|
let proxy_auth_enabled = false;
|
||||||
if (proxy_type_str == "socks5") {
|
if (proxy_type_str == "socks5") {
|
||||||
if ($('peer_proxy_auth_checkbox').getProperty('checked')) {
|
if ($('peer_proxy_auth_checkbox').getProperty('checked')) {
|
||||||
proxy_type = 4;
|
proxy_type = 4;
|
||||||
@ -1844,14 +1842,14 @@
|
|||||||
|
|
||||||
// Speed tab
|
// Speed tab
|
||||||
// Global Rate Limits
|
// Global Rate Limits
|
||||||
var up_limit = $('up_limit_value').getProperty('value').toInt() * 1024;
|
const up_limit = $('up_limit_value').getProperty('value').toInt() * 1024;
|
||||||
if (isNaN(up_limit) || up_limit < 0) {
|
if (isNaN(up_limit) || up_limit < 0) {
|
||||||
alert("QBT_TR(Global upload rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Global upload rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('up_limit', up_limit);
|
settings.set('up_limit', up_limit);
|
||||||
|
|
||||||
var dl_limit = $('dl_limit_value').getProperty('value').toInt() * 1024;
|
const dl_limit = $('dl_limit_value').getProperty('value').toInt() * 1024;
|
||||||
if (isNaN(dl_limit) || dl_limit < 0) {
|
if (isNaN(dl_limit) || dl_limit < 0) {
|
||||||
alert("QBT_TR(Global download rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Global download rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
@ -1859,14 +1857,14 @@
|
|||||||
settings.set('dl_limit', dl_limit);
|
settings.set('dl_limit', dl_limit);
|
||||||
|
|
||||||
// Alternative Global Rate Limits
|
// Alternative Global Rate Limits
|
||||||
var alt_up_limit = $('alt_up_limit_value').getProperty('value').toInt() * 1024;
|
const alt_up_limit = $('alt_up_limit_value').getProperty('value').toInt() * 1024;
|
||||||
if (isNaN(alt_up_limit) || alt_up_limit < 0) {
|
if (isNaN(alt_up_limit) || alt_up_limit < 0) {
|
||||||
alert("QBT_TR(Alternative upload rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Alternative upload rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('alt_up_limit', alt_up_limit);
|
settings.set('alt_up_limit', alt_up_limit);
|
||||||
|
|
||||||
var alt_dl_limit = $('alt_dl_limit_value').getProperty('value').toInt() * 1024;
|
const alt_dl_limit = $('alt_dl_limit_value').getProperty('value').toInt() * 1024;
|
||||||
if (isNaN(alt_dl_limit) || alt_dl_limit < 0) {
|
if (isNaN(alt_dl_limit) || alt_dl_limit < 0) {
|
||||||
alert("QBT_TR(Alternative download rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Alternative download rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
@ -1879,7 +1877,7 @@
|
|||||||
settings.set('limit_lan_peers', $('limit_lan_peers_checkbox').getProperty('checked'));
|
settings.set('limit_lan_peers', $('limit_lan_peers_checkbox').getProperty('checked'));
|
||||||
|
|
||||||
// Scheduler
|
// Scheduler
|
||||||
var scheduling_enabled = $('limit_sheduling_checkbox').getProperty('checked');
|
const scheduling_enabled = $('limit_sheduling_checkbox').getProperty('checked');
|
||||||
settings.set('scheduler_enabled', scheduling_enabled);
|
settings.set('scheduler_enabled', scheduling_enabled);
|
||||||
if (scheduling_enabled) {
|
if (scheduling_enabled) {
|
||||||
settings.set('schedule_from_hour', $('schedule_from_hour').getProperty('value').toInt());
|
settings.set('schedule_from_hour', $('schedule_from_hour').getProperty('value').toInt());
|
||||||
@ -1900,38 +1898,38 @@
|
|||||||
// Torrent Queueing
|
// Torrent Queueing
|
||||||
settings.set('queueing_enabled', $('queueing_checkbox').getProperty('checked'));
|
settings.set('queueing_enabled', $('queueing_checkbox').getProperty('checked'));
|
||||||
if ($('queueing_checkbox').getProperty('checked')) {
|
if ($('queueing_checkbox').getProperty('checked')) {
|
||||||
var max_active_downloads = $('max_active_dl_value').getProperty('value').toInt();
|
const max_active_downloads = $('max_active_dl_value').getProperty('value').toInt();
|
||||||
if (isNaN(max_active_downloads) || max_active_downloads < -1) {
|
if (isNaN(max_active_downloads) || max_active_downloads < -1) {
|
||||||
alert("QBT_TR(Maximum active downloads must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Maximum active downloads must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('max_active_downloads', max_active_downloads);
|
settings.set('max_active_downloads', max_active_downloads);
|
||||||
var max_active_uploads = $('max_active_up_value').getProperty('value').toInt();
|
const max_active_uploads = $('max_active_up_value').getProperty('value').toInt();
|
||||||
if (isNaN(max_active_uploads) || max_active_uploads < -1) {
|
if (isNaN(max_active_uploads) || max_active_uploads < -1) {
|
||||||
alert("QBT_TR(Maximum active uploads must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Maximum active uploads must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('max_active_uploads', max_active_uploads);
|
settings.set('max_active_uploads', max_active_uploads);
|
||||||
var max_active_torrents = $('max_active_to_value').getProperty('value').toInt();
|
const max_active_torrents = $('max_active_to_value').getProperty('value').toInt();
|
||||||
if (isNaN(max_active_torrents) || max_active_torrents < -1) {
|
if (isNaN(max_active_torrents) || max_active_torrents < -1) {
|
||||||
alert("QBT_TR(Maximum active torrents must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Maximum active torrents must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('max_active_torrents', max_active_torrents);
|
settings.set('max_active_torrents', max_active_torrents);
|
||||||
settings.set('dont_count_slow_torrents', $('dont_count_slow_torrents_checkbox').getProperty('checked'));
|
settings.set('dont_count_slow_torrents', $('dont_count_slow_torrents_checkbox').getProperty('checked'));
|
||||||
var dl_rate_threshold = $('dl_rate_threshold').getProperty('value').toInt();
|
const dl_rate_threshold = $('dl_rate_threshold').getProperty('value').toInt();
|
||||||
if (isNaN(dl_rate_threshold) || (dl_rate_threshold < 1)) {
|
if (isNaN(dl_rate_threshold) || (dl_rate_threshold < 1)) {
|
||||||
alert("QBT_TR(Download rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Download rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('slow_torrent_dl_rate_threshold', dl_rate_threshold);
|
settings.set('slow_torrent_dl_rate_threshold', dl_rate_threshold);
|
||||||
var ul_rate_threshold = $('ul_rate_threshold').getProperty('value').toInt();
|
const ul_rate_threshold = $('ul_rate_threshold').getProperty('value').toInt();
|
||||||
if (isNaN(ul_rate_threshold) || (ul_rate_threshold < 1)) {
|
if (isNaN(ul_rate_threshold) || (ul_rate_threshold < 1)) {
|
||||||
alert("QBT_TR(Upload rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Upload rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('slow_torrent_ul_rate_threshold', ul_rate_threshold);
|
settings.set('slow_torrent_ul_rate_threshold', ul_rate_threshold);
|
||||||
var torrent_inactive_timer = $('torrent_inactive_timer').getProperty('value').toInt();
|
const torrent_inactive_timer = $('torrent_inactive_timer').getProperty('value').toInt();
|
||||||
if (isNaN(torrent_inactive_timer) || (torrent_inactive_timer < 1)) {
|
if (isNaN(torrent_inactive_timer) || (torrent_inactive_timer < 1)) {
|
||||||
alert("QBT_TR(Torrent inactivity timer must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Torrent inactivity timer must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
@ -1940,7 +1938,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Share Ratio Limiting
|
// Share Ratio Limiting
|
||||||
var max_ratio = -1;
|
let max_ratio = -1;
|
||||||
if ($('max_ratio_checkbox').getProperty('checked')) {
|
if ($('max_ratio_checkbox').getProperty('checked')) {
|
||||||
max_ratio = $('max_ratio_value').getProperty('value');
|
max_ratio = $('max_ratio_value').getProperty('value');
|
||||||
if (isNaN(max_ratio) || max_ratio < 0 || max_ratio > 9998) {
|
if (isNaN(max_ratio) || max_ratio < 0 || max_ratio > 9998) {
|
||||||
@ -1952,7 +1950,7 @@
|
|||||||
settings.set('max_ratio', max_ratio);
|
settings.set('max_ratio', max_ratio);
|
||||||
settings.set('max_ratio_act', $('max_ratio_act').getProperty('value').toInt());
|
settings.set('max_ratio_act', $('max_ratio_act').getProperty('value').toInt());
|
||||||
|
|
||||||
var max_seeding_time = -1;
|
let max_seeding_time = -1;
|
||||||
if ($('max_seeding_time_checkbox').getProperty('checked')) {
|
if ($('max_seeding_time_checkbox').getProperty('checked')) {
|
||||||
max_seeding_time = $('max_seeding_time_value').getProperty('value').toInt();
|
max_seeding_time = $('max_seeding_time_value').getProperty('value').toInt();
|
||||||
if (isNaN(max_seeding_time) || max_seeding_time < 0 || max_seeding_time > 525600) {
|
if (isNaN(max_seeding_time) || max_seeding_time < 0 || max_seeding_time > 525600) {
|
||||||
@ -1974,8 +1972,8 @@
|
|||||||
|
|
||||||
// HTTP Server
|
// HTTP Server
|
||||||
settings.set('web_ui_domain_list', $('webui_domain_textarea').getProperty('value'));
|
settings.set('web_ui_domain_list', $('webui_domain_textarea').getProperty('value'));
|
||||||
var web_ui_address = $('webui_address_value').getProperty('value').toString();
|
const web_ui_address = $('webui_address_value').getProperty('value').toString();
|
||||||
var web_ui_port = $('webui_port_value').getProperty('value').toInt();
|
const web_ui_port = $('webui_port_value').getProperty('value').toInt();
|
||||||
if (isNaN(web_ui_port) || web_ui_port < 1 || web_ui_port > 65535) {
|
if (isNaN(web_ui_port) || web_ui_port < 1 || web_ui_port > 65535) {
|
||||||
alert("QBT_TR(The port used for the Web UI must be between 1 and 65535.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(The port used for the Web UI must be between 1 and 65535.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
@ -1988,12 +1986,12 @@
|
|||||||
settings.set('web_ui_https_key_path', $('ssl_key_text').getProperty('value'));
|
settings.set('web_ui_https_key_path', $('ssl_key_text').getProperty('value'));
|
||||||
|
|
||||||
// Authentication
|
// Authentication
|
||||||
var web_ui_username = $('webui_username_text').getProperty('value');
|
const web_ui_username = $('webui_username_text').getProperty('value');
|
||||||
if (web_ui_username.length < 3) {
|
if (web_ui_username.length < 3) {
|
||||||
alert("QBT_TR(The Web UI username must be at least 3 characters long.)QBT_TR[CONTEXT=OptionsDialog]");
|
alert("QBT_TR(The Web UI username must be at least 3 characters long.)QBT_TR[CONTEXT=OptionsDialog]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var web_ui_password = $('webui_password_text').getProperty('value');
|
const web_ui_password = $('webui_password_text').getProperty('value');
|
||||||
if ((0 < web_ui_password.length) && (web_ui_password.length < 6)) {
|
if ((0 < web_ui_password.length) && (web_ui_password.length < 6)) {
|
||||||
alert("QBT_TR(The Web UI password must be at least 6 characters long.)QBT_TR[CONTEXT=OptionsDialog]");
|
alert("QBT_TR(The Web UI password must be at least 6 characters long.)QBT_TR[CONTEXT=OptionsDialog]");
|
||||||
return;
|
return;
|
||||||
@ -2008,8 +2006,8 @@
|
|||||||
settings.set('web_ui_session_timeout', $('webUISessionTimeoutInput').getProperty('value'));
|
settings.set('web_ui_session_timeout', $('webUISessionTimeoutInput').getProperty('value'));
|
||||||
|
|
||||||
// Use alternative Web UI
|
// Use alternative Web UI
|
||||||
var alternative_webui_enabled = $('use_alt_webui_checkbox').getProperty('checked');
|
const alternative_webui_enabled = $('use_alt_webui_checkbox').getProperty('checked');
|
||||||
var webui_files_location_textarea = $('webui_files_location_textarea').getProperty('value');
|
const webui_files_location_textarea = $('webui_files_location_textarea').getProperty('value');
|
||||||
if (alternative_webui_enabled && (webui_files_location_textarea.trim() === "")) {
|
if (alternative_webui_enabled && (webui_files_location_textarea.trim() === "")) {
|
||||||
alert("QBT_TR(The alternative Web UI files location cannot be blank.)QBT_TR[CONTEXT=OptionsDialog]");
|
alert("QBT_TR(The alternative Web UI files location cannot be blank.)QBT_TR[CONTEXT=OptionsDialog]");
|
||||||
return;
|
return;
|
||||||
@ -2064,7 +2062,7 @@
|
|||||||
settings.set('announce_ip', $('announceIP').getProperty('value'));
|
settings.set('announce_ip', $('announceIP').getProperty('value'));
|
||||||
|
|
||||||
// Send it to qBT
|
// Send it to qBT
|
||||||
var json_str = JSON.encode(settings);
|
const json_str = JSON.encode(settings);
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/app/setPreferences',
|
url: 'api/v2/app/setPreferences',
|
||||||
|
@ -155,7 +155,7 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var selectedTab = $(getLocalStorageItem('selected_tab', 'PropGeneralLink'));
|
const selectedTab = $(getLocalStorageItem('selected_tab', 'PropGeneralLink'));
|
||||||
if (selectedTab)
|
if (selectedTab)
|
||||||
selectedTab.click();
|
selectedTab.click();
|
||||||
</script>
|
</script>
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent('domready', function() {
|
||||||
var name = new URI().getData('name');
|
const name = new URI().getData('name');
|
||||||
// set text field to current value
|
// set text field to current value
|
||||||
if (name)
|
if (name)
|
||||||
$('rename').value = decodeURIComponent(name);
|
$('rename').value = decodeURIComponent(name);
|
||||||
@ -39,11 +39,11 @@
|
|||||||
$('renameButton').addEvent('click', function(e) {
|
$('renameButton').addEvent('click', function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
// check field
|
// check field
|
||||||
var name = $('rename').value.trim();
|
const name = $('rename').value.trim();
|
||||||
if (name === null || name === "")
|
if (name === null || name === "")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var hash = new URI().getData('hash');
|
const hash = new URI().getData('hash');
|
||||||
if (hash) {
|
if (hash) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/rename',
|
url: 'api/v2/torrents/rename',
|
||||||
|
@ -24,36 +24,36 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var torrentsTable = new TorrentsTable();
|
this.torrentsTable = new TorrentsTable();
|
||||||
var torrentTrackersTable = new TorrentTrackersTable();
|
const torrentTrackersTable = new TorrentTrackersTable();
|
||||||
var torrentPeersTable = new TorrentPeersTable();
|
const torrentPeersTable = new TorrentPeersTable();
|
||||||
var torrentFilesTable = new TorrentFilesTable();
|
const torrentFilesTable = new TorrentFilesTable();
|
||||||
var searchResultsTable = new SearchResultsTable();
|
const searchResultsTable = new SearchResultsTable();
|
||||||
var searchPluginsTable = new SearchPluginsTable();
|
const searchPluginsTable = new SearchPluginsTable();
|
||||||
|
|
||||||
var updatePropertiesPanel = function() {};
|
let updatePropertiesPanel = function() {};
|
||||||
|
|
||||||
var updateTorrentData = function() {};
|
let updateTorrentData = function() {};
|
||||||
var updateTrackersData = function() {};
|
let updateTrackersData = function() {};
|
||||||
var updateTorrentPeersData = function() {};
|
let updateTorrentPeersData = function() {};
|
||||||
var updateWebSeedsData = function() {};
|
let updateWebSeedsData = function() {};
|
||||||
var updateTorrentFilesData = function() {};
|
let updateTorrentFilesData = function() {};
|
||||||
|
|
||||||
var updateMainData = function() {};
|
this.updateMainData = function() {};
|
||||||
var alternativeSpeedLimits = false;
|
let alternativeSpeedLimits = false;
|
||||||
var queueing_enabled = true;
|
let queueing_enabled = true;
|
||||||
var serverSyncMainDataInterval = 1500;
|
let serverSyncMainDataInterval = 1500;
|
||||||
var customSyncMainDataInterval = null;
|
let customSyncMainDataInterval = null;
|
||||||
|
|
||||||
var clipboardEvent;
|
let clipboardEvent;
|
||||||
|
|
||||||
var CATEGORIES_ALL = 1;
|
const CATEGORIES_ALL = 1;
|
||||||
var CATEGORIES_UNCATEGORIZED = 2;
|
const CATEGORIES_UNCATEGORIZED = 2;
|
||||||
|
|
||||||
var category_list = {};
|
let category_list = {};
|
||||||
|
|
||||||
var selected_category = CATEGORIES_ALL;
|
let selected_category = CATEGORIES_ALL;
|
||||||
var setCategoryFilter = function() {};
|
let setCategoryFilter = function() {};
|
||||||
|
|
||||||
const TAGS_ALL = 1;
|
const TAGS_ALL = 1;
|
||||||
const TAGS_UNTAGGED = 2;
|
const TAGS_UNTAGGED = 2;
|
||||||
@ -63,11 +63,11 @@ let tagList = {};
|
|||||||
let selectedTag = TAGS_ALL;
|
let selectedTag = TAGS_ALL;
|
||||||
let setTagFilter = function() {};
|
let setTagFilter = function() {};
|
||||||
|
|
||||||
var selected_filter = getLocalStorageItem('selected_filter', 'all');
|
let selected_filter = getLocalStorageItem('selected_filter', 'all');
|
||||||
var setFilter = function() {};
|
let setFilter = function() {};
|
||||||
var toggleFilterDisplay = function() {};
|
let toggleFilterDisplay = function() {};
|
||||||
|
|
||||||
var loadSelectedCategory = function() {
|
const loadSelectedCategory = function() {
|
||||||
selected_category = getLocalStorageItem('selected_category', CATEGORIES_ALL);
|
selected_category = getLocalStorageItem('selected_category', CATEGORIES_ALL);
|
||||||
};
|
};
|
||||||
loadSelectedCategory();
|
loadSelectedCategory();
|
||||||
@ -78,9 +78,9 @@ const loadSelectedTag = function() {
|
|||||||
loadSelectedTag();
|
loadSelectedTag();
|
||||||
|
|
||||||
function genHash(string) {
|
function genHash(string) {
|
||||||
var hash = 0;
|
let hash = 0;
|
||||||
for (var i = 0; i < string.length; ++i) {
|
for (let i = 0; i < string.length; ++i) {
|
||||||
var c = string.charCodeAt(i);
|
const c = string.charCodeAt(i);
|
||||||
hash = (c + hash * 31) | 0;
|
hash = (c + hash * 31) | 0;
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
@ -111,9 +111,9 @@ const qbtVersion = function() {
|
|||||||
|
|
||||||
window.addEvent('load', function() {
|
window.addEvent('load', function() {
|
||||||
|
|
||||||
var saveColumnSizes = function() {
|
const saveColumnSizes = function() {
|
||||||
var filters_width = $('Filters').getSize().x;
|
const filters_width = $('Filters').getSize().x;
|
||||||
var properties_height_rel = $('propertiesPanel').getSize().y / Window.getSize().y;
|
const properties_height_rel = $('propertiesPanel').getSize().y / Window.getSize().y;
|
||||||
localStorage.setItem('filters_width', filters_width);
|
localStorage.setItem('filters_width', filters_width);
|
||||||
localStorage.setItem('properties_height_rel', properties_height_rel);
|
localStorage.setItem('properties_height_rel', properties_height_rel);
|
||||||
};
|
};
|
||||||
@ -131,8 +131,8 @@ window.addEvent('load', function() {
|
|||||||
});*/
|
});*/
|
||||||
MochaUI.Desktop.initialize();
|
MochaUI.Desktop.initialize();
|
||||||
|
|
||||||
var buildTransfersTab = function() {
|
const buildTransfersTab = function() {
|
||||||
var filt_w = localStorage.getItem('filters_width');
|
let filt_w = localStorage.getItem('filters_width');
|
||||||
if ($defined(filt_w))
|
if ($defined(filt_w))
|
||||||
filt_w = filt_w.toInt();
|
filt_w = filt_w.toInt();
|
||||||
else
|
else
|
||||||
@ -151,7 +151,7 @@ window.addEvent('load', function() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var buildSearchTab = function() {
|
const buildSearchTab = function() {
|
||||||
new MochaUI.Column({
|
new MochaUI.Column({
|
||||||
id: 'searchTabColumn',
|
id: 'searchTabColumn',
|
||||||
placement: 'main',
|
placement: 'main',
|
||||||
@ -202,11 +202,11 @@ window.addEvent('load', function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
toggleFilterDisplay = function(filter) {
|
toggleFilterDisplay = function(filter) {
|
||||||
var element = filter + "FilterList";
|
const element = filter + "FilterList";
|
||||||
localStorage.setItem('filter_' + filter + "_collapsed", !$(element).hasClass("invisible"));
|
localStorage.setItem('filter_' + filter + "_collapsed", !$(element).hasClass("invisible"));
|
||||||
$(element).toggleClass("invisible")
|
$(element).toggleClass("invisible")
|
||||||
var parent = $(element).getParent(".filterWrapper");
|
const parent = $(element).getParent(".filterWrapper");
|
||||||
var toggleIcon = $(parent).getChildren(".filterTitle img");
|
const toggleIcon = $(parent).getChildren(".filterTitle img");
|
||||||
if (toggleIcon)
|
if (toggleIcon)
|
||||||
toggleIcon[0].toggleClass("rotate");
|
toggleIcon[0].toggleClass("rotate");
|
||||||
};
|
};
|
||||||
@ -232,7 +232,7 @@ window.addEvent('load', function() {
|
|||||||
initializeWindows();
|
initializeWindows();
|
||||||
|
|
||||||
// Show Top Toolbar is enabled by default
|
// Show Top Toolbar is enabled by default
|
||||||
var showTopToolbar = true;
|
let showTopToolbar = true;
|
||||||
if (localStorage.getItem('show_top_toolbar') !== null)
|
if (localStorage.getItem('show_top_toolbar') !== null)
|
||||||
showTopToolbar = localStorage.getItem('show_top_toolbar') == "true";
|
showTopToolbar = localStorage.getItem('show_top_toolbar') == "true";
|
||||||
if (!showTopToolbar) {
|
if (!showTopToolbar) {
|
||||||
@ -241,7 +241,7 @@ window.addEvent('load', function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show Status Bar is enabled by default
|
// Show Status Bar is enabled by default
|
||||||
var showStatusBar = true;
|
let showStatusBar = true;
|
||||||
if (localStorage.getItem('show_status_bar') !== null)
|
if (localStorage.getItem('show_status_bar') !== null)
|
||||||
showStatusBar = localStorage.getItem('show_status_bar') === "true";
|
showStatusBar = localStorage.getItem('show_status_bar') === "true";
|
||||||
if (!showStatusBar) {
|
if (!showStatusBar) {
|
||||||
@ -249,12 +249,12 @@ window.addEvent('load', function() {
|
|||||||
$('desktopFooterWrapper').addClass('invisible');
|
$('desktopFooterWrapper').addClass('invisible');
|
||||||
}
|
}
|
||||||
|
|
||||||
var speedInTitle = localStorage.getItem('speed_in_browser_title_bar') == "true";
|
let speedInTitle = localStorage.getItem('speed_in_browser_title_bar') == "true";
|
||||||
if (!speedInTitle)
|
if (!speedInTitle)
|
||||||
$('speedInBrowserTitleBarLink').firstChild.style.opacity = '0';
|
$('speedInBrowserTitleBarLink').firstChild.style.opacity = '0';
|
||||||
|
|
||||||
// After showing/hiding the toolbar + status bar
|
// After showing/hiding the toolbar + status bar
|
||||||
var showSearchEngine = localStorage.getItem('show_search_engine') === "true";
|
let showSearchEngine = localStorage.getItem('show_search_engine') === "true";
|
||||||
if (!showSearchEngine) {
|
if (!showSearchEngine) {
|
||||||
// uncheck menu option
|
// uncheck menu option
|
||||||
$('showSearchEngineLink').firstChild.style.opacity = '0';
|
$('showSearchEngineLink').firstChild.style.opacity = '0';
|
||||||
@ -265,13 +265,13 @@ window.addEvent('load', function() {
|
|||||||
// After Show Top Toolbar
|
// After Show Top Toolbar
|
||||||
MochaUI.Desktop.setDesktopSize();
|
MochaUI.Desktop.setDesktopSize();
|
||||||
|
|
||||||
var syncMainDataLastResponseId = 0;
|
let syncMainDataLastResponseId = 0;
|
||||||
var serverState = {};
|
const serverState = {};
|
||||||
|
|
||||||
var removeTorrentFromCategoryList = function(hash) {
|
const removeTorrentFromCategoryList = function(hash) {
|
||||||
if (hash === null || hash === "")
|
if (hash === null || hash === "")
|
||||||
return false;
|
return false;
|
||||||
var removed = false;
|
let removed = false;
|
||||||
Object.each(category_list, function(category) {
|
Object.each(category_list, function(category) {
|
||||||
if (Object.contains(category.torrents, hash)) {
|
if (Object.contains(category.torrents, hash)) {
|
||||||
removed = true;
|
removed = true;
|
||||||
@ -281,15 +281,15 @@ window.addEvent('load', function() {
|
|||||||
return removed;
|
return removed;
|
||||||
};
|
};
|
||||||
|
|
||||||
var addTorrentToCategoryList = function(torrent) {
|
const addTorrentToCategoryList = function(torrent) {
|
||||||
var category = torrent['category'];
|
const category = torrent['category'];
|
||||||
if (typeof category === 'undefined')
|
if (typeof category === 'undefined')
|
||||||
return false;
|
return false;
|
||||||
if (category.length === 0) { // Empty category
|
if (category.length === 0) { // Empty category
|
||||||
removeTorrentFromCategoryList(torrent['hash']);
|
removeTorrentFromCategoryList(torrent['hash']);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var categoryHash = genHash(category);
|
const categoryHash = genHash(category);
|
||||||
if (category_list[categoryHash] === null) // This should not happen
|
if (category_list[categoryHash] === null) // This should not happen
|
||||||
category_list[categoryHash] = {
|
category_list[categoryHash] = {
|
||||||
name: category,
|
name: category,
|
||||||
@ -339,11 +339,11 @@ window.addEvent('load', function() {
|
|||||||
return added;
|
return added;
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateFilter = function(filter, filterTitle) {
|
const updateFilter = function(filter, filterTitle) {
|
||||||
$(filter + '_filter').firstChild.childNodes[1].nodeValue = filterTitle.replace('%1', torrentsTable.getFilteredTorrentsNumber(filter, CATEGORIES_ALL, TAGS_ALL));
|
$(filter + '_filter').firstChild.childNodes[1].nodeValue = filterTitle.replace('%1', torrentsTable.getFilteredTorrentsNumber(filter, CATEGORIES_ALL, TAGS_ALL));
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateFiltersList = function() {
|
const updateFiltersList = function() {
|
||||||
updateFilter('all', 'QBT_TR(All (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
|
updateFilter('all', 'QBT_TR(All (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
|
||||||
updateFilter('downloading', 'QBT_TR(Downloading (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
|
updateFilter('downloading', 'QBT_TR(Downloading (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
|
||||||
updateFilter('seeding', 'QBT_TR(Seeding (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
|
updateFilter('seeding', 'QBT_TR(Seeding (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
|
||||||
@ -355,17 +355,17 @@ window.addEvent('load', function() {
|
|||||||
updateFilter('errored', 'QBT_TR(Errored (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
|
updateFilter('errored', 'QBT_TR(Errored (%1))QBT_TR[CONTEXT=StatusFilterWidget]');
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateCategoryList = function() {
|
const updateCategoryList = function() {
|
||||||
var categoryList = $('categoryFilterList');
|
const categoryList = $('categoryFilterList');
|
||||||
if (!categoryList)
|
if (!categoryList)
|
||||||
return;
|
return;
|
||||||
categoryList.empty();
|
categoryList.empty();
|
||||||
|
|
||||||
var create_link = function(hash, text, count) {
|
const create_link = function(hash, text, count) {
|
||||||
var html = '<a href="#" onclick="setCategoryFilter(' + hash + ');return false;">'
|
const html = '<a href="#" onclick="setCategoryFilter(' + hash + ');return false;">'
|
||||||
+ '<img src="images/qbt-theme/inode-directory.svg"/>'
|
+ '<img src="images/qbt-theme/inode-directory.svg"/>'
|
||||||
+ escapeHtml(text) + ' (' + count + ')' + '</a>';
|
+ escapeHtml(text) + ' (' + count + ')' + '</a>';
|
||||||
var el = new Element('li', {
|
const el = new Element('li', {
|
||||||
id: hash,
|
id: hash,
|
||||||
html: html
|
html: html
|
||||||
});
|
});
|
||||||
@ -373,8 +373,8 @@ window.addEvent('load', function() {
|
|||||||
return el;
|
return el;
|
||||||
};
|
};
|
||||||
|
|
||||||
var all = torrentsTable.getRowIds().length;
|
const all = torrentsTable.getRowIds().length;
|
||||||
var uncategorized = 0;
|
let uncategorized = 0;
|
||||||
Object.each(torrentsTable.rows, function(row) {
|
Object.each(torrentsTable.rows, function(row) {
|
||||||
if (row['full_data'].category.length === 0)
|
if (row['full_data'].category.length === 0)
|
||||||
uncategorized += 1;
|
uncategorized += 1;
|
||||||
@ -382,27 +382,27 @@ window.addEvent('load', function() {
|
|||||||
categoryList.appendChild(create_link(CATEGORIES_ALL, 'QBT_TR(All)QBT_TR[CONTEXT=CategoryFilterModel]', all));
|
categoryList.appendChild(create_link(CATEGORIES_ALL, 'QBT_TR(All)QBT_TR[CONTEXT=CategoryFilterModel]', all));
|
||||||
categoryList.appendChild(create_link(CATEGORIES_UNCATEGORIZED, 'QBT_TR(Uncategorized)QBT_TR[CONTEXT=CategoryFilterModel]', uncategorized));
|
categoryList.appendChild(create_link(CATEGORIES_UNCATEGORIZED, 'QBT_TR(Uncategorized)QBT_TR[CONTEXT=CategoryFilterModel]', uncategorized));
|
||||||
|
|
||||||
var sortedCategories = [];
|
const sortedCategories = [];
|
||||||
Object.each(category_list, function(category) {
|
Object.each(category_list, function(category) {
|
||||||
sortedCategories.push(category.name);
|
sortedCategories.push(category.name);
|
||||||
});
|
});
|
||||||
sortedCategories.sort();
|
sortedCategories.sort();
|
||||||
|
|
||||||
Object.each(sortedCategories, function(categoryName) {
|
Object.each(sortedCategories, function(categoryName) {
|
||||||
var categoryHash = genHash(categoryName);
|
const categoryHash = genHash(categoryName);
|
||||||
var categoryCount = category_list[categoryHash].torrents.length;
|
const categoryCount = category_list[categoryHash].torrents.length;
|
||||||
categoryList.appendChild(create_link(categoryHash, categoryName, categoryCount));
|
categoryList.appendChild(create_link(categoryHash, categoryName, categoryCount));
|
||||||
});
|
});
|
||||||
|
|
||||||
highlightSelectedCategory();
|
highlightSelectedCategory();
|
||||||
};
|
};
|
||||||
|
|
||||||
var highlightSelectedCategory = function() {
|
const highlightSelectedCategory = function() {
|
||||||
var categoryList = $('categoryFilterList');
|
const categoryList = $('categoryFilterList');
|
||||||
if (!categoryList)
|
if (!categoryList)
|
||||||
return;
|
return;
|
||||||
var childrens = categoryList.childNodes;
|
const childrens = categoryList.childNodes;
|
||||||
for (var i = 0; i < childrens.length; ++i) {
|
for (let i = 0; i < childrens.length; ++i) {
|
||||||
if (childrens[i].id == selected_category)
|
if (childrens[i].id == selected_category)
|
||||||
childrens[i].className = "selectedFilter";
|
childrens[i].className = "selectedFilter";
|
||||||
else
|
else
|
||||||
@ -464,16 +464,16 @@ window.addEvent('load', function() {
|
|||||||
children[i].className = (children[i].id === selectedTag) ? "selectedFilter" : "";
|
children[i].className = (children[i].id === selectedTag) ? "selectedFilter" : "";
|
||||||
};
|
};
|
||||||
|
|
||||||
var syncMainDataTimer;
|
let syncMainDataTimer;
|
||||||
var syncMainData = function() {
|
const syncMainData = function() {
|
||||||
var url = new URI('api/v2/sync/maindata');
|
const url = new URI('api/v2/sync/maindata');
|
||||||
url.setData('rid', syncMainDataLastResponseId);
|
url.setData('rid', syncMainDataLastResponseId);
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
noCache: true,
|
noCache: true,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
onFailure: function() {
|
onFailure: function() {
|
||||||
var errorDiv = $('error_div');
|
const errorDiv = $('error_div');
|
||||||
if (errorDiv)
|
if (errorDiv)
|
||||||
errorDiv.set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
|
errorDiv.set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
|
||||||
clearTimeout(syncMainDataTimer);
|
clearTimeout(syncMainDataTimer);
|
||||||
@ -483,10 +483,10 @@ window.addEvent('load', function() {
|
|||||||
$('error_div').set('html', '');
|
$('error_div').set('html', '');
|
||||||
if (response) {
|
if (response) {
|
||||||
clearTimeout(torrentsFilterInputTimer);
|
clearTimeout(torrentsFilterInputTimer);
|
||||||
var torrentsTableSelectedRows;
|
let torrentsTableSelectedRows;
|
||||||
var update_categories = false;
|
let update_categories = false;
|
||||||
let updateTags = false;
|
let updateTags = false;
|
||||||
var full_update = (response['full_update'] === true);
|
const full_update = (response['full_update'] === true);
|
||||||
if (full_update) {
|
if (full_update) {
|
||||||
torrentsTableSelectedRows = torrentsTable.selectedRowsIds();
|
torrentsTableSelectedRows = torrentsTable.selectedRowsIds();
|
||||||
torrentsTable.clear();
|
torrentsTable.clear();
|
||||||
@ -497,9 +497,9 @@ window.addEvent('load', function() {
|
|||||||
syncMainDataLastResponseId = response['rid'];
|
syncMainDataLastResponseId = response['rid'];
|
||||||
}
|
}
|
||||||
if (response['categories']) {
|
if (response['categories']) {
|
||||||
for (var key in response['categories']) {
|
for (const key in response['categories']) {
|
||||||
var category = response['categories'][key];
|
const category = response['categories'][key];
|
||||||
var categoryHash = genHash(key);
|
const categoryHash = genHash(key);
|
||||||
if (category_list[categoryHash] !== undefined) {
|
if (category_list[categoryHash] !== undefined) {
|
||||||
// only the save path can change for existing categories
|
// only the save path can change for existing categories
|
||||||
category_list[categoryHash].savePath = category.savePath;
|
category_list[categoryHash].savePath = category.savePath;
|
||||||
@ -516,7 +516,7 @@ window.addEvent('load', function() {
|
|||||||
}
|
}
|
||||||
if (response['categories_removed']) {
|
if (response['categories_removed']) {
|
||||||
response['categories_removed'].each(function(category) {
|
response['categories_removed'].each(function(category) {
|
||||||
var categoryHash = genHash(category);
|
const categoryHash = genHash(category);
|
||||||
delete category_list[categoryHash];
|
delete category_list[categoryHash];
|
||||||
});
|
});
|
||||||
update_categories = true;
|
update_categories = true;
|
||||||
@ -541,8 +541,8 @@ window.addEvent('load', function() {
|
|||||||
updateTags = true;
|
updateTags = true;
|
||||||
}
|
}
|
||||||
if (response['torrents']) {
|
if (response['torrents']) {
|
||||||
var updateTorrentList = false;
|
let updateTorrentList = false;
|
||||||
for (var key in response['torrents']) {
|
for (const key in response['torrents']) {
|
||||||
response['torrents'][key]['hash'] = key;
|
response['torrents'][key]['hash'] = key;
|
||||||
response['torrents'][key]['rowId'] = key;
|
response['torrents'][key]['rowId'] = key;
|
||||||
if (response['torrents'][key]['state'])
|
if (response['torrents'][key]['state'])
|
||||||
@ -570,8 +570,8 @@ window.addEvent('load', function() {
|
|||||||
torrentsTable.updateTable(full_update);
|
torrentsTable.updateTable(full_update);
|
||||||
torrentsTable.altRow();
|
torrentsTable.altRow();
|
||||||
if (response['server_state']) {
|
if (response['server_state']) {
|
||||||
var tmp = response['server_state'];
|
const tmp = response['server_state'];
|
||||||
for (var k in tmp)
|
for (const k in tmp)
|
||||||
serverState[k] = tmp[k];
|
serverState[k] = tmp[k];
|
||||||
processServerState();
|
processServerState();
|
||||||
}
|
}
|
||||||
@ -601,8 +601,8 @@ window.addEvent('load', function() {
|
|||||||
syncMainDataTimer = syncMainData.delay(100);
|
syncMainDataTimer = syncMainData.delay(100);
|
||||||
};
|
};
|
||||||
|
|
||||||
var processServerState = function() {
|
const processServerState = function() {
|
||||||
var transfer_info = friendlyUnit(serverState.dl_info_speed, true);
|
let transfer_info = friendlyUnit(serverState.dl_info_speed, true);
|
||||||
if (serverState.dl_rate_limit > 0)
|
if (serverState.dl_rate_limit > 0)
|
||||||
transfer_info += " [" + friendlyUnit(serverState.dl_rate_limit, true) + "]";
|
transfer_info += " [" + friendlyUnit(serverState.dl_rate_limit, true) + "]";
|
||||||
transfer_info += " (" + friendlyUnit(serverState.dl_info_data, false) + ")";
|
transfer_info += " (" + friendlyUnit(serverState.dl_info_data, false) + ")";
|
||||||
@ -674,7 +674,7 @@ window.addEvent('load', function() {
|
|||||||
serverSyncMainDataInterval = Math.max(serverState.refresh_interval, 500);
|
serverSyncMainDataInterval = Math.max(serverState.refresh_interval, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateAltSpeedIcon = function(enabled) {
|
const updateAltSpeedIcon = function(enabled) {
|
||||||
if (enabled)
|
if (enabled)
|
||||||
$('alternativeSpeedLimits').src = "images/slow.svg";
|
$('alternativeSpeedLimits').src = "images/slow.svg";
|
||||||
else
|
else
|
||||||
@ -768,7 +768,7 @@ window.addEvent('load', function() {
|
|||||||
|
|
||||||
// main window tabs
|
// main window tabs
|
||||||
|
|
||||||
var showTransfersTab = function() {
|
const showTransfersTab = function() {
|
||||||
$("filtersColumn").removeClass("invisible");
|
$("filtersColumn").removeClass("invisible");
|
||||||
$("filtersColumn_handle").removeClass("invisible");
|
$("filtersColumn_handle").removeClass("invisible");
|
||||||
$("mainColumn").removeClass("invisible");
|
$("mainColumn").removeClass("invisible");
|
||||||
@ -780,35 +780,35 @@ window.addEvent('load', function() {
|
|||||||
hideSearchTab();
|
hideSearchTab();
|
||||||
};
|
};
|
||||||
|
|
||||||
var hideTransfersTab = function() {
|
const hideTransfersTab = function() {
|
||||||
$("filtersColumn").addClass("invisible");
|
$("filtersColumn").addClass("invisible");
|
||||||
$("filtersColumn_handle").addClass("invisible");
|
$("filtersColumn_handle").addClass("invisible");
|
||||||
$("mainColumn").addClass("invisible");
|
$("mainColumn").addClass("invisible");
|
||||||
MochaUI.Desktop.resizePanels();
|
MochaUI.Desktop.resizePanels();
|
||||||
};
|
};
|
||||||
|
|
||||||
var showSearchTab = function() {
|
const showSearchTab = function() {
|
||||||
$("searchTabColumn").removeClass("invisible");
|
$("searchTabColumn").removeClass("invisible");
|
||||||
customSyncMainDataInterval = 30000;
|
customSyncMainDataInterval = 30000;
|
||||||
hideTransfersTab();
|
hideTransfersTab();
|
||||||
};
|
};
|
||||||
|
|
||||||
var hideSearchTab = function() {
|
const hideSearchTab = function() {
|
||||||
$("searchTabColumn").addClass("invisible");
|
$("searchTabColumn").addClass("invisible");
|
||||||
MochaUI.Desktop.resizePanels();
|
MochaUI.Desktop.resizePanels();
|
||||||
};
|
};
|
||||||
|
|
||||||
var addMainWindowTabsEventListener = function() {
|
const addMainWindowTabsEventListener = function() {
|
||||||
$('transfersTabLink').addEvent('click', showTransfersTab);
|
$('transfersTabLink').addEvent('click', showTransfersTab);
|
||||||
$('searchTabLink').addEvent('click', showSearchTab);
|
$('searchTabLink').addEvent('click', showSearchTab);
|
||||||
};
|
};
|
||||||
|
|
||||||
var removeMainWindowTabsEventListener = function() {
|
const removeMainWindowTabsEventListener = function() {
|
||||||
$('transfersTabLink').removeEvent('click', showTransfersTab);
|
$('transfersTabLink').removeEvent('click', showTransfersTab);
|
||||||
$('searchTabLink').removeEvent('click', showSearchTab);
|
$('searchTabLink').removeEvent('click', showSearchTab);
|
||||||
};
|
};
|
||||||
|
|
||||||
var addSearchPanel = function() {
|
const addSearchPanel = function() {
|
||||||
new MochaUI.Panel({
|
new MochaUI.Panel({
|
||||||
id: 'SearchPanel',
|
id: 'SearchPanel',
|
||||||
title: 'Search',
|
title: 'Search',
|
||||||
@ -847,7 +847,7 @@ window.addEvent('load', function() {
|
|||||||
onResize: saveColumnSizes,
|
onResize: saveColumnSizes,
|
||||||
height: null
|
height: null
|
||||||
});
|
});
|
||||||
var prop_h = localStorage.getItem('properties_height_rel');
|
let prop_h = localStorage.getItem('properties_height_rel');
|
||||||
if ($defined(prop_h))
|
if ($defined(prop_h))
|
||||||
prop_h = prop_h.toFloat() * Window.getSize().y;
|
prop_h = prop_h.toFloat() * Window.getSize().y;
|
||||||
else
|
else
|
||||||
@ -927,11 +927,11 @@ window.addEvent('load', function() {
|
|||||||
height: prop_h
|
height: prop_h
|
||||||
});
|
});
|
||||||
|
|
||||||
var prevTorrentsFilterValue;
|
let prevTorrentsFilterValue;
|
||||||
var torrentsFilterInputTimer = null;
|
let torrentsFilterInputTimer = null;
|
||||||
// listen for changes to torrentsFilterInput
|
// listen for changes to torrentsFilterInput
|
||||||
$('torrentsFilterInput').addEvent('input', function() {
|
$('torrentsFilterInput').addEvent('input', function() {
|
||||||
var value = $('torrentsFilterInput').get("value");
|
const value = $('torrentsFilterInput').get("value");
|
||||||
if (value !== prevTorrentsFilterValue) {
|
if (value !== prevTorrentsFilterValue) {
|
||||||
prevTorrentsFilterValue = value;
|
prevTorrentsFilterValue = value;
|
||||||
clearTimeout(torrentsFilterInputTimer);
|
clearTimeout(torrentsFilterInputTimer);
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var lastShownContexMenu = null;
|
let lastShownContexMenu = null;
|
||||||
var ContextMenu = new Class({
|
const ContextMenu = new Class({
|
||||||
//implements
|
//implements
|
||||||
Implements: [Options, Events],
|
Implements: [Options, Events],
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ var ContextMenu = new Class({
|
|||||||
adjustMenuPosition: function(e) {
|
adjustMenuPosition: function(e) {
|
||||||
this.updateMenuItems();
|
this.updateMenuItems();
|
||||||
|
|
||||||
var scrollableMenuMaxHeight = document.documentElement.clientHeight * 0.75;
|
const scrollableMenuMaxHeight = document.documentElement.clientHeight * 0.75;
|
||||||
|
|
||||||
if (this.menu.hasClass('scrollableMenu'))
|
if (this.menu.hasClass('scrollableMenu'))
|
||||||
this.menu.setStyle('max-height', scrollableMenuMaxHeight);
|
this.menu.setStyle('max-height', scrollableMenuMaxHeight);
|
||||||
@ -99,8 +99,8 @@ var ContextMenu = new Class({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// position the menu
|
// position the menu
|
||||||
var xPosMenu = e.page.x + this.options.offsets.x;
|
let xPosMenu = e.page.x + this.options.offsets.x;
|
||||||
var yPosMenu = e.page.y + this.options.offsets.y;
|
let yPosMenu = e.page.y + this.options.offsets.y;
|
||||||
if (xPosMenu + this.menu.offsetWidth > document.documentElement.clientWidth)
|
if (xPosMenu + this.menu.offsetWidth > document.documentElement.clientWidth)
|
||||||
xPosMenu -= this.menu.offsetWidth;
|
xPosMenu -= this.menu.offsetWidth;
|
||||||
if (yPosMenu + this.menu.offsetHeight > document.documentElement.clientHeight)
|
if (yPosMenu + this.menu.offsetHeight > document.documentElement.clientHeight)
|
||||||
@ -117,16 +117,16 @@ var ContextMenu = new Class({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// position the sub-menu
|
// position the sub-menu
|
||||||
var uls = this.menu.getElementsByTagName('ul');
|
const uls = this.menu.getElementsByTagName('ul');
|
||||||
for (var i = 0; i < uls.length; ++i) {
|
for (let i = 0; i < uls.length; ++i) {
|
||||||
var ul = uls[i];
|
const ul = uls[i];
|
||||||
if (ul.hasClass('scrollableMenu'))
|
if (ul.hasClass('scrollableMenu'))
|
||||||
ul.setStyle('max-height', scrollableMenuMaxHeight);
|
ul.setStyle('max-height', scrollableMenuMaxHeight);
|
||||||
var rectParent = ul.parentNode.getBoundingClientRect();
|
const rectParent = ul.parentNode.getBoundingClientRect();
|
||||||
var xPosOrigin = rectParent.left;
|
const xPosOrigin = rectParent.left;
|
||||||
var yPosOrigin = rectParent.bottom;
|
const yPosOrigin = rectParent.bottom;
|
||||||
var xPos = xPosOrigin + rectParent.width - 1;
|
let xPos = xPosOrigin + rectParent.width - 1;
|
||||||
var yPos = yPosOrigin - rectParent.height - 1;
|
let yPos = yPosOrigin - rectParent.height - 1;
|
||||||
if (xPos + ul.offsetWidth > document.documentElement.clientWidth)
|
if (xPos + ul.offsetWidth > document.documentElement.clientWidth)
|
||||||
xPos -= (ul.offsetWidth + rectParent.width - 2);
|
xPos -= (ul.offsetWidth + rectParent.width - 2);
|
||||||
if (yPos + ul.offsetHeight > document.documentElement.clientHeight)
|
if (yPos + ul.offsetHeight > document.documentElement.clientHeight)
|
||||||
@ -277,27 +277,27 @@ var ContextMenu = new Class({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var TorrentsTableContextMenu = new Class({
|
const TorrentsTableContextMenu = new Class({
|
||||||
Extends: ContextMenu,
|
Extends: ContextMenu,
|
||||||
|
|
||||||
updateMenuItems: function() {
|
updateMenuItems: function() {
|
||||||
var all_are_seq_dl = true;
|
let all_are_seq_dl = true;
|
||||||
var there_are_seq_dl = false;
|
let there_are_seq_dl = false;
|
||||||
var all_are_f_l_piece_prio = true;
|
let all_are_f_l_piece_prio = true;
|
||||||
var there_are_f_l_piece_prio = false;
|
let there_are_f_l_piece_prio = false;
|
||||||
var all_are_downloaded = true;
|
let all_are_downloaded = true;
|
||||||
var all_are_paused = true;
|
let all_are_paused = true;
|
||||||
var there_are_paused = false;
|
let there_are_paused = false;
|
||||||
var all_are_force_start = true;
|
let all_are_force_start = true;
|
||||||
var there_are_force_start = false;
|
let there_are_force_start = false;
|
||||||
var all_are_super_seeding = true;
|
let all_are_super_seeding = true;
|
||||||
var all_are_auto_tmm = true;
|
let all_are_auto_tmm = true;
|
||||||
var there_are_auto_tmm = false;
|
let there_are_auto_tmm = false;
|
||||||
const tagsSelectionState = Object.clone(tagList);
|
const tagsSelectionState = Object.clone(tagList);
|
||||||
|
|
||||||
var h = torrentsTable.selectedRowsIds();
|
const h = torrentsTable.selectedRowsIds();
|
||||||
h.each(function(item, index) {
|
h.each(function(item, index) {
|
||||||
var data = torrentsTable.rows.get(item).full_data;
|
const data = torrentsTable.rows.get(item).full_data;
|
||||||
|
|
||||||
if (data['seq_dl'] !== true)
|
if (data['seq_dl'] !== true)
|
||||||
all_are_seq_dl = false;
|
all_are_seq_dl = false;
|
||||||
@ -342,12 +342,12 @@ var TorrentsTableContextMenu = new Class({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var show_seq_dl = true;
|
let show_seq_dl = true;
|
||||||
|
|
||||||
if (!all_are_seq_dl && there_are_seq_dl)
|
if (!all_are_seq_dl && there_are_seq_dl)
|
||||||
show_seq_dl = false;
|
show_seq_dl = false;
|
||||||
|
|
||||||
var show_f_l_piece_prio = true;
|
let show_f_l_piece_prio = true;
|
||||||
|
|
||||||
if (!all_are_f_l_piece_prio && there_are_f_l_piece_prio)
|
if (!all_are_f_l_piece_prio && there_are_f_l_piece_prio)
|
||||||
show_f_l_piece_prio = false;
|
show_f_l_piece_prio = false;
|
||||||
@ -412,7 +412,7 @@ var TorrentsTableContextMenu = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateCategoriesSubMenu: function(category_list) {
|
updateCategoriesSubMenu: function(category_list) {
|
||||||
var categoryList = $('contextCategoryList');
|
const categoryList = $('contextCategoryList');
|
||||||
categoryList.empty();
|
categoryList.empty();
|
||||||
categoryList.appendChild(new Element('li', {
|
categoryList.appendChild(new Element('li', {
|
||||||
html: '<a href="javascript:torrentNewCategoryFN();"><img src="images/qbt-theme/list-add.svg" alt="QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]</a>'
|
html: '<a href="javascript:torrentNewCategoryFN();"><img src="images/qbt-theme/list-add.svg" alt="QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]</a>'
|
||||||
@ -421,16 +421,16 @@ var TorrentsTableContextMenu = new Class({
|
|||||||
html: '<a href="javascript:torrentSetCategoryFN(0);"><img src="images/qbt-theme/edit-clear.svg" alt="QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]</a>'
|
html: '<a href="javascript:torrentSetCategoryFN(0);"><img src="images/qbt-theme/edit-clear.svg" alt="QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]</a>'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var sortedCategories = [];
|
const sortedCategories = [];
|
||||||
Object.each(category_list, function(category) {
|
Object.each(category_list, function(category) {
|
||||||
sortedCategories.push(category.name);
|
sortedCategories.push(category.name);
|
||||||
});
|
});
|
||||||
sortedCategories.sort();
|
sortedCategories.sort();
|
||||||
|
|
||||||
var first = true;
|
let first = true;
|
||||||
Object.each(sortedCategories, function(categoryName) {
|
Object.each(sortedCategories, function(categoryName) {
|
||||||
var categoryHash = genHash(categoryName);
|
const categoryHash = genHash(categoryName);
|
||||||
var el = new Element('li', {
|
const el = new Element('li', {
|
||||||
html: '<a href="javascript:torrentSetCategoryFN(\'' + categoryHash + '\');"><img src="images/qbt-theme/inode-directory.svg"/> ' + escapeHtml(categoryName) + '</a>'
|
html: '<a href="javascript:torrentSetCategoryFN(\'' + categoryHash + '\');"><img src="images/qbt-theme/inode-directory.svg"/> ' + escapeHtml(categoryName) + '</a>'
|
||||||
});
|
});
|
||||||
if (first) {
|
if (first) {
|
||||||
@ -479,10 +479,10 @@ var TorrentsTableContextMenu = new Class({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var CategoriesFilterContextMenu = new Class({
|
const CategoriesFilterContextMenu = new Class({
|
||||||
Extends: ContextMenu,
|
Extends: ContextMenu,
|
||||||
updateMenuItems: function() {
|
updateMenuItems: function() {
|
||||||
var id = this.options.element.id;
|
const id = this.options.element.id;
|
||||||
if ((id != CATEGORIES_ALL) && (id != CATEGORIES_UNCATEGORIZED)) {
|
if ((id != CATEGORIES_ALL) && (id != CATEGORIES_UNCATEGORIZED)) {
|
||||||
this.showItem('editCategory');
|
this.showItem('editCategory');
|
||||||
this.showItem('deleteCategory');
|
this.showItem('deleteCategory');
|
||||||
@ -505,13 +505,13 @@ const TagsFilterContextMenu = new Class({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var SearchPluginsTableContextMenu = new Class({
|
const SearchPluginsTableContextMenu = new Class({
|
||||||
Extends: ContextMenu,
|
Extends: ContextMenu,
|
||||||
|
|
||||||
updateMenuItems: function() {
|
updateMenuItems: function() {
|
||||||
var enabledColumnIndex = function(text) {
|
const enabledColumnIndex = function(text) {
|
||||||
var columns = $("searchPluginsTableFixedHeaderRow").getChildren("th");
|
const columns = $("searchPluginsTableFixedHeaderRow").getChildren("th");
|
||||||
for (var i = 0; i < columns.length; ++i)
|
for (let i = 0; i < columns.length; ++i)
|
||||||
if (columns[i].get("html") === "Enabled")
|
if (columns[i].get("html") === "Enabled")
|
||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
@ -23,10 +23,10 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var categories = {};
|
let categories = {};
|
||||||
var defaultSavePath = "";
|
let defaultSavePath = "";
|
||||||
|
|
||||||
var getCategories = function() {
|
const getCategories = function() {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: 'api/v2/torrents/categories',
|
url: 'api/v2/torrents/categories',
|
||||||
noCache: true,
|
noCache: true,
|
||||||
@ -34,9 +34,9 @@ var getCategories = function() {
|
|||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
categories = data;
|
categories = data;
|
||||||
for (var i in data) {
|
for (const i in data) {
|
||||||
var category = data[i];
|
const category = data[i];
|
||||||
var option = new Element("option");
|
const option = new Element("option");
|
||||||
option.set('value', category.name);
|
option.set('value', category.name);
|
||||||
option.set('html', category.name);
|
option.set('html', category.name);
|
||||||
$('categorySelect').appendChild(option);
|
$('categorySelect').appendChild(option);
|
||||||
@ -46,7 +46,7 @@ var getCategories = function() {
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var getPreferences = function() {
|
const getPreferences = function() {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: 'api/v2/app/preferences',
|
url: 'api/v2/app/preferences',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@ -74,7 +74,7 @@ var getPreferences = function() {
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var changeCategorySelect = function(item) {
|
const changeCategorySelect = function(item) {
|
||||||
if (item.value == "\\other") {
|
if (item.value == "\\other") {
|
||||||
item.nextElementSibling.hidden = false;
|
item.nextElementSibling.hidden = false;
|
||||||
item.nextElementSibling.value = "";
|
item.nextElementSibling.value = "";
|
||||||
@ -85,13 +85,13 @@ var changeCategorySelect = function(item) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
item.nextElementSibling.hidden = true;
|
item.nextElementSibling.hidden = true;
|
||||||
var text = item.options[item.selectedIndex].innerHTML;
|
const text = item.options[item.selectedIndex].innerHTML;
|
||||||
item.nextElementSibling.value = text;
|
item.nextElementSibling.value = text;
|
||||||
|
|
||||||
if ($('autoTMM').selectedIndex == 1) {
|
if ($('autoTMM').selectedIndex == 1) {
|
||||||
var categoryName = item.value;
|
const categoryName = item.value;
|
||||||
var category = categories[categoryName];
|
const category = categories[categoryName];
|
||||||
var savePath = defaultSavePath;
|
let savePath = defaultSavePath;
|
||||||
if (category !== undefined)
|
if (category !== undefined)
|
||||||
savePath = (category['savePath'] !== "") ? category['savePath'] : (defaultSavePath + categoryName);
|
savePath = (category['savePath'] !== "") ? category['savePath'] : (defaultSavePath + categoryName);
|
||||||
$('savepath').value = savePath;
|
$('savepath').value = savePath;
|
||||||
@ -99,13 +99,13 @@ var changeCategorySelect = function(item) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var changeTMM = function(item) {
|
const changeTMM = function(item) {
|
||||||
if (item.selectedIndex == 1) {
|
if (item.selectedIndex == 1) {
|
||||||
$('savepath').disabled = true;
|
$('savepath').disabled = true;
|
||||||
|
|
||||||
var categorySelect = $('categorySelect');
|
const categorySelect = $('categorySelect');
|
||||||
var categoryName = categorySelect.options[categorySelect.selectedIndex].value;
|
const categoryName = categorySelect.options[categorySelect.selectedIndex].value;
|
||||||
var category = categories[categoryName];
|
const category = categories[categoryName];
|
||||||
$('savepath').value = (category === undefined) ? "" : category['savePath'];
|
$('savepath').value = (category === undefined) ? "" : category['savePath'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,7 @@
|
|||||||
* JS counterpart of the function in src/misc.cpp
|
* JS counterpart of the function in src/misc.cpp
|
||||||
*/
|
*/
|
||||||
function friendlyUnit(value, isSpeed) {
|
function friendlyUnit(value, isSpeed) {
|
||||||
var units = [
|
const units = [
|
||||||
"QBT_TR(B)QBT_TR[CONTEXT=misc]",
|
"QBT_TR(B)QBT_TR[CONTEXT=misc]",
|
||||||
"QBT_TR(KiB)QBT_TR[CONTEXT=misc]",
|
"QBT_TR(KiB)QBT_TR[CONTEXT=misc]",
|
||||||
"QBT_TR(MiB)QBT_TR[CONTEXT=misc]",
|
"QBT_TR(MiB)QBT_TR[CONTEXT=misc]",
|
||||||
@ -45,7 +45,7 @@ function friendlyUnit(value, isSpeed) {
|
|||||||
if ((value === undefined) || (value === null) || (value < 0))
|
if ((value === undefined) || (value === null) || (value < 0))
|
||||||
return "QBT_TR(Unknown)QBT_TR[CONTEXT=misc]";
|
return "QBT_TR(Unknown)QBT_TR[CONTEXT=misc]";
|
||||||
|
|
||||||
var i = 0;
|
let i = 0;
|
||||||
while (value >= 1024.0 && i < 6) {
|
while (value >= 1024.0 && i < 6) {
|
||||||
value /= 1024.0;
|
value /= 1024.0;
|
||||||
++i;
|
++i;
|
||||||
@ -57,12 +57,12 @@ function friendlyUnit(value, isSpeed) {
|
|||||||
else return 3; // TiB, PiB, EiB
|
else return 3; // TiB, PiB, EiB
|
||||||
}
|
}
|
||||||
|
|
||||||
var ret;
|
let ret;
|
||||||
if (i === 0)
|
if (i === 0)
|
||||||
ret = value + " " + units[i];
|
ret = value + " " + units[i];
|
||||||
else {
|
else {
|
||||||
var precision = friendlyUnitPrecision(i);
|
const precision = friendlyUnitPrecision(i);
|
||||||
var offset = Math.pow(10, precision);
|
const offset = Math.pow(10, precision);
|
||||||
// Don't round up
|
// Don't round up
|
||||||
ret = (Math.floor(offset * value) / offset).toFixed(precision) + " " + units[i];
|
ret = (Math.floor(offset * value) / offset).toFixed(precision) + " " + units[i];
|
||||||
}
|
}
|
||||||
@ -76,21 +76,21 @@ function friendlyUnit(value, isSpeed) {
|
|||||||
* JS counterpart of the function in src/misc.cpp
|
* JS counterpart of the function in src/misc.cpp
|
||||||
*/
|
*/
|
||||||
function friendlyDuration(seconds) {
|
function friendlyDuration(seconds) {
|
||||||
var MAX_ETA = 8640000;
|
const MAX_ETA = 8640000;
|
||||||
if (seconds < 0 || seconds >= MAX_ETA)
|
if (seconds < 0 || seconds >= MAX_ETA)
|
||||||
return "∞";
|
return "∞";
|
||||||
if (seconds === 0)
|
if (seconds === 0)
|
||||||
return "0";
|
return "0";
|
||||||
if (seconds < 60)
|
if (seconds < 60)
|
||||||
return "QBT_TR(< 1m)QBT_TR[CONTEXT=misc]";
|
return "QBT_TR(< 1m)QBT_TR[CONTEXT=misc]";
|
||||||
var minutes = seconds / 60;
|
let minutes = seconds / 60;
|
||||||
if (minutes < 60)
|
if (minutes < 60)
|
||||||
return "QBT_TR(%1m)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(minutes));
|
return "QBT_TR(%1m)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(minutes));
|
||||||
var hours = minutes / 60;
|
let hours = minutes / 60;
|
||||||
minutes = minutes % 60;
|
minutes = minutes % 60;
|
||||||
if (hours < 24)
|
if (hours < 24)
|
||||||
return "QBT_TR(%1h %2m)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(hours)).replace("%2", parseInt(minutes));
|
return "QBT_TR(%1h %2m)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(hours)).replace("%2", parseInt(minutes));
|
||||||
var days = hours / 24;
|
const days = hours / 24;
|
||||||
hours = hours % 24;
|
hours = hours % 24;
|
||||||
if (days < 100)
|
if (days < 100)
|
||||||
return "QBT_TR(%1d %2h)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(days)).replace("%2", parseInt(hours));
|
return "QBT_TR(%1d %2h)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(days)).replace("%2", parseInt(hours));
|
||||||
@ -98,7 +98,7 @@ function friendlyDuration(seconds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function friendlyPercentage(value) {
|
function friendlyPercentage(value) {
|
||||||
var percentage = (value * 100).round(1);
|
let percentage = (value * 100).round(1);
|
||||||
if (isNaN(percentage) || (percentage < 0))
|
if (isNaN(percentage) || (percentage < 0))
|
||||||
percentage = 0;
|
percentage = 0;
|
||||||
if (percentage > 100)
|
if (percentage > 100)
|
||||||
@ -141,12 +141,12 @@ if (!Date.prototype.toISOString) {
|
|||||||
* JS counterpart of the function in src/misc.cpp
|
* JS counterpart of the function in src/misc.cpp
|
||||||
*/
|
*/
|
||||||
function parseHtmlLinks(text) {
|
function parseHtmlLinks(text) {
|
||||||
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
const exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
||||||
return text.replace(exp, "<a target='_blank' href='$1'>$1</a>");
|
return text.replace(exp, "<a target='_blank' href='$1'>$1</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeHtml(str) {
|
function escapeHtml(str) {
|
||||||
var div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.appendChild(document.createTextNode(str));
|
div.appendChild(document.createTextNode(str));
|
||||||
return div.innerHTML;
|
return div.innerHTML;
|
||||||
}
|
}
|
||||||
|
@ -53,43 +53,43 @@ if (typeof localStorage == 'undefined') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getLocalStorageItem(name, defaultVal) {
|
function getLocalStorageItem(name, defaultVal) {
|
||||||
var val = localStorage.getItem(name);
|
let val = localStorage.getItem(name);
|
||||||
if (val === null || val === undefined)
|
if (val === null || val === undefined)
|
||||||
val = defaultVal;
|
val = defaultVal;
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
var saveWindowSize = function() {};
|
let saveWindowSize = function() {};
|
||||||
var loadWindowWidth = function() {};
|
let loadWindowWidth = function() {};
|
||||||
var loadWindowHeight = function() {};
|
let loadWindowHeight = function() {};
|
||||||
var showDownloadPage = function() {};
|
let showDownloadPage = function() {};
|
||||||
var globalUploadLimitFN = function() {};
|
let globalUploadLimitFN = function() {};
|
||||||
var uploadLimitFN = function() {};
|
let uploadLimitFN = function() {};
|
||||||
var shareRatioFN = function() {};
|
let shareRatioFN = function() {};
|
||||||
var toggleSequentialDownloadFN = function() {};
|
let toggleSequentialDownloadFN = function() {};
|
||||||
var toggleFirstLastPiecePrioFN = function() {};
|
let toggleFirstLastPiecePrioFN = function() {};
|
||||||
var setSuperSeedingFN = function() {};
|
let setSuperSeedingFN = function() {};
|
||||||
var setForceStartFN = function() {};
|
let setForceStartFN = function() {};
|
||||||
var globalDownloadLimitFN = function() {};
|
let globalDownloadLimitFN = function() {};
|
||||||
var StatisticsLinkFN = function() {};
|
let StatisticsLinkFN = function() {};
|
||||||
var downloadLimitFN = function() {};
|
let downloadLimitFN = function() {};
|
||||||
var deleteFN = function() {};
|
let deleteFN = function() {};
|
||||||
var pauseFN = function() {};
|
let pauseFN = function() {};
|
||||||
var startFN = function() {};
|
let startFN = function() {};
|
||||||
var autoTorrentManagementFN = function() {};
|
let autoTorrentManagementFN = function() {};
|
||||||
var recheckFN = function() {};
|
let recheckFN = function() {};
|
||||||
var reannounceFN = function() {};
|
let reannounceFN = function() {};
|
||||||
var setLocationFN = function() {};
|
let setLocationFN = function() {};
|
||||||
var renameFN = function() {};
|
let renameFN = function() {};
|
||||||
var torrentNewCategoryFN = function() {};
|
let torrentNewCategoryFN = function() {};
|
||||||
var torrentSetCategoryFN = function() {};
|
let torrentSetCategoryFN = function() {};
|
||||||
var createCategoryFN = function() {};
|
let createCategoryFN = function() {};
|
||||||
var editCategoryFN = function() {};
|
let editCategoryFN = function() {};
|
||||||
var removeCategoryFN = function() {};
|
let removeCategoryFN = function() {};
|
||||||
var deleteUnusedCategoriesFN = function() {};
|
let deleteUnusedCategoriesFN = function() {};
|
||||||
var startTorrentsByCategoryFN = function() {};
|
let startTorrentsByCategoryFN = function() {};
|
||||||
var pauseTorrentsByCategoryFN = function() {};
|
let pauseTorrentsByCategoryFN = function() {};
|
||||||
var deleteTorrentsByCategoryFN = function() {};
|
let deleteTorrentsByCategoryFN = function() {};
|
||||||
let torrentAddTagsFN = function() {};
|
let torrentAddTagsFN = function() {};
|
||||||
let torrentSetTagsFN = function() {};
|
let torrentSetTagsFN = function() {};
|
||||||
let torrentRemoveAllTagsFN = function() {};
|
let torrentRemoveAllTagsFN = function() {};
|
||||||
@ -99,14 +99,14 @@ let deleteUnusedTagsFN = function() {};
|
|||||||
let startTorrentsByTagFN = function() {};
|
let startTorrentsByTagFN = function() {};
|
||||||
let pauseTorrentsByTagFN = function() {};
|
let pauseTorrentsByTagFN = function() {};
|
||||||
let deleteTorrentsByTagFN = function() {};
|
let deleteTorrentsByTagFN = function() {};
|
||||||
var copyNameFN = function() {};
|
let copyNameFN = function() {};
|
||||||
var copyMagnetLinkFN = function() {};
|
let copyMagnetLinkFN = function() {};
|
||||||
var copyHashFN = function() {};
|
let copyHashFN = function() {};
|
||||||
var setQueuePositionFN = function() {};
|
let setQueuePositionFN = function() {};
|
||||||
|
|
||||||
var initializeWindows = function() {
|
const initializeWindows = function() {
|
||||||
saveWindowSize = function(windowId) {
|
saveWindowSize = function(windowId) {
|
||||||
var size = $(windowId).getSize();
|
const size = $(windowId).getSize();
|
||||||
localStorage.setItem('window_' + windowId + '_width', size.x);
|
localStorage.setItem('window_' + windowId + '_width', size.x);
|
||||||
localStorage.setItem('window_' + windowId + '_height', size.y);
|
localStorage.setItem('window_' + windowId + '_height', size.y);
|
||||||
};
|
};
|
||||||
@ -133,8 +133,8 @@ var initializeWindows = function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
showDownloadPage = function(urls) {
|
showDownloadPage = function(urls) {
|
||||||
var id = 'downloadPage';
|
const id = 'downloadPage';
|
||||||
var contentUrl = 'download.html';
|
let contentUrl = 'download.html';
|
||||||
if (urls && urls.length)
|
if (urls && urls.length)
|
||||||
contentUrl += '?urls=' + urls.join("|");
|
contentUrl += '?urls=' + urls.join("|");
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ var initializeWindows = function() {
|
|||||||
|
|
||||||
addClickEvent('preferences', function(e) {
|
addClickEvent('preferences', function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
var id = 'preferencesPage';
|
const id = 'preferencesPage';
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: id,
|
id: id,
|
||||||
title: "QBT_TR(Options)QBT_TR[CONTEXT=OptionsDialog]",
|
title: "QBT_TR(Options)QBT_TR[CONTEXT=OptionsDialog]",
|
||||||
@ -185,7 +185,7 @@ var initializeWindows = function() {
|
|||||||
|
|
||||||
addClickEvent('upload', function(e) {
|
addClickEvent('upload', function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
var id = 'uploadPage';
|
const id = 'uploadPage';
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: id,
|
id: id,
|
||||||
title: "QBT_TR(Upload local torrent)QBT_TR[CONTEXT=HttpServer]",
|
title: "QBT_TR(Upload local torrent)QBT_TR[CONTEXT=HttpServer]",
|
||||||
@ -222,7 +222,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
uploadLimitFN = function() {
|
uploadLimitFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'uploadLimitPage',
|
id: 'uploadLimitPage',
|
||||||
@ -241,16 +241,16 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
shareRatioFN = function() {
|
shareRatioFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
var shareRatio = null;
|
let shareRatio = null;
|
||||||
var torrentsHaveSameShareRatio = true;
|
let torrentsHaveSameShareRatio = true;
|
||||||
|
|
||||||
// check if all selected torrents have same share ratio
|
// check if all selected torrents have same share ratio
|
||||||
for (var i = 0; i < hashes.length; ++i) {
|
for (let i = 0; i < hashes.length; ++i) {
|
||||||
var hash = hashes[i];
|
const hash = hashes[i];
|
||||||
var row = torrentsTable.rows[hash].full_data;
|
const row = torrentsTable.rows[hash].full_data;
|
||||||
var origValues = row.ratio_limit + "|" + row.seeding_time_limit + "|" + row.max_ratio + "|" + row.max_seeding_time;
|
const origValues = row.ratio_limit + "|" + row.seeding_time_limit + "|" + row.max_ratio + "|" + row.max_seeding_time;
|
||||||
|
|
||||||
// initialize value
|
// initialize value
|
||||||
if (shareRatio === null)
|
if (shareRatio === null)
|
||||||
@ -263,7 +263,7 @@ var initializeWindows = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if all torrents have same share ratio, display that share ratio. else use the default
|
// if all torrents have same share ratio, display that share ratio. else use the default
|
||||||
var orig = torrentsHaveSameShareRatio ? shareRatio : "";
|
const orig = torrentsHaveSameShareRatio ? shareRatio : "";
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'shareRatioPage',
|
id: 'shareRatioPage',
|
||||||
title: "QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDialog]",
|
title: "QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDialog]",
|
||||||
@ -280,7 +280,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
toggleSequentialDownloadFN = function() {
|
toggleSequentialDownloadFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/toggleSequentialDownload',
|
url: 'api/v2/torrents/toggleSequentialDownload',
|
||||||
@ -294,7 +294,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
toggleFirstLastPiecePrioFN = function() {
|
toggleFirstLastPiecePrioFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/toggleFirstLastPiecePrio',
|
url: 'api/v2/torrents/toggleFirstLastPiecePrio',
|
||||||
@ -308,7 +308,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setSuperSeedingFN = function(val) {
|
setSuperSeedingFN = function(val) {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/setSuperSeeding',
|
url: 'api/v2/torrents/setSuperSeeding',
|
||||||
@ -323,7 +323,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setForceStartFN = function() {
|
setForceStartFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/setForceStart',
|
url: 'api/v2/torrents/setForceStart',
|
||||||
@ -354,7 +354,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
StatisticsLinkFN = function() {
|
StatisticsLinkFN = function() {
|
||||||
var id = 'statisticspage';
|
const id = 'statisticspage';
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: id,
|
id: id,
|
||||||
title: 'QBT_TR(Statistics)QBT_TR[CONTEXT=StatsDialog]',
|
title: 'QBT_TR(Statistics)QBT_TR[CONTEXT=StatsDialog]',
|
||||||
@ -371,7 +371,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
downloadLimitFN = function() {
|
downloadLimitFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'downloadLimitPage',
|
id: 'downloadLimitPage',
|
||||||
@ -390,7 +390,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
deleteFN = function() {
|
deleteFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'confirmDeletionPage',
|
id: 'confirmDeletionPage',
|
||||||
@ -414,7 +414,7 @@ var initializeWindows = function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
pauseFN = function() {
|
pauseFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/pause',
|
url: 'api/v2/torrents/pause',
|
||||||
@ -428,7 +428,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
startFN = function() {
|
startFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/resume',
|
url: 'api/v2/torrents/resume',
|
||||||
@ -442,11 +442,11 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
autoTorrentManagementFN = function() {
|
autoTorrentManagementFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
var enable = false;
|
let enable = false;
|
||||||
hashes.each(function(hash, index) {
|
hashes.each(function(hash, index) {
|
||||||
var row = torrentsTable.rows[hash];
|
const row = torrentsTable.rows[hash];
|
||||||
if (!row.full_data.auto_tmm)
|
if (!row.full_data.auto_tmm)
|
||||||
enable = true;
|
enable = true;
|
||||||
});
|
});
|
||||||
@ -463,7 +463,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
recheckFN = function() {
|
recheckFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/recheck',
|
url: 'api/v2/torrents/recheck',
|
||||||
@ -477,7 +477,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
reannounceFN = function() {
|
reannounceFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/reannounce',
|
url: 'api/v2/torrents/reannounce',
|
||||||
@ -491,11 +491,11 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setLocationFN = function() {
|
setLocationFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
var hash = hashes[0];
|
const hash = hashes[0];
|
||||||
var row = torrentsTable.rows[hash];
|
const row = torrentsTable.rows[hash];
|
||||||
var path = encodeURIComponent(row.full_data.save_path);
|
const path = encodeURIComponent(row.full_data.save_path);
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'setLocationPage',
|
id: 'setLocationPage',
|
||||||
title: "QBT_TR(Set location)QBT_TR[CONTEXT=TransferListWidget]",
|
title: "QBT_TR(Set location)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
@ -513,10 +513,10 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
renameFN = function() {
|
renameFN = function() {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length == 1) {
|
if (hashes.length == 1) {
|
||||||
var hash = hashes[0];
|
const hash = hashes[0];
|
||||||
var row = torrentsTable.rows[hash];
|
const row = torrentsTable.rows[hash];
|
||||||
if (row) {
|
if (row) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'renamePage',
|
id: 'renamePage',
|
||||||
@ -536,8 +536,8 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
torrentNewCategoryFN = function() {
|
torrentNewCategoryFN = function() {
|
||||||
var action = "set";
|
const action = "set";
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'newCategoryPage',
|
id: 'newCategoryPage',
|
||||||
@ -556,10 +556,10 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
torrentSetCategoryFN = function(categoryHash) {
|
torrentSetCategoryFN = function(categoryHash) {
|
||||||
var categoryName = '';
|
let categoryName = '';
|
||||||
if (categoryHash != 0)
|
if (categoryHash != 0)
|
||||||
categoryName = category_list[categoryHash].name;
|
categoryName = category_list[categoryHash].name;
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/setCategory',
|
url: 'api/v2/torrents/setCategory',
|
||||||
@ -573,7 +573,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
createCategoryFN = function() {
|
createCategoryFN = function() {
|
||||||
var action = "create";
|
const action = "create";
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'newCategoryPage',
|
id: 'newCategoryPage',
|
||||||
title: "QBT_TR(New Category)QBT_TR[CONTEXT=CategoryFilterWidget]",
|
title: "QBT_TR(New Category)QBT_TR[CONTEXT=CategoryFilterWidget]",
|
||||||
@ -591,9 +591,9 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
editCategoryFN = function(categoryHash) {
|
editCategoryFN = function(categoryHash) {
|
||||||
var action = "edit";
|
const action = "edit";
|
||||||
var categoryName = category_list[categoryHash].name;
|
const categoryName = category_list[categoryHash].name;
|
||||||
var savePath = category_list[categoryHash].savePath;
|
const savePath = category_list[categoryHash].savePath;
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'editCategoryPage',
|
id: 'editCategoryPage',
|
||||||
title: "QBT_TR(Edit Category)QBT_TR[CONTEXT=TransferListWidget]",
|
title: "QBT_TR(Edit Category)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
@ -611,7 +611,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
removeCategoryFN = function(categoryHash) {
|
removeCategoryFN = function(categoryHash) {
|
||||||
var categoryName = category_list[categoryHash].name;
|
const categoryName = category_list[categoryHash].name;
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/removeCategories',
|
url: 'api/v2/torrents/removeCategories',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@ -623,8 +623,8 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
deleteUnusedCategoriesFN = function() {
|
deleteUnusedCategoriesFN = function() {
|
||||||
var categories = [];
|
const categories = [];
|
||||||
for (var hash in category_list) {
|
for (const hash in category_list) {
|
||||||
if (torrentsTable.getFilteredTorrentsNumber('all', hash, TAGS_ALL) === 0)
|
if (torrentsTable.getFilteredTorrentsNumber('all', hash, TAGS_ALL) === 0)
|
||||||
categories.push(category_list[hash].name);
|
categories.push(category_list[hash].name);
|
||||||
}
|
}
|
||||||
@ -639,7 +639,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
startTorrentsByCategoryFN = function(categoryHash) {
|
startTorrentsByCategoryFN = function(categoryHash) {
|
||||||
var hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash, TAGS_ALL);
|
const hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash, TAGS_ALL);
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/resume',
|
url: 'api/v2/torrents/resume',
|
||||||
@ -653,7 +653,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pauseTorrentsByCategoryFN = function(categoryHash) {
|
pauseTorrentsByCategoryFN = function(categoryHash) {
|
||||||
var hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash, TAGS_ALL);
|
const hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash, TAGS_ALL);
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/pause',
|
url: 'api/v2/torrents/pause',
|
||||||
@ -667,7 +667,7 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
deleteTorrentsByCategoryFN = function(categoryHash) {
|
deleteTorrentsByCategoryFN = function(categoryHash) {
|
||||||
var hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash, TAGS_ALL);
|
const hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash, TAGS_ALL);
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'confirmDeletionPage',
|
id: 'confirmDeletionPage',
|
||||||
@ -827,12 +827,12 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
copyNameFN = function() {
|
copyNameFN = function() {
|
||||||
var selectedRows = torrentsTable.selectedRowsIds();
|
const selectedRows = torrentsTable.selectedRowsIds();
|
||||||
var names = [];
|
const names = [];
|
||||||
if (selectedRows.length) {
|
if (selectedRows.length) {
|
||||||
var rows = torrentsTable.getFilteredAndSortedRows();
|
const rows = torrentsTable.getFilteredAndSortedRows();
|
||||||
for (var i = 0; i < selectedRows.length; ++i) {
|
for (let i = 0; i < selectedRows.length; ++i) {
|
||||||
var hash = selectedRows[i];
|
const hash = selectedRows[i];
|
||||||
names.push(rows[hash].full_data.name);
|
names.push(rows[hash].full_data.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -840,12 +840,12 @@ var initializeWindows = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
copyMagnetLinkFN = function() {
|
copyMagnetLinkFN = function() {
|
||||||
var selectedRows = torrentsTable.selectedRowsIds();
|
const selectedRows = torrentsTable.selectedRowsIds();
|
||||||
var magnets = [];
|
const magnets = [];
|
||||||
if (selectedRows.length) {
|
if (selectedRows.length) {
|
||||||
var rows = torrentsTable.getFilteredAndSortedRows();
|
const rows = torrentsTable.getFilteredAndSortedRows();
|
||||||
for (var i = 0; i < selectedRows.length; ++i) {
|
for (let i = 0; i < selectedRows.length; ++i) {
|
||||||
var hash = selectedRows[i];
|
const hash = selectedRows[i];
|
||||||
magnets.push(rows[hash].full_data.magnet_uri);
|
magnets.push(rows[hash].full_data.magnet_uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -873,7 +873,7 @@ var initializeWindows = function() {
|
|||||||
['pause', 'resume', 'recheck'].each(function(item) {
|
['pause', 'resume', 'recheck'].each(function(item) {
|
||||||
addClickEvent(item, function(e) {
|
addClickEvent(item, function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
hashes.each(function(hash, index) {
|
hashes.each(function(hash, index) {
|
||||||
new Request({
|
new Request({
|
||||||
@ -897,7 +897,7 @@ var initializeWindows = function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setQueuePositionFN = function(cmd) {
|
setQueuePositionFN = function(cmd) {
|
||||||
var hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/' + cmd,
|
url: 'api/v2/torrents/' + cmd,
|
||||||
@ -912,7 +912,7 @@ var initializeWindows = function() {
|
|||||||
|
|
||||||
addClickEvent('about', function(e) {
|
addClickEvent('about', function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
var id = 'aboutpage';
|
const id = 'aboutpage';
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: id,
|
id: id,
|
||||||
title: 'QBT_TR(About qBittorrent)QBT_TR[CONTEXT=AboutDialog]',
|
title: 'QBT_TR(About qBittorrent)QBT_TR[CONTEXT=AboutDialog]',
|
||||||
|
@ -28,9 +28,9 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ProgressBar = new Class({
|
const ProgressBar = new Class({
|
||||||
initialize: function(value, parameters) {
|
initialize: function(value, parameters) {
|
||||||
var vals = {
|
const vals = {
|
||||||
'id': 'progressbar_' + (ProgressBars++),
|
'id': 'progressbar_' + (ProgressBars++),
|
||||||
'value': $pick(value, 0),
|
'value': $pick(value, 0),
|
||||||
'width': 0,
|
'width': 0,
|
||||||
@ -42,7 +42,7 @@ var ProgressBar = new Class({
|
|||||||
};
|
};
|
||||||
if (parameters && $type(parameters) == 'object') $extend(vals, parameters);
|
if (parameters && $type(parameters) == 'object') $extend(vals, parameters);
|
||||||
if (vals.height < 12) vals.height = 12;
|
if (vals.height < 12) vals.height = 12;
|
||||||
var obj = new Element('div', {
|
const obj = new Element('div', {
|
||||||
'id': vals.id,
|
'id': vals.id,
|
||||||
'class': 'progressbar_wrapper',
|
'class': 'progressbar_wrapper',
|
||||||
'styles': {
|
'styles': {
|
||||||
@ -110,7 +110,7 @@ function ProgressBar_setValue(value) {
|
|||||||
this.vals.light.empty();
|
this.vals.light.empty();
|
||||||
this.vals.dark.appendText(value.round(1).toFixed(1) + '%');
|
this.vals.dark.appendText(value.round(1).toFixed(1) + '%');
|
||||||
this.vals.light.appendText(value.round(1).toFixed(1) + '%');
|
this.vals.light.appendText(value.round(1).toFixed(1) + '%');
|
||||||
var r = parseInt(this.vals.width * (value / 100));
|
const r = parseInt(this.vals.width * (value / 100));
|
||||||
this.vals.dark.setStyle('clip', 'rect(0,' + r + 'px,' + this.vals.height + 'px,0)');
|
this.vals.dark.setStyle('clip', 'rect(0,' + r + 'px,' + this.vals.height + 'px,0)');
|
||||||
this.vals.light.setStyle('clip', 'rect(0,' + this.vals.width + 'px,' + this.vals.height + 'px,' + r + 'px)');
|
this.vals.light.setStyle('clip', 'rect(0,' + this.vals.width + 'px,' + this.vals.height + 'px,' + r + 'px)');
|
||||||
}
|
}
|
||||||
@ -126,15 +126,15 @@ function ProgressBar_setWidth(value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ProgressBar_checkForParent(id) {
|
function ProgressBar_checkForParent(id) {
|
||||||
var obj = $(id);
|
const obj = $(id);
|
||||||
if (!obj) return;
|
if (!obj) return;
|
||||||
if (!obj.parentNode) return setTimeout('ProgressBar_checkForParent("' + id + '")', 1);
|
if (!obj.parentNode) return setTimeout('ProgressBar_checkForParent("' + id + '")', 1);
|
||||||
obj.setStyle('width', '100%');
|
obj.setStyle('width', '100%');
|
||||||
var w = obj.offsetWidth;
|
const w = obj.offsetWidth;
|
||||||
obj.vals.dark.setStyle('width', w);
|
obj.vals.dark.setStyle('width', w);
|
||||||
obj.vals.light.setStyle('width', w);
|
obj.vals.light.setStyle('width', w);
|
||||||
obj.vals.width = w;
|
obj.vals.width = w;
|
||||||
obj.setValue(obj.vals.value);
|
obj.setValue(obj.vals.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
var ProgressBars = 0;
|
let ProgressBars = 0;
|
||||||
|
@ -28,10 +28,10 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var is_seed = true;
|
let is_seed = true;
|
||||||
var current_hash = "";
|
this.current_hash = "";
|
||||||
|
|
||||||
var FilePriority = {
|
const FilePriority = {
|
||||||
"Ignored": 0,
|
"Ignored": 0,
|
||||||
"Normal": 1,
|
"Normal": 1,
|
||||||
"High": 6,
|
"High": 6,
|
||||||
@ -39,7 +39,7 @@ var FilePriority = {
|
|||||||
"Mixed": -1
|
"Mixed": -1
|
||||||
};
|
};
|
||||||
|
|
||||||
var normalizePriority = function(priority) {
|
const normalizePriority = function(priority) {
|
||||||
switch (priority) {
|
switch (priority) {
|
||||||
case FilePriority.Ignored:
|
case FilePriority.Ignored:
|
||||||
case FilePriority.Normal:
|
case FilePriority.Normal:
|
||||||
@ -52,30 +52,30 @@ var normalizePriority = function(priority) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var fileCheckboxChanged = function(e) {
|
const fileCheckboxChanged = function(e) {
|
||||||
var checkbox = e.target;
|
const checkbox = e.target;
|
||||||
var priority = checkbox.checked ? FilePriority.Normal : FilePriority.Ignored;
|
const priority = checkbox.checked ? FilePriority.Normal : FilePriority.Ignored;
|
||||||
var id = checkbox.get('data-id');
|
const id = checkbox.get('data-id');
|
||||||
|
|
||||||
setFilePriority(id, priority);
|
setFilePriority(id, priority);
|
||||||
setGlobalCheckboxState();
|
setGlobalCheckboxState();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
var fileComboboxChanged = function(e) {
|
const fileComboboxChanged = function(e) {
|
||||||
var combobox = e.target;
|
const combobox = e.target;
|
||||||
var newPriority = combobox.value;
|
const newPriority = combobox.value;
|
||||||
var id = combobox.get('data-id');
|
const id = combobox.get('data-id');
|
||||||
|
|
||||||
setFilePriority(id, newPriority);
|
setFilePriority(id, newPriority);
|
||||||
};
|
};
|
||||||
|
|
||||||
var isDownloadCheckboxExists = function(id) {
|
const isDownloadCheckboxExists = function(id) {
|
||||||
return ($('cbPrio' + id) !== null);
|
return ($('cbPrio' + id) !== null);
|
||||||
};
|
};
|
||||||
|
|
||||||
var createDownloadCheckbox = function(id, download) {
|
const createDownloadCheckbox = function(id, download) {
|
||||||
var checkbox = new Element('input');
|
const checkbox = new Element('input');
|
||||||
checkbox.set('type', 'checkbox');
|
checkbox.set('type', 'checkbox');
|
||||||
if (download)
|
if (download)
|
||||||
checkbox.set('checked', 'checked');
|
checkbox.set('checked', 'checked');
|
||||||
@ -86,17 +86,17 @@ var createDownloadCheckbox = function(id, download) {
|
|||||||
return checkbox;
|
return checkbox;
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateDownloadCheckbox = function(id, download) {
|
const updateDownloadCheckbox = function(id, download) {
|
||||||
var checkbox = $('cbPrio' + id);
|
const checkbox = $('cbPrio' + id);
|
||||||
checkbox.checked = download;
|
checkbox.checked = download;
|
||||||
};
|
};
|
||||||
|
|
||||||
var isPriorityComboExists = function(id) {
|
const isPriorityComboExists = function(id) {
|
||||||
return ($('comboPrio' + id) !== null);
|
return ($('comboPrio' + id) !== null);
|
||||||
};
|
};
|
||||||
|
|
||||||
var createPriorityOptionElement = function(priority, selected, html) {
|
const createPriorityOptionElement = function(priority, selected, html) {
|
||||||
var elem = new Element('option');
|
const elem = new Element('option');
|
||||||
elem.set('value', priority.toString());
|
elem.set('value', priority.toString());
|
||||||
elem.set('html', html);
|
elem.set('html', html);
|
||||||
if (selected)
|
if (selected)
|
||||||
@ -104,8 +104,8 @@ var createPriorityOptionElement = function(priority, selected, html) {
|
|||||||
return elem;
|
return elem;
|
||||||
};
|
};
|
||||||
|
|
||||||
var createPriorityCombo = function(id, selectedPriority) {
|
const createPriorityCombo = function(id, selectedPriority) {
|
||||||
var select = new Element('select');
|
const select = new Element('select');
|
||||||
select.set('id', 'comboPrio' + id);
|
select.set('id', 'comboPrio' + id);
|
||||||
select.set('data-id', id);
|
select.set('data-id', id);
|
||||||
select.set('disabled', is_seed);
|
select.set('disabled', is_seed);
|
||||||
@ -120,8 +120,8 @@ var createPriorityCombo = function(id, selectedPriority) {
|
|||||||
return select;
|
return select;
|
||||||
};
|
};
|
||||||
|
|
||||||
var updatePriorityCombo = function(id, selectedPriority) {
|
const updatePriorityCombo = function(id, selectedPriority) {
|
||||||
var combobox = $('comboPrio' + id);
|
const combobox = $('comboPrio' + id);
|
||||||
|
|
||||||
if (parseInt(combobox.value) !== selectedPriority)
|
if (parseInt(combobox.value) !== selectedPriority)
|
||||||
selectComboboxPriority(combobox, selectedPriority);
|
selectComboboxPriority(combobox, selectedPriority);
|
||||||
@ -130,10 +130,10 @@ var updatePriorityCombo = function(id, selectedPriority) {
|
|||||||
combobox.disabled = is_seed;
|
combobox.disabled = is_seed;
|
||||||
};
|
};
|
||||||
|
|
||||||
var selectComboboxPriority = function(combobox, priority) {
|
const selectComboboxPriority = function(combobox, priority) {
|
||||||
var options = combobox.options;
|
const options = combobox.options;
|
||||||
for (var i = 0; i < options.length; ++i) {
|
for (let i = 0; i < options.length; ++i) {
|
||||||
var option = options[i];
|
const option = options[i];
|
||||||
if (parseInt(option.value) === priority)
|
if (parseInt(option.value) === priority)
|
||||||
option.setAttribute('selected', '');
|
option.setAttribute('selected', '');
|
||||||
else
|
else
|
||||||
@ -143,9 +143,9 @@ var selectComboboxPriority = function(combobox, priority) {
|
|||||||
combobox.value = priority;
|
combobox.value = priority;
|
||||||
};
|
};
|
||||||
|
|
||||||
var switchCheckboxState = function() {
|
const switchCheckboxState = function() {
|
||||||
var rows = [];
|
const rows = [];
|
||||||
var priority = FilePriority.Ignored;
|
let priority = FilePriority.Ignored;
|
||||||
|
|
||||||
if ($('tristate_cb').state === "checked") {
|
if ($('tristate_cb').state === "checked") {
|
||||||
setGlobalCheckboxUnchecked();
|
setGlobalCheckboxUnchecked();
|
||||||
@ -169,7 +169,7 @@ var switchCheckboxState = function() {
|
|||||||
setFilePriority(rows, priority);
|
setFilePriority(rows, priority);
|
||||||
};
|
};
|
||||||
|
|
||||||
var setGlobalCheckboxState = function() {
|
const setGlobalCheckboxState = function() {
|
||||||
if (isAllCheckboxesChecked())
|
if (isAllCheckboxesChecked())
|
||||||
setGlobalCheckboxChecked();
|
setGlobalCheckboxChecked();
|
||||||
else if (isAllCheckboxesUnchecked())
|
else if (isAllCheckboxesUnchecked())
|
||||||
@ -178,44 +178,44 @@ var setGlobalCheckboxState = function() {
|
|||||||
setGlobalCheckboxPartial();
|
setGlobalCheckboxPartial();
|
||||||
};
|
};
|
||||||
|
|
||||||
var setGlobalCheckboxChecked = function() {
|
const setGlobalCheckboxChecked = function() {
|
||||||
$('tristate_cb').state = "checked";
|
$('tristate_cb').state = "checked";
|
||||||
$('tristate_cb').indeterminate = false;
|
$('tristate_cb').indeterminate = false;
|
||||||
$('tristate_cb').checked = true;
|
$('tristate_cb').checked = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
var setGlobalCheckboxUnchecked = function() {
|
const setGlobalCheckboxUnchecked = function() {
|
||||||
$('tristate_cb').state = "unchecked";
|
$('tristate_cb').state = "unchecked";
|
||||||
$('tristate_cb').indeterminate = false;
|
$('tristate_cb').indeterminate = false;
|
||||||
$('tristate_cb').checked = false;
|
$('tristate_cb').checked = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
var setGlobalCheckboxPartial = function() {
|
const setGlobalCheckboxPartial = function() {
|
||||||
$('tristate_cb').state = "partial";
|
$('tristate_cb').state = "partial";
|
||||||
$('tristate_cb').indeterminate = true;
|
$('tristate_cb').indeterminate = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
var isAllCheckboxesChecked = function() {
|
const isAllCheckboxesChecked = function() {
|
||||||
var checkboxes = $$('input.DownloadedCB');
|
const checkboxes = $$('input.DownloadedCB');
|
||||||
for (var i = 0; i < checkboxes.length; ++i) {
|
for (let i = 0; i < checkboxes.length; ++i) {
|
||||||
if (!checkboxes[i].checked)
|
if (!checkboxes[i].checked)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
var isAllCheckboxesUnchecked = function() {
|
const isAllCheckboxesUnchecked = function() {
|
||||||
var checkboxes = $$('input.DownloadedCB');
|
const checkboxes = $$('input.DownloadedCB');
|
||||||
for (var i = 0; i < checkboxes.length; ++i) {
|
for (let i = 0; i < checkboxes.length; ++i) {
|
||||||
if (checkboxes[i].checked)
|
if (checkboxes[i].checked)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
var setFilePriority = function(id, priority) {
|
const setFilePriority = function(id, priority) {
|
||||||
if (current_hash === "") return;
|
if (current_hash === "") return;
|
||||||
var ids = Array.isArray(id) ? id : [id];
|
const ids = Array.isArray(id) ? id : [id];
|
||||||
|
|
||||||
clearTimeout(loadTorrentFilesDataTimer);
|
clearTimeout(loadTorrentFilesDataTimer);
|
||||||
new Request({
|
new Request({
|
||||||
@ -232,20 +232,20 @@ var setFilePriority = function(id, priority) {
|
|||||||
}).send();
|
}).send();
|
||||||
|
|
||||||
ids.forEach(function(_id) {
|
ids.forEach(function(_id) {
|
||||||
var combobox = $('comboPrio' + _id);
|
const combobox = $('comboPrio' + _id);
|
||||||
if (combobox !== null)
|
if (combobox !== null)
|
||||||
selectComboboxPriority(combobox, priority);
|
selectComboboxPriority(combobox, priority);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var loadTorrentFilesDataTimer;
|
let loadTorrentFilesDataTimer;
|
||||||
var loadTorrentFilesData = function() {
|
const loadTorrentFilesData = function() {
|
||||||
if ($('prop_files').hasClass('invisible')
|
if ($('prop_files').hasClass('invisible')
|
||||||
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
|
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
|
||||||
// Tab changed, don't do anything
|
// Tab changed, don't do anything
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var new_hash = torrentsTable.getCurrentTorrentHash();
|
const new_hash = torrentsTable.getCurrentTorrentHash();
|
||||||
if (new_hash === "") {
|
if (new_hash === "") {
|
||||||
torrentFilesTable.clear();
|
torrentFilesTable.clear();
|
||||||
clearTimeout(loadTorrentFilesDataTimer);
|
clearTimeout(loadTorrentFilesDataTimer);
|
||||||
@ -256,7 +256,7 @@ var loadTorrentFilesData = function() {
|
|||||||
torrentFilesTable.clear();
|
torrentFilesTable.clear();
|
||||||
current_hash = new_hash;
|
current_hash = new_hash;
|
||||||
}
|
}
|
||||||
var url = new URI('api/v2/torrents/files?hash=' + current_hash);
|
const url = new URI('api/v2/torrents/files?hash=' + current_hash);
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
noCache: true,
|
noCache: true,
|
||||||
@ -266,19 +266,19 @@ var loadTorrentFilesData = function() {
|
|||||||
loadTorrentFilesDataTimer = loadTorrentFilesData.delay(5000);
|
loadTorrentFilesDataTimer = loadTorrentFilesData.delay(5000);
|
||||||
},
|
},
|
||||||
onSuccess: function(files) {
|
onSuccess: function(files) {
|
||||||
var selectedFiles = torrentFilesTable.selectedRowsIds();
|
const selectedFiles = torrentFilesTable.selectedRowsIds();
|
||||||
|
|
||||||
if (!files) {
|
if (!files) {
|
||||||
torrentFilesTable.clear();
|
torrentFilesTable.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var i = 0;
|
let i = 0;
|
||||||
files.each(function(file) {
|
files.each(function(file) {
|
||||||
if (i === 0)
|
if (i === 0)
|
||||||
is_seed = file.is_seed;
|
is_seed = file.is_seed;
|
||||||
|
|
||||||
var row = {
|
const row = {
|
||||||
rowId: i,
|
rowId: i,
|
||||||
checked: (file.priority !== FilePriority.Ignored),
|
checked: (file.priority !== FilePriority.Ignored),
|
||||||
name: escapeHtml(file.name),
|
name: escapeHtml(file.name),
|
||||||
@ -307,35 +307,35 @@ var loadTorrentFilesData = function() {
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateTorrentFilesData = function() {
|
updateTorrentFilesData = function() {
|
||||||
clearTimeout(loadTorrentFilesDataTimer);
|
clearTimeout(loadTorrentFilesDataTimer);
|
||||||
loadTorrentFilesData();
|
loadTorrentFilesData();
|
||||||
};
|
};
|
||||||
|
|
||||||
var torrentFilesContextMenu = new ContextMenu({
|
const torrentFilesContextMenu = new ContextMenu({
|
||||||
targets: '#torrentFilesTableDiv tr',
|
targets: '#torrentFilesTableDiv tr',
|
||||||
menu: 'torrentFilesMenu',
|
menu: 'torrentFilesMenu',
|
||||||
actions: {
|
actions: {
|
||||||
FilePrioIgnore: function(element, ref) {
|
FilePrioIgnore: function(element, ref) {
|
||||||
var selectedRows = torrentFilesTable.selectedRowsIds();
|
const selectedRows = torrentFilesTable.selectedRowsIds();
|
||||||
if (selectedRows.length === 0) return;
|
if (selectedRows.length === 0) return;
|
||||||
|
|
||||||
setFilePriority(selectedRows, FilePriority.Ignored);
|
setFilePriority(selectedRows, FilePriority.Ignored);
|
||||||
},
|
},
|
||||||
FilePrioNormal: function(element, ref) {
|
FilePrioNormal: function(element, ref) {
|
||||||
var selectedRows = torrentFilesTable.selectedRowsIds();
|
const selectedRows = torrentFilesTable.selectedRowsIds();
|
||||||
if (selectedRows.length === 0) return;
|
if (selectedRows.length === 0) return;
|
||||||
|
|
||||||
setFilePriority(selectedRows, FilePriority.Normal);
|
setFilePriority(selectedRows, FilePriority.Normal);
|
||||||
},
|
},
|
||||||
FilePrioHigh: function(element, ref) {
|
FilePrioHigh: function(element, ref) {
|
||||||
var selectedRows = torrentFilesTable.selectedRowsIds();
|
const selectedRows = torrentFilesTable.selectedRowsIds();
|
||||||
if (selectedRows.length === 0) return;
|
if (selectedRows.length === 0) return;
|
||||||
|
|
||||||
setFilePriority(selectedRows, FilePriority.High);
|
setFilePriority(selectedRows, FilePriority.High);
|
||||||
},
|
},
|
||||||
FilePrioMaximum: function(element, ref) {
|
FilePrioMaximum: function(element, ref) {
|
||||||
var selectedRows = torrentFilesTable.selectedRowsIds();
|
const selectedRows = torrentFilesTable.selectedRowsIds();
|
||||||
if (selectedRows.length === 0) return;
|
if (selectedRows.length === 0) return;
|
||||||
|
|
||||||
setFilePriority(selectedRows, FilePriority.Maximum);
|
setFilePriority(selectedRows, FilePriority.Maximum);
|
||||||
@ -357,14 +357,14 @@ var torrentFilesContextMenu = new ContextMenu({
|
|||||||
|
|
||||||
torrentFilesTable.setup('torrentFilesTableDiv', 'torrentFilesTableFixedHeaderDiv', torrentFilesContextMenu);
|
torrentFilesTable.setup('torrentFilesTableDiv', 'torrentFilesTableFixedHeaderDiv', torrentFilesContextMenu);
|
||||||
// inject checkbox into table header
|
// inject checkbox into table header
|
||||||
var tableHeaders = $$('#torrentFilesTableFixedHeaderDiv .dynamicTableHeader th');
|
const tableHeaders = $$('#torrentFilesTableFixedHeaderDiv .dynamicTableHeader th');
|
||||||
if (tableHeaders.length > 0) {
|
if (tableHeaders.length > 0) {
|
||||||
var checkbox = new Element('input');
|
const checkbox = new Element('input');
|
||||||
checkbox.set('type', 'checkbox');
|
checkbox.set('type', 'checkbox');
|
||||||
checkbox.set('id', 'tristate_cb');
|
checkbox.set('id', 'tristate_cb');
|
||||||
checkbox.addEvent('click', switchCheckboxState);
|
checkbox.addEvent('click', switchCheckboxState);
|
||||||
|
|
||||||
var checkboxTH = tableHeaders[0];
|
const checkboxTH = tableHeaders[0];
|
||||||
checkbox.injectInside(checkboxTH);
|
checkbox.injectInside(checkboxTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var clearData = function() {
|
const clearData = function() {
|
||||||
$('time_elapsed').set('html', '');
|
$('time_elapsed').set('html', '');
|
||||||
$('eta').set('html', '');
|
$('eta').set('html', '');
|
||||||
$('nb_connections').set('html', '');
|
$('nb_connections').set('html', '');
|
||||||
@ -55,14 +55,14 @@ var clearData = function() {
|
|||||||
$('comment').set('html', '');
|
$('comment').set('html', '');
|
||||||
};
|
};
|
||||||
|
|
||||||
var loadTorrentDataTimer;
|
let loadTorrentDataTimer;
|
||||||
var loadTorrentData = function() {
|
const loadTorrentData = function() {
|
||||||
if ($('prop_general').hasClass('invisible')
|
if ($('prop_general').hasClass('invisible')
|
||||||
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
|
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
|
||||||
// Tab changed, don't do anything
|
// Tab changed, don't do anything
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var current_hash = torrentsTable.getCurrentTorrentHash();
|
const current_hash = torrentsTable.getCurrentTorrentHash();
|
||||||
if (current_hash === "") {
|
if (current_hash === "") {
|
||||||
clearData();
|
clearData();
|
||||||
clearTimeout(loadTorrentDataTimer);
|
clearTimeout(loadTorrentDataTimer);
|
||||||
@ -71,7 +71,7 @@ var loadTorrentData = function() {
|
|||||||
}
|
}
|
||||||
// Display hash
|
// Display hash
|
||||||
$('torrent_hash').set('html', current_hash);
|
$('torrent_hash').set('html', current_hash);
|
||||||
var url = new URI('api/v2/torrents/properties?hash=' + current_hash);
|
const url = new URI('api/v2/torrents/properties?hash=' + current_hash);
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
noCache: true,
|
noCache: true,
|
||||||
@ -84,7 +84,7 @@ var loadTorrentData = function() {
|
|||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
$('error_div').set('html', '');
|
$('error_div').set('html', '');
|
||||||
if (data) {
|
if (data) {
|
||||||
var temp;
|
let temp;
|
||||||
// Update Torrent data
|
// Update Torrent data
|
||||||
if (data.seeding_time > 0)
|
if (data.seeding_time > 0)
|
||||||
temp = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]"
|
temp = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]"
|
||||||
@ -193,7 +193,7 @@ var loadTorrentData = function() {
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateTorrentData = function() {
|
updateTorrentData = function() {
|
||||||
clearTimeout(loadTorrentDataTimer);
|
clearTimeout(loadTorrentDataTimer);
|
||||||
loadTorrentData();
|
loadTorrentData();
|
||||||
};
|
};
|
||||||
|
@ -28,17 +28,17 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var loadTorrentPeersTimer;
|
let loadTorrentPeersTimer;
|
||||||
var syncTorrentPeersLastResponseId = 0;
|
let syncTorrentPeersLastResponseId = 0;
|
||||||
var show_flags = true;
|
let show_flags = true;
|
||||||
var loadTorrentPeersData = function() {
|
const loadTorrentPeersData = function() {
|
||||||
if ($('prop_peers').hasClass('invisible')
|
if ($('prop_peers').hasClass('invisible')
|
||||||
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
|
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
|
||||||
syncTorrentPeersLastResponseId = 0;
|
syncTorrentPeersLastResponseId = 0;
|
||||||
torrentPeersTable.clear();
|
torrentPeersTable.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var current_hash = torrentsTable.getCurrentTorrentHash();
|
const current_hash = torrentsTable.getCurrentTorrentHash();
|
||||||
if (current_hash === "") {
|
if (current_hash === "") {
|
||||||
syncTorrentPeersLastResponseId = 0;
|
syncTorrentPeersLastResponseId = 0;
|
||||||
torrentPeersTable.clear();
|
torrentPeersTable.clear();
|
||||||
@ -46,7 +46,7 @@ var loadTorrentPeersData = function() {
|
|||||||
loadTorrentPeersTimer = loadTorrentPeersData.delay(getSyncMainDataInterval());
|
loadTorrentPeersTimer = loadTorrentPeersData.delay(getSyncMainDataInterval());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var url = new URI('api/v2/sync/torrentPeers');
|
const url = new URI('api/v2/sync/torrentPeers');
|
||||||
url.setData('rid', syncTorrentPeersLastResponseId);
|
url.setData('rid', syncTorrentPeersLastResponseId);
|
||||||
url.setData('hash', current_hash);
|
url.setData('hash', current_hash);
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
@ -60,13 +60,13 @@ var loadTorrentPeersData = function() {
|
|||||||
onSuccess: function(response) {
|
onSuccess: function(response) {
|
||||||
$('error_div').set('html', '');
|
$('error_div').set('html', '');
|
||||||
if (response) {
|
if (response) {
|
||||||
var full_update = (response['full_update'] === true);
|
const full_update = (response['full_update'] === true);
|
||||||
if (full_update)
|
if (full_update)
|
||||||
torrentPeersTable.clear();
|
torrentPeersTable.clear();
|
||||||
if (response['rid'])
|
if (response['rid'])
|
||||||
syncTorrentPeersLastResponseId = response['rid'];
|
syncTorrentPeersLastResponseId = response['rid'];
|
||||||
if (response['peers']) {
|
if (response['peers']) {
|
||||||
for (var key in response['peers']) {
|
for (const key in response['peers']) {
|
||||||
response['peers'][key]['rowId'] = key;
|
response['peers'][key]['rowId'] = key;
|
||||||
|
|
||||||
if (response['peers'][key]['client'])
|
if (response['peers'][key]['client'])
|
||||||
|
@ -28,16 +28,16 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var current_hash = "";
|
this.current_hash = "";
|
||||||
|
|
||||||
var loadTrackersDataTimer;
|
let loadTrackersDataTimer;
|
||||||
var loadTrackersData = function() {
|
const loadTrackersData = function() {
|
||||||
if ($('prop_trackers').hasClass('invisible')
|
if ($('prop_trackers').hasClass('invisible')
|
||||||
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
|
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
|
||||||
// Tab changed, don't do anything
|
// Tab changed, don't do anything
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var new_hash = torrentsTable.getCurrentTorrentHash();
|
const new_hash = torrentsTable.getCurrentTorrentHash();
|
||||||
if (new_hash === "") {
|
if (new_hash === "") {
|
||||||
torrentTrackersTable.clear();
|
torrentTrackersTable.clear();
|
||||||
clearTimeout(loadTrackersDataTimer);
|
clearTimeout(loadTrackersDataTimer);
|
||||||
@ -48,7 +48,7 @@ var loadTrackersData = function() {
|
|||||||
torrentTrackersTable.clear();
|
torrentTrackersTable.clear();
|
||||||
current_hash = new_hash;
|
current_hash = new_hash;
|
||||||
}
|
}
|
||||||
var url = new URI('api/v2/torrents/trackers?hash=' + current_hash);
|
const url = new URI('api/v2/torrents/trackers?hash=' + current_hash);
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
noCache: true,
|
noCache: true,
|
||||||
@ -58,13 +58,13 @@ var loadTrackersData = function() {
|
|||||||
loadTrackersDataTimer = loadTrackersData.delay(10000);
|
loadTrackersDataTimer = loadTrackersData.delay(10000);
|
||||||
},
|
},
|
||||||
onSuccess: function(trackers) {
|
onSuccess: function(trackers) {
|
||||||
var selectedTrackers = torrentTrackersTable.selectedRowsIds();
|
const selectedTrackers = torrentTrackersTable.selectedRowsIds();
|
||||||
torrentTrackersTable.clear();
|
torrentTrackersTable.clear();
|
||||||
|
|
||||||
if (trackers) {
|
if (trackers) {
|
||||||
trackers.each(function(tracker) {
|
trackers.each(function(tracker) {
|
||||||
var url = escapeHtml(tracker.url);
|
const url = escapeHtml(tracker.url);
|
||||||
var status;
|
let status;
|
||||||
switch (tracker.status) {
|
switch (tracker.status) {
|
||||||
case 0:
|
case 0:
|
||||||
status = "QBT_TR(Disabled)QBT_TR[CONTEXT=TrackerListWidget]";
|
status = "QBT_TR(Disabled)QBT_TR[CONTEXT=TrackerListWidget]";
|
||||||
@ -83,7 +83,7 @@ var loadTrackersData = function() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var row = {
|
const row = {
|
||||||
rowId: url,
|
rowId: url,
|
||||||
tier: tracker.tier,
|
tier: tracker.tier,
|
||||||
url: url,
|
url: url,
|
||||||
@ -108,12 +108,12 @@ var loadTrackersData = function() {
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateTrackersData = function() {
|
updateTrackersData = function() {
|
||||||
clearTimeout(loadTrackersDataTimer);
|
clearTimeout(loadTrackersDataTimer);
|
||||||
loadTrackersData();
|
loadTrackersData();
|
||||||
};
|
};
|
||||||
|
|
||||||
var torrentTrackersContextMenu = new ContextMenu({
|
const torrentTrackersContextMenu = new ContextMenu({
|
||||||
targets: '#torrentTrackersTableDiv',
|
targets: '#torrentTrackersTableDiv',
|
||||||
menu: 'torrentTrackersMenu',
|
menu: 'torrentTrackersMenu',
|
||||||
actions: {
|
actions: {
|
||||||
@ -134,8 +134,8 @@ var torrentTrackersContextMenu = new ContextMenu({
|
|||||||
y: 2
|
y: 2
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
var selectedTrackers = torrentTrackersTable.selectedRowsIds();
|
const selectedTrackers = torrentTrackersTable.selectedRowsIds();
|
||||||
var containsStaticTracker = selectedTrackers.some(function(tracker) {
|
const containsStaticTracker = selectedTrackers.some(function(tracker) {
|
||||||
return (tracker.indexOf("** [") === 0);
|
return (tracker.indexOf("** [") === 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ var torrentTrackersContextMenu = new ContextMenu({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var addTrackerFN = function() {
|
const addTrackerFN = function() {
|
||||||
if (current_hash.length === 0) return;
|
if (current_hash.length === 0) return;
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'trackersPage',
|
id: 'trackersPage',
|
||||||
@ -173,10 +173,10 @@ var addTrackerFN = function() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var editTrackerFN = function(element) {
|
const editTrackerFN = function(element) {
|
||||||
if (current_hash.length === 0) return;
|
if (current_hash.length === 0) return;
|
||||||
|
|
||||||
var trackerUrl = encodeURIComponent(element.childNodes[1].innerText);
|
const trackerUrl = encodeURIComponent(element.childNodes[1].innerText);
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'trackersPage',
|
id: 'trackersPage',
|
||||||
title: "QBT_TR(Tracker editing)QBT_TR[CONTEXT=TrackerListWidget]",
|
title: "QBT_TR(Tracker editing)QBT_TR[CONTEXT=TrackerListWidget]",
|
||||||
@ -196,10 +196,10 @@ var editTrackerFN = function(element) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var removeTrackerFN = function(element) {
|
const removeTrackerFN = function(element) {
|
||||||
if (current_hash.length === 0) return;
|
if (current_hash.length === 0) return;
|
||||||
|
|
||||||
var selectedTrackers = torrentTrackersTable.selectedRowsIds();
|
const selectedTrackers = torrentTrackersTable.selectedRowsIds();
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/removeTrackers',
|
url: 'api/v2/torrents/removeTrackers',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var webseedsDynTable = new Class({
|
const webseedsDynTable = new Class({
|
||||||
|
|
||||||
initialize: function() {},
|
initialize: function() {},
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ var webseedsDynTable = new Class({
|
|||||||
|
|
||||||
removeRow: function(url) {
|
removeRow: function(url) {
|
||||||
if (this.rows.has(url)) {
|
if (this.rows.has(url)) {
|
||||||
var tr = this.rows.get(url);
|
const tr = this.rows.get(url);
|
||||||
tr.dispose();
|
tr.dispose();
|
||||||
this.rows.erase(url);
|
this.rows.erase(url);
|
||||||
return true;
|
return true;
|
||||||
@ -54,25 +54,25 @@ var webseedsDynTable = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateRow: function(tr, row) {
|
updateRow: function(tr, row) {
|
||||||
var tds = tr.getElements('td');
|
const tds = tr.getElements('td');
|
||||||
for (var i = 0; i < row.length; ++i) {
|
for (let i = 0; i < row.length; ++i) {
|
||||||
tds[i].set('html', row[i]);
|
tds[i].set('html', row[i]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
insertRow: function(row) {
|
insertRow: function(row) {
|
||||||
var url = row[0];
|
const url = row[0];
|
||||||
if (this.rows.has(url)) {
|
if (this.rows.has(url)) {
|
||||||
var tableRow = this.rows.get(url);
|
const tableRow = this.rows.get(url);
|
||||||
this.updateRow(tableRow, row);
|
this.updateRow(tableRow, row);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//this.removeRow(id);
|
//this.removeRow(id);
|
||||||
var tr = new Element('tr');
|
const tr = new Element('tr');
|
||||||
this.rows.set(url, tr);
|
this.rows.set(url, tr);
|
||||||
for (var i = 0; i < row.length; ++i) {
|
for (let i = 0; i < row.length; ++i) {
|
||||||
var td = new Element('td');
|
const td = new Element('td');
|
||||||
td.set('html', row[i]);
|
td.set('html', row[i]);
|
||||||
td.injectInside(tr);
|
td.injectInside(tr);
|
||||||
}
|
}
|
||||||
@ -80,16 +80,16 @@ var webseedsDynTable = new Class({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
var current_hash = "";
|
this.current_hash = "";
|
||||||
|
|
||||||
var loadWebSeedsDataTimer;
|
let loadWebSeedsDataTimer;
|
||||||
var loadWebSeedsData = function() {
|
const loadWebSeedsData = function() {
|
||||||
if ($('prop_webseeds').hasClass('invisible')
|
if ($('prop_webseeds').hasClass('invisible')
|
||||||
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
|
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
|
||||||
// Tab changed, don't do anything
|
// Tab changed, don't do anything
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var new_hash = torrentsTable.getCurrentTorrentHash();
|
const new_hash = torrentsTable.getCurrentTorrentHash();
|
||||||
if (new_hash === "") {
|
if (new_hash === "") {
|
||||||
wsTable.removeAllRows();
|
wsTable.removeAllRows();
|
||||||
clearTimeout(loadWebSeedsDataTimer);
|
clearTimeout(loadWebSeedsDataTimer);
|
||||||
@ -100,7 +100,7 @@ var loadWebSeedsData = function() {
|
|||||||
wsTable.removeAllRows();
|
wsTable.removeAllRows();
|
||||||
current_hash = new_hash;
|
current_hash = new_hash;
|
||||||
}
|
}
|
||||||
var url = new URI('api/v2/torrents/webseeds?hash=' + current_hash);
|
const url = new URI('api/v2/torrents/webseeds?hash=' + current_hash);
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
noCache: true,
|
noCache: true,
|
||||||
@ -115,7 +115,7 @@ var loadWebSeedsData = function() {
|
|||||||
if (webseeds) {
|
if (webseeds) {
|
||||||
// Update WebSeeds data
|
// Update WebSeeds data
|
||||||
webseeds.each(function(webseed) {
|
webseeds.each(function(webseed) {
|
||||||
var row = [];
|
const row = [];
|
||||||
row.length = 1;
|
row.length = 1;
|
||||||
row[0] = webseed.url;
|
row[0] = webseed.url;
|
||||||
wsTable.insertRow(row);
|
wsTable.insertRow(row);
|
||||||
@ -130,10 +130,10 @@ var loadWebSeedsData = function() {
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateWebSeedsData = function() {
|
updateWebSeedsData = function() {
|
||||||
clearTimeout(loadWebSeedsDataTimer);
|
clearTimeout(loadWebSeedsDataTimer);
|
||||||
loadWebSeedsData();
|
loadWebSeedsData();
|
||||||
};
|
};
|
||||||
|
|
||||||
var wsTable = new webseedsDynTable();
|
const wsTable = new webseedsDynTable();
|
||||||
wsTable.setup($('webseedsTable'));
|
wsTable.setup($('webseedsTable'));
|
||||||
|
@ -31,17 +31,17 @@
|
|||||||
MochaUI.extend({
|
MochaUI.extend({
|
||||||
addUpLimitSlider: function(hashes) {
|
addUpLimitSlider: function(hashes) {
|
||||||
if ($('uplimitSliderarea')) {
|
if ($('uplimitSliderarea')) {
|
||||||
var windowOptions = MochaUI.Windows.windowOptions;
|
const windowOptions = MochaUI.Windows.windowOptions;
|
||||||
var sliderFirst = true;
|
const sliderFirst = true;
|
||||||
// Get global upload limit
|
// Get global upload limit
|
||||||
var maximum = 500;
|
let maximum = 500;
|
||||||
var req = new Request({
|
const req = new Request({
|
||||||
url: 'api/v2/transfer/uploadLimit',
|
url: 'api/v2/transfer/uploadLimit',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {},
|
data: {},
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
var tmp = data.toInt();
|
const tmp = data.toInt();
|
||||||
if (tmp > 0) {
|
if (tmp > 0) {
|
||||||
maximum = tmp / 1024.0;
|
maximum = tmp / 1024.0;
|
||||||
}
|
}
|
||||||
@ -55,10 +55,10 @@ MochaUI.extend({
|
|||||||
// Get torrents upload limit
|
// Get torrents upload limit
|
||||||
// And create slider
|
// And create slider
|
||||||
if (hashes[0] == 'global') {
|
if (hashes[0] == 'global') {
|
||||||
var up_limit = maximum;
|
let up_limit = maximum;
|
||||||
if (up_limit < 0) up_limit = 0;
|
if (up_limit < 0) up_limit = 0;
|
||||||
maximum = 10000;
|
maximum = 10000;
|
||||||
var mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
|
const mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
|
||||||
steps: maximum,
|
steps: maximum,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
initialStep: up_limit.round(),
|
initialStep: up_limit.round(),
|
||||||
@ -84,7 +84,7 @@ MochaUI.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var req = new Request.JSON({
|
const req = new Request.JSON({
|
||||||
url: 'api/v2/torrents/uploadLimit',
|
url: 'api/v2/torrents/uploadLimit',
|
||||||
noCache : true,
|
noCache : true,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@ -93,14 +93,14 @@ MochaUI.extend({
|
|||||||
},
|
},
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
var up_limit = data[hashes[0]];
|
let up_limit = data[hashes[0]];
|
||||||
for(var key in data)
|
for(const key in data)
|
||||||
if (up_limit != data[key]) {
|
if (up_limit != data[key]) {
|
||||||
up_limit = 0;
|
up_limit = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (up_limit < 0) up_limit = 0;
|
if (up_limit < 0) up_limit = 0;
|
||||||
var mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
|
const mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
|
||||||
steps: maximum,
|
steps: maximum,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
initialStep: (up_limit / 1024.0).round(),
|
initialStep: (up_limit / 1024.0).round(),
|
||||||
@ -135,17 +135,17 @@ MochaUI.extend({
|
|||||||
|
|
||||||
addDlLimitSlider: function(hashes) {
|
addDlLimitSlider: function(hashes) {
|
||||||
if ($('dllimitSliderarea')) {
|
if ($('dllimitSliderarea')) {
|
||||||
var windowOptions = MochaUI.Windows.windowOptions;
|
const windowOptions = MochaUI.Windows.windowOptions;
|
||||||
var sliderFirst = true;
|
const sliderFirst = true;
|
||||||
// Get global upload limit
|
// Get global upload limit
|
||||||
var maximum = 500;
|
let maximum = 500;
|
||||||
var req = new Request({
|
const req = new Request({
|
||||||
url: 'api/v2/transfer/downloadLimit',
|
url: 'api/v2/transfer/downloadLimit',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {},
|
data: {},
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
var tmp = data.toInt();
|
const tmp = data.toInt();
|
||||||
if (tmp > 0) {
|
if (tmp > 0) {
|
||||||
maximum = tmp / 1024.0;
|
maximum = tmp / 1024.0;
|
||||||
}
|
}
|
||||||
@ -159,10 +159,10 @@ MochaUI.extend({
|
|||||||
// Get torrents download limit
|
// Get torrents download limit
|
||||||
// And create slider
|
// And create slider
|
||||||
if (hashes[0] == 'global') {
|
if (hashes[0] == 'global') {
|
||||||
var dl_limit = maximum;
|
let dl_limit = maximum;
|
||||||
if (dl_limit < 0) dl_limit = 0;
|
if (dl_limit < 0) dl_limit = 0;
|
||||||
maximum = 10000;
|
maximum = 10000;
|
||||||
var mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
|
const mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
|
||||||
steps: maximum,
|
steps: maximum,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
initialStep: dl_limit.round(),
|
initialStep: dl_limit.round(),
|
||||||
@ -188,7 +188,7 @@ MochaUI.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var req = new Request.JSON({
|
const req = new Request.JSON({
|
||||||
url: 'api/v2/torrents/downloadLimit',
|
url: 'api/v2/torrents/downloadLimit',
|
||||||
noCache : true,
|
noCache : true,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@ -197,14 +197,14 @@ MochaUI.extend({
|
|||||||
},
|
},
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
var dl_limit = data[hashes[0]];
|
let dl_limit = data[hashes[0]];
|
||||||
for(var key in data)
|
for(const key in data)
|
||||||
if (dl_limit != data[key]) {
|
if (dl_limit != data[key]) {
|
||||||
dl_limit = 0;
|
dl_limit = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (dl_limit < 0) dl_limit = 0;
|
if (dl_limit < 0) dl_limit = 0;
|
||||||
var mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
|
const mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
|
||||||
steps: maximum,
|
steps: maximum,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
initialStep: (dl_limit / 1024.0).round(),
|
initialStep: (dl_limit / 1024.0).round(),
|
||||||
|
@ -153,42 +153,42 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var loadSearchResultsTimer;
|
let loadSearchResultsTimer;
|
||||||
var loadSearchPluginsTimer;
|
let loadSearchPluginsTimer;
|
||||||
var searchResultsRowId = 0;
|
let searchResultsRowId = 0;
|
||||||
var searchRunning = false;
|
let searchRunning = false;
|
||||||
var requestCount = 0;
|
let requestCount = 0;
|
||||||
var searchPlugins = [];
|
let searchPlugins = [];
|
||||||
var prevSearchPluginsResponse;
|
let prevSearchPluginsResponse;
|
||||||
var searchPattern = "";
|
let searchPattern = "";
|
||||||
var searchFilterPattern = "";
|
let searchFilterPattern = "";
|
||||||
var searchSeedsFilter = {
|
const searchSeedsFilter = {
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 0
|
max: 0
|
||||||
};
|
};
|
||||||
var searchSizeFilter = {
|
const searchSizeFilter = {
|
||||||
min: 0.00,
|
min: 0.00,
|
||||||
minUnit: 2, // B = 0, KiB = 1, MiB = 2, GiB = 3, TiB = 4, PiB = 5, EiB = 6
|
minUnit: 2, // B = 0, KiB = 1, MiB = 2, GiB = 3, TiB = 4, PiB = 5, EiB = 6
|
||||||
max: 0.00,
|
max: 0.00,
|
||||||
maxUnit: 3
|
maxUnit: 3
|
||||||
};
|
};
|
||||||
var prevNameFilterValue;
|
let prevNameFilterValue;
|
||||||
var selectedCategory = "QBT_TR(All categories)QBT_TR[CONTEXT=SearchEngineWidget]";
|
let selectedCategory = "QBT_TR(All categories)QBT_TR[CONTEXT=SearchEngineWidget]";
|
||||||
var selectedPlugin = "all";
|
let selectedPlugin = "all";
|
||||||
var prevSelectedPlugin;
|
let prevSelectedPlugin;
|
||||||
var activeSearchId = null;
|
let activeSearchId = null;
|
||||||
|
|
||||||
var initSearchTab = function() {
|
const initSearchTab = function() {
|
||||||
// load "Search in" preference from local storage
|
// load "Search in" preference from local storage
|
||||||
$('searchInTorrentName').set('value', (localStorage.getItem('search_in_filter') === "names") ? "names" : "everywhere");
|
$('searchInTorrentName').set('value', (localStorage.getItem('search_in_filter') === "names") ? "names" : "everywhere");
|
||||||
|
|
||||||
searchResultsTable.setup('searchResultsTableDiv', 'searchResultsTableFixedHeaderDiv', null);
|
searchResultsTable.setup('searchResultsTableDiv', 'searchResultsTableFixedHeaderDiv', null);
|
||||||
getPlugins();
|
getPlugins();
|
||||||
|
|
||||||
var searchInNameFilterTimer = null;
|
let searchInNameFilterTimer = null;
|
||||||
// listen for changes to searchInNameFilter
|
// listen for changes to searchInNameFilter
|
||||||
$('searchInNameFilter').addEvent('input', function() {
|
$('searchInNameFilter').addEvent('input', function() {
|
||||||
var value = $('searchInNameFilter').get("value");
|
const value = $('searchInNameFilter').get("value");
|
||||||
if (value !== prevNameFilterValue) {
|
if (value !== prevNameFilterValue) {
|
||||||
prevNameFilterValue = value;
|
prevNameFilterValue = value;
|
||||||
clearTimeout(searchInNameFilterTimer);
|
clearTimeout(searchInNameFilterTimer);
|
||||||
@ -206,7 +206,7 @@
|
|||||||
// accept enter key as a click
|
// accept enter key as a click
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
var elem = e.event.srcElement;
|
const elem = e.event.srcElement;
|
||||||
if (elem.className.contains("searchInputField")) {
|
if (elem.className.contains("searchInputField")) {
|
||||||
$('startSearchButton').click();
|
$('startSearchButton').click();
|
||||||
return;
|
return;
|
||||||
@ -231,7 +231,7 @@
|
|||||||
}).activate();
|
}).activate();
|
||||||
};
|
};
|
||||||
|
|
||||||
var startSearch = function(pattern, category, plugins) {
|
const startSearch = function(pattern, category, plugins) {
|
||||||
clearTimeout(loadSearchResultsTimer);
|
clearTimeout(loadSearchResultsTimer);
|
||||||
searchResultsTable.clear();
|
searchResultsTable.clear();
|
||||||
$('numSearchResultsVisible').set('html', searchResultsTable.getFilteredAndSortedRows().length);
|
$('numSearchResultsVisible').set('html', searchResultsTable.getFilteredAndSortedRows().length);
|
||||||
@ -239,7 +239,7 @@
|
|||||||
searchResultsRowId = 0;
|
searchResultsRowId = 0;
|
||||||
requestCount = 0;
|
requestCount = 0;
|
||||||
|
|
||||||
var url = new URI('api/v2/search/start');
|
const url = new URI('api/v2/search/start');
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
noCache: true,
|
noCache: true,
|
||||||
@ -258,8 +258,8 @@
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var stopSearch = function() {
|
const stopSearch = function() {
|
||||||
var url = new URI('api/v2/search/stop');
|
const url = new URI('api/v2/search/stop');
|
||||||
new Request({
|
new Request({
|
||||||
url: url,
|
url: url,
|
||||||
noCache: true,
|
noCache: true,
|
||||||
@ -273,11 +273,11 @@
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var startStopSearch = function() {
|
const startStopSearch = function() {
|
||||||
if (!searchRunning || !activeSearchId) {
|
if (!searchRunning || !activeSearchId) {
|
||||||
var pattern = $('searchPattern').getProperty('value').trim();
|
const pattern = $('searchPattern').getProperty('value').trim();
|
||||||
var category = $('categorySelect').getProperty('value');
|
let category = $('categorySelect').getProperty('value');
|
||||||
var plugins = $('pluginsSelect').getProperty('value');
|
const plugins = $('pluginsSelect').getProperty('value');
|
||||||
|
|
||||||
if (!pattern || !category || !plugins) return;
|
if (!pattern || !category || !plugins) return;
|
||||||
if (category === "QBT_TR(All categories)QBT_TR[CONTEXT=SearchEngineWidget]")
|
if (category === "QBT_TR(All categories)QBT_TR[CONTEXT=SearchEngineWidget]")
|
||||||
@ -293,22 +293,22 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var openSearchTorrentDescription = function() {
|
const openSearchTorrentDescription = function() {
|
||||||
searchResultsTable.selectedRowsIds().each(function(rowId) {
|
searchResultsTable.selectedRowsIds().each(function(rowId) {
|
||||||
window.open(searchResultsTable.rows.get(rowId).full_data.descrLink, "_blank");
|
window.open(searchResultsTable.rows.get(rowId).full_data.descrLink, "_blank");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var copySearchTorrentUrl = function() {
|
const copySearchTorrentUrl = function() {
|
||||||
var urls = [];
|
const urls = [];
|
||||||
searchResultsTable.selectedRowsIds().each(function(rowId) {
|
searchResultsTable.selectedRowsIds().each(function(rowId) {
|
||||||
urls.push(searchResultsTable.rows.get(rowId).full_data.descrLink);
|
urls.push(searchResultsTable.rows.get(rowId).full_data.descrLink);
|
||||||
});
|
});
|
||||||
return urls.join("\n");
|
return urls.join("\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
var downloadSearchTorrent = function() {
|
const downloadSearchTorrent = function() {
|
||||||
var urls = [];
|
const urls = [];
|
||||||
searchResultsTable.selectedRowsIds().each(function(rowId) {
|
searchResultsTable.selectedRowsIds().each(function(rowId) {
|
||||||
urls.push(encodeURIComponent(searchResultsTable.rows.get(rowId).full_data.fileUrl));
|
urls.push(encodeURIComponent(searchResultsTable.rows.get(rowId).full_data.fileUrl));
|
||||||
});
|
});
|
||||||
@ -319,8 +319,8 @@
|
|||||||
showDownloadPage(urls);
|
showDownloadPage(urls);
|
||||||
};
|
};
|
||||||
|
|
||||||
var manageSearchPlugins = function() {
|
const manageSearchPlugins = function() {
|
||||||
var id = 'searchPlugins';
|
const id = 'searchPlugins';
|
||||||
if (!$(id))
|
if (!$(id))
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: id,
|
id: id,
|
||||||
@ -345,16 +345,16 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var loadSearchPlugins = function() {
|
const loadSearchPlugins = function() {
|
||||||
getPlugins();
|
getPlugins();
|
||||||
loadSearchPluginsTimer = loadSearchPlugins.delay(2000);
|
loadSearchPluginsTimer = loadSearchPlugins.delay(2000);
|
||||||
};
|
};
|
||||||
|
|
||||||
var categorySelected = function() {
|
const categorySelected = function() {
|
||||||
selectedCategory = $("categorySelect").get("value");
|
selectedCategory = $("categorySelect").get("value");
|
||||||
};
|
};
|
||||||
|
|
||||||
var pluginSelected = function() {
|
const pluginSelected = function() {
|
||||||
selectedPlugin = $("pluginsSelect").get("value");
|
selectedPlugin = $("pluginsSelect").get("value");
|
||||||
|
|
||||||
if (selectedPlugin !== prevSelectedPlugin) {
|
if (selectedPlugin !== prevSelectedPlugin) {
|
||||||
@ -363,23 +363,23 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var reselectCategory = function() {
|
const reselectCategory = function() {
|
||||||
for (var i = 0; i < $("categorySelect").options.length; ++i)
|
for (let i = 0; i < $("categorySelect").options.length; ++i)
|
||||||
if ($("categorySelect").options[i].get("value") === selectedCategory)
|
if ($("categorySelect").options[i].get("value") === selectedCategory)
|
||||||
$("categorySelect").options[i].selected = true;
|
$("categorySelect").options[i].selected = true;
|
||||||
|
|
||||||
categorySelected();
|
categorySelected();
|
||||||
};
|
};
|
||||||
|
|
||||||
var reselectPlugin = function() {
|
const reselectPlugin = function() {
|
||||||
for (var i = 0; i < $("pluginsSelect").options.length; ++i)
|
for (let i = 0; i < $("pluginsSelect").options.length; ++i)
|
||||||
if ($("pluginsSelect").options[i].get("value") === selectedPlugin)
|
if ($("pluginsSelect").options[i].get("value") === selectedPlugin)
|
||||||
$("pluginsSelect").options[i].selected = true;
|
$("pluginsSelect").options[i].selected = true;
|
||||||
|
|
||||||
pluginSelected();
|
pluginSelected();
|
||||||
};
|
};
|
||||||
|
|
||||||
var resetSearchState = function() {
|
const resetSearchState = function() {
|
||||||
clearTimeout(loadSearchResultsTimer);
|
clearTimeout(loadSearchResultsTimer);
|
||||||
$('startSearchButton').set('text', 'QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]');
|
$('startSearchButton').set('text', 'QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]');
|
||||||
searchResultsRowId = 0;
|
searchResultsRowId = 0;
|
||||||
@ -387,9 +387,9 @@
|
|||||||
activeSearchId = null;
|
activeSearchId = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
var getSearchCategories = function() {
|
const getSearchCategories = function() {
|
||||||
var populateCategorySelect = function(categories) {
|
const populateCategorySelect = function(categories) {
|
||||||
var categoryHtml = [];
|
const categoryHtml = [];
|
||||||
categories.each(function(category) {
|
categories.each(function(category) {
|
||||||
categoryHtml.push("<option>" + category + "</option>");
|
categoryHtml.push("<option>" + category + "</option>");
|
||||||
});
|
});
|
||||||
@ -402,9 +402,9 @@
|
|||||||
$('categorySelect').set('html', categoryHtml.join(""));
|
$('categorySelect').set('html', categoryHtml.join(""));
|
||||||
};
|
};
|
||||||
|
|
||||||
var selectedPlugin = $('pluginsSelect').get("value");
|
const selectedPlugin = $('pluginsSelect').get("value");
|
||||||
if ((selectedPlugin === "all") || (selectedPlugin === "enabled")) {
|
if ((selectedPlugin === "all") || (selectedPlugin === "enabled")) {
|
||||||
var url = new URI('api/v2/search/categories');
|
const url = new URI('api/v2/search/categories');
|
||||||
url.setData('name', selectedPlugin);
|
url.setData('name', selectedPlugin);
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
@ -416,8 +416,8 @@
|
|||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var plugins = ["QBT_TR(All categories)QBT_TR[CONTEXT=SearchEngineWidget]"];
|
let plugins = ["QBT_TR(All categories)QBT_TR[CONTEXT=SearchEngineWidget]"];
|
||||||
var plugin = getPlugin(selectedPlugin);
|
const plugin = getPlugin(selectedPlugin);
|
||||||
if (plugin !== null)
|
if (plugin !== null)
|
||||||
plugins = plugins.concat(plugin.supportedCategories);
|
plugins = plugins.concat(plugin.supportedCategories);
|
||||||
|
|
||||||
@ -427,7 +427,7 @@
|
|||||||
reselectCategory();
|
reselectCategory();
|
||||||
};
|
};
|
||||||
|
|
||||||
var getPlugins = function() {
|
const getPlugins = function() {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: new URI('api/v2/search/plugins'),
|
url: new URI('api/v2/search/plugins'),
|
||||||
noCache: true,
|
noCache: true,
|
||||||
@ -437,11 +437,11 @@
|
|||||||
prevSearchPluginsResponse = response;
|
prevSearchPluginsResponse = response;
|
||||||
searchPlugins = response;
|
searchPlugins = response;
|
||||||
|
|
||||||
var pluginsHtml = [];
|
const pluginsHtml = [];
|
||||||
pluginsHtml.push('<option value="enabled">QBT_TR(Only enabled)QBT_TR[CONTEXT=SearchEngineWidget]</option>');
|
pluginsHtml.push('<option value="enabled">QBT_TR(Only enabled)QBT_TR[CONTEXT=SearchEngineWidget]</option>');
|
||||||
pluginsHtml.push('<option value="all">QBT_TR(All plugins)QBT_TR[CONTEXT=SearchEngineWidget]</option>');
|
pluginsHtml.push('<option value="all">QBT_TR(All plugins)QBT_TR[CONTEXT=SearchEngineWidget]</option>');
|
||||||
|
|
||||||
var searchPluginsEmpty = (searchPlugins.length === 0);
|
const searchPluginsEmpty = (searchPlugins.length === 0);
|
||||||
if (searchPluginsEmpty) {
|
if (searchPluginsEmpty) {
|
||||||
$('searchResultsNoPlugins').style.display = "block";
|
$('searchResultsNoPlugins').style.display = "block";
|
||||||
$('searchResultsFilters').style.display = "none";
|
$('searchResultsFilters').style.display = "none";
|
||||||
@ -453,9 +453,9 @@
|
|||||||
$('searchResultsTableContainer').style.display = "block";
|
$('searchResultsTableContainer').style.display = "block";
|
||||||
|
|
||||||
// sort plugins alphabetically
|
// sort plugins alphabetically
|
||||||
var allPlugins = searchPlugins.sort(function(pluginA, pluginB) {
|
const allPlugins = searchPlugins.sort(function(pluginA, pluginB) {
|
||||||
var a = pluginA.fullName.toLowerCase();
|
const a = pluginA.fullName.toLowerCase();
|
||||||
var b = pluginB.fullName.toLowerCase();
|
const b = pluginB.fullName.toLowerCase();
|
||||||
if (a < b) return -1;
|
if (a < b) return -1;
|
||||||
if (a > b) return 1;
|
if (a > b) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
@ -489,15 +489,15 @@
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var getPlugin = function(name) {
|
const getPlugin = function(name) {
|
||||||
for (var i = 0; i < searchPlugins.length; ++i)
|
for (let i = 0; i < searchPlugins.length; ++i)
|
||||||
if (searchPlugins[i].name === name)
|
if (searchPlugins[i].name === name)
|
||||||
return searchPlugins[i];
|
return searchPlugins[i];
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
var searchInTorrentName = function() {
|
const searchInTorrentName = function() {
|
||||||
if ($('searchInTorrentName').get('value') === "names")
|
if ($('searchInTorrentName').get('value') === "names")
|
||||||
localStorage.setItem('search_in_filter', "names");
|
localStorage.setItem('search_in_filter', "names");
|
||||||
else
|
else
|
||||||
@ -506,7 +506,7 @@
|
|||||||
searchFilterChanged();
|
searchFilterChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
var resetFilters = function() {
|
const resetFilters = function() {
|
||||||
// reset filters
|
// reset filters
|
||||||
$('searchMinSeedsFilter').set('value', '0');
|
$('searchMinSeedsFilter').set('value', '0');
|
||||||
$('searchMaxSeedsFilter').set('value', '0');
|
$('searchMaxSeedsFilter').set('value', '0');
|
||||||
@ -516,14 +516,14 @@
|
|||||||
$('searchMaxSizePrefix').set('value', '3'); // GiB
|
$('searchMaxSizePrefix').set('value', '3'); // GiB
|
||||||
};
|
};
|
||||||
|
|
||||||
var searchSeedsFilterChanged = function() {
|
const searchSeedsFilterChanged = function() {
|
||||||
searchSeedsFilter.min = $('searchMinSeedsFilter').get('value');
|
searchSeedsFilter.min = $('searchMinSeedsFilter').get('value');
|
||||||
searchSeedsFilter.max = $('searchMaxSeedsFilter').get('value');
|
searchSeedsFilter.max = $('searchMaxSeedsFilter').get('value');
|
||||||
|
|
||||||
searchFilterChanged();
|
searchFilterChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
var searchSizeFilterChanged = function() {
|
const searchSizeFilterChanged = function() {
|
||||||
searchSizeFilter.min = $('searchMinSizeFilter').get('value');
|
searchSizeFilter.min = $('searchMinSizeFilter').get('value');
|
||||||
searchSizeFilter.minUnit = $('searchMinSizePrefix').get('value');
|
searchSizeFilter.minUnit = $('searchMinSizePrefix').get('value');
|
||||||
searchSizeFilter.max = $('searchMaxSizeFilter').get('value');
|
searchSizeFilter.max = $('searchMaxSizeFilter').get('value');
|
||||||
@ -532,17 +532,17 @@
|
|||||||
searchFilterChanged();
|
searchFilterChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
var searchSizeFilterPrefixChanged = function() {
|
const searchSizeFilterPrefixChanged = function() {
|
||||||
if (($('searchMinSizeFilter').get('value') != 0) || ($('searchMaxSizeFilter').get('value') != 0))
|
if (($('searchMinSizeFilter').get('value') != 0) || ($('searchMaxSizeFilter').get('value') != 0))
|
||||||
searchSizeFilterChanged();
|
searchSizeFilterChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
var searchFilterChanged = function() {
|
const searchFilterChanged = function() {
|
||||||
searchResultsTable.updateTable();
|
searchResultsTable.updateTable();
|
||||||
$('numSearchResultsVisible').set('html', searchResultsTable.getFilteredAndSortedRows().length);
|
$('numSearchResultsVisible').set('html', searchResultsTable.getFilteredAndSortedRows().length);
|
||||||
};
|
};
|
||||||
|
|
||||||
var setupSearchTableEvents = function(enable) {
|
const setupSearchTableEvents = function(enable) {
|
||||||
if (enable)
|
if (enable)
|
||||||
$$(".searchTableRow").each(function(target) {
|
$$(".searchTableRow").each(function(target) {
|
||||||
target.addEventListener('dblclick', downloadSearchTorrent, false);
|
target.addEventListener('dblclick', downloadSearchTorrent, false);
|
||||||
@ -553,9 +553,9 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var loadSearchResultsData = function() {
|
const loadSearchResultsData = function() {
|
||||||
var maxResults = 500;
|
const maxResults = 500;
|
||||||
var url = new URI('api/v2/search/results');
|
const url = new URI('api/v2/search/results');
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
noCache: true,
|
noCache: true,
|
||||||
@ -589,10 +589,10 @@
|
|||||||
setupSearchTableEvents(false);
|
setupSearchTableEvents(false);
|
||||||
|
|
||||||
if (response.results) {
|
if (response.results) {
|
||||||
var results = response.results;
|
const results = response.results;
|
||||||
for (var i = 0; i < results.length; ++i) {
|
for (let i = 0; i < results.length; ++i) {
|
||||||
var result = results[i];
|
const result = results[i];
|
||||||
var row = {
|
const row = {
|
||||||
rowId: searchResultsRowId,
|
rowId: searchResultsRowId,
|
||||||
descrLink: result.descrLink,
|
descrLink: result.descrLink,
|
||||||
fileName: result.fileName,
|
fileName: result.fileName,
|
||||||
@ -622,7 +622,7 @@
|
|||||||
setupSearchTableEvents(true);
|
setupSearchTableEvents(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeout = 1000;
|
let timeout = 1000;
|
||||||
if (requestCount > 30)
|
if (requestCount > 30)
|
||||||
timeout = 3000;
|
timeout = 3000;
|
||||||
else if (requestCount > 10)
|
else if (requestCount > 10)
|
||||||
@ -635,7 +635,7 @@
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateSearchResultsData = function() {
|
const updateSearchResultsData = function() {
|
||||||
clearTimeout(loadSearchResultsTimer);
|
clearTimeout(loadSearchResultsTimer);
|
||||||
loadSearchResultsTimer = loadSearchResultsData.delay(500);
|
loadSearchResultsTimer = loadSearchResultsData.delay(500);
|
||||||
};
|
};
|
||||||
|
@ -79,11 +79,11 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var searchPluginsTableContextMenu;
|
this.searchPluginsTableContextMenu = undefined;
|
||||||
var prevOffsetLeft;
|
this.prevOffsetLeft = undefined;
|
||||||
var prevOffsetTop;
|
this.prevOffsetTop = undefined;
|
||||||
|
|
||||||
var initSearchPlugins = function() {
|
this.initSearchPlugins = function() {
|
||||||
searchPluginsTableContextMenu = new SearchPluginsTableContextMenu({
|
searchPluginsTableContextMenu = new SearchPluginsTableContextMenu({
|
||||||
targets: '.searchPluginsTableRow',
|
targets: '.searchPluginsTableRow',
|
||||||
menu: 'searchPluginsTableMenu',
|
menu: 'searchPluginsTableMenu',
|
||||||
@ -97,11 +97,11 @@
|
|||||||
updateSearchPluginsTable();
|
updateSearchPluginsTable();
|
||||||
};
|
};
|
||||||
|
|
||||||
var closeSearchWindow = function(id) {
|
this.closeSearchWindow = function(id) {
|
||||||
window.parent.MochaUI.closeWindow(window.parent.$(id));
|
window.parent.MochaUI.closeWindow(window.parent.$(id));
|
||||||
};
|
};
|
||||||
|
|
||||||
var installPlugin = function(path) {
|
this.installPlugin = function(path) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'installSearchPlugin',
|
id: 'installSearchPlugin',
|
||||||
title: "QBT_TR(Install plugin)QBT_TR[CONTEXT=PluginSourceDlg]",
|
title: "QBT_TR(Install plugin)QBT_TR[CONTEXT=PluginSourceDlg]",
|
||||||
@ -117,9 +117,9 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var uninstallPlugin = function() {
|
this.uninstallPlugin = function() {
|
||||||
var plugins = searchPluginsTable.selectedRowsIds().join('|');
|
const plugins = searchPluginsTable.selectedRowsIds().join('|');
|
||||||
var url = new URI('api/v2/search/uninstallPlugin');
|
const url = new URI('api/v2/search/uninstallPlugin');
|
||||||
new Request({
|
new Request({
|
||||||
url: url,
|
url: url,
|
||||||
noCache: true,
|
noCache: true,
|
||||||
@ -130,13 +130,13 @@
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var enablePlugin = function() {
|
this.enablePlugin = function() {
|
||||||
var plugins = searchPluginsTable.selectedRowsIds();
|
const plugins = searchPluginsTable.selectedRowsIds();
|
||||||
var enable = true;
|
let enable = true;
|
||||||
if (plugins && plugins.length)
|
if (plugins && plugins.length)
|
||||||
enable = !getPlugin(plugins[0]).enabled;
|
enable = !getPlugin(plugins[0]).enabled;
|
||||||
|
|
||||||
var url = new URI('api/v2/search/enablePlugin');
|
const url = new URI('api/v2/search/enablePlugin');
|
||||||
new Request({
|
new Request({
|
||||||
url: url,
|
url: url,
|
||||||
noCache: true,
|
noCache: true,
|
||||||
@ -148,8 +148,8 @@
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var checkForUpdates = function() {
|
this.checkForUpdates = function() {
|
||||||
var url = new URI('api/v2/search/updatePlugins');
|
const url = new URI('api/v2/search/updatePlugins');
|
||||||
new Request({
|
new Request({
|
||||||
url: url,
|
url: url,
|
||||||
noCache: true,
|
noCache: true,
|
||||||
@ -157,7 +157,7 @@
|
|||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
var calculateContextMenuOffsets = function() {
|
this.calculateContextMenuOffsets = function() {
|
||||||
prevOffsetLeft = document.getElementById("searchPlugins").getBoundingClientRect().left;
|
prevOffsetLeft = document.getElementById("searchPlugins").getBoundingClientRect().left;
|
||||||
prevOffsetTop = document.getElementById("searchPlugins").getBoundingClientRect().top;
|
prevOffsetTop = document.getElementById("searchPlugins").getBoundingClientRect().top;
|
||||||
|
|
||||||
@ -167,13 +167,13 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateSearchPluginsTableContextMenuOffset = function() {
|
this.updateSearchPluginsTableContextMenuOffset = function() {
|
||||||
// only re-calculate if window has moved
|
// only re-calculate if window has moved
|
||||||
if ((prevOffsetLeft !== document.getElementById("searchPlugins").getBoundingClientRect().left) || (prevOffsetTop !== document.getElementById("searchPlugins").getBoundingClientRect().top))
|
if ((prevOffsetLeft !== document.getElementById("searchPlugins").getBoundingClientRect().left) || (prevOffsetTop !== document.getElementById("searchPlugins").getBoundingClientRect().top))
|
||||||
searchPluginsTableContextMenu.options.offsets = calculateContextMenuOffsets();
|
searchPluginsTableContextMenu.options.offsets = calculateContextMenuOffsets();
|
||||||
};
|
};
|
||||||
|
|
||||||
var setupSearchPluginTableEvents = function(enable) {
|
this.setupSearchPluginTableEvents = function(enable) {
|
||||||
if (enable)
|
if (enable)
|
||||||
$$(".searchPluginsTableRow").each(function(target) {
|
$$(".searchPluginsTableRow").each(function(target) {
|
||||||
target.addEventListener('dblclick', enablePlugin, false);
|
target.addEventListener('dblclick', enablePlugin, false);
|
||||||
@ -186,15 +186,15 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateSearchPluginsTable = function() {
|
this.updateSearchPluginsTable = function() {
|
||||||
// clear event listeners
|
// clear event listeners
|
||||||
setupSearchPluginTableEvents(false);
|
setupSearchPluginTableEvents(false);
|
||||||
|
|
||||||
var oldPlugins = Object.keys(searchPluginsTable.rows);
|
const oldPlugins = Object.keys(searchPluginsTable.rows);
|
||||||
// remove old rows from the table
|
// remove old rows from the table
|
||||||
for (var i = 0; i < oldPlugins.length; ++i) {
|
for (let i = 0; i < oldPlugins.length; ++i) {
|
||||||
var found = false;
|
let found = false;
|
||||||
for (var j = 0; j < searchPlugins.length; ++j) {
|
for (let j = 0; j < searchPlugins.length; ++j) {
|
||||||
if (searchPlugins[j].name === oldPlugins[i]) {
|
if (searchPlugins[j].name === oldPlugins[i]) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
@ -204,7 +204,7 @@
|
|||||||
searchPluginsTable.removeRow(oldPlugins[i]);
|
searchPluginsTable.removeRow(oldPlugins[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < searchPlugins.length; ++i) {
|
for (let i = 0; i < searchPlugins.length; ++i) {
|
||||||
searchPlugins[i].rowId = searchPlugins[i].name;
|
searchPlugins[i].rowId = searchPlugins[i].name;
|
||||||
searchPluginsTable.updateRowData(searchPlugins[i]);
|
searchPluginsTable.updateRowData(searchPlugins[i]);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent('domready', function() {
|
||||||
var path = new URI().getData('path');
|
const path = new URI().getData('path');
|
||||||
// set text field to current value
|
// set text field to current value
|
||||||
if (path)
|
if (path)
|
||||||
$('setLocation').value = escapeHtml(decodeURIComponent(path));
|
$('setLocation').value = escapeHtml(decodeURIComponent(path));
|
||||||
@ -39,13 +39,13 @@
|
|||||||
$('setLocationButton').addEvent('click', function(e) {
|
$('setLocationButton').addEvent('click', function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
// check field
|
// check field
|
||||||
var location = $('setLocation').value.trim();
|
const location = $('setLocation').value.trim();
|
||||||
if (location === null || location === "") {
|
if (location === null || location === "") {
|
||||||
$('error_div').set('text', 'QBT_TR(Save path is empty)QBT_TR[CONTEXT=TorrentsController]');
|
$('error_div').set('text', 'QBT_TR(Save path is empty)QBT_TR[CONTEXT=TorrentsController]');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var hashesList = new URI().getData('hashes');
|
const hashesList = new URI().getData('hashes');
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/setLocation',
|
url: 'api/v2/torrents/setLocation',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var UseGlobalLimit = -2;
|
const UseGlobalLimit = -2;
|
||||||
var NoLimit = -1;
|
const NoLimit = -1;
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: 'keydown',
|
||||||
@ -33,10 +33,10 @@
|
|||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent('domready', function() {
|
||||||
var hashesList = new URI().getData('hashes').split('|');
|
const hashesList = new URI().getData('hashes').split('|');
|
||||||
var origValues = new URI().getData('orig').split('|');
|
const origValues = new URI().getData('orig').split('|');
|
||||||
|
|
||||||
var values = {
|
const values = {
|
||||||
ratioLimit: friendlyFloat(origValues[0], 2),
|
ratioLimit: friendlyFloat(origValues[0], 2),
|
||||||
seedingTimeLimit: parseInt(origValues[1]),
|
seedingTimeLimit: parseInt(origValues[1]),
|
||||||
maxRatio: friendlyFloat(origValues[2], 2),
|
maxRatio: friendlyFloat(origValues[2], 2),
|
||||||
@ -74,9 +74,9 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var shareLimit = getSelectedRadioValue('shareLimit');
|
const shareLimit = getSelectedRadioValue('shareLimit');
|
||||||
var ratioLimitValue = 0.00;
|
let ratioLimitValue = 0.00;
|
||||||
var seedingTimeLimitValue = 0;
|
let seedingTimeLimitValue = 0;
|
||||||
|
|
||||||
if (shareLimit === 'default') {
|
if (shareLimit === 'default') {
|
||||||
ratioLimitValue = seedingTimeLimitValue = UseGlobalLimit;
|
ratioLimitValue = seedingTimeLimitValue = UseGlobalLimit;
|
||||||
@ -108,10 +108,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function getSelectedRadioValue(name) {
|
function getSelectedRadioValue(name) {
|
||||||
var radios = document.getElementsByName(name);
|
const radios = document.getElementsByName(name);
|
||||||
|
|
||||||
for (var i = 0; i < radios.length; ++i) {
|
for (let i = 0; i < radios.length; ++i) {
|
||||||
var radio = radios[i];
|
const radio = radios[i];
|
||||||
if (radio.checked) {
|
if (radio.checked) {
|
||||||
return (radio).get('value');
|
return (radio).get('value');
|
||||||
}
|
}
|
||||||
@ -119,17 +119,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setSelectedRadioValue(name, value) {
|
function setSelectedRadioValue(name, value) {
|
||||||
var radios = document.getElementsByName(name);
|
const radios = document.getElementsByName(name);
|
||||||
|
|
||||||
for (var i = 0; i < radios.length; ++i) {
|
for (let i = 0; i < radios.length; ++i) {
|
||||||
var radio = radios[i];
|
const radio = radios[i];
|
||||||
if (radio.value === value)
|
if (radio.value === value)
|
||||||
radio.checked = true;
|
radio.checked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function shareLimitChanged() {
|
function shareLimitChanged() {
|
||||||
var customShareLimit = getSelectedRadioValue('shareLimit') === 'custom';
|
const customShareLimit = getSelectedRadioValue('shareLimit') === 'custom';
|
||||||
$('setRatio').set('disabled', !customShareLimit);
|
$('setRatio').set('disabled', !customShareLimit);
|
||||||
$('setMinutes').set('disabled', !customShareLimit);
|
$('setMinutes').set('disabled', !customShareLimit);
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
//create a context menu
|
//create a context menu
|
||||||
var torrentsTableContextMenu = new TorrentsTableContextMenu({
|
const torrentsTableContextMenu = new TorrentsTableContextMenu({
|
||||||
targets: '.torrentsTableContextMenuTarget',
|
targets: '.torrentsTableContextMenuTarget',
|
||||||
menu: 'torrentsTableMenu',
|
menu: 'torrentsTableMenu',
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -127,7 +127,7 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var submitted = false;
|
let submitted = false;
|
||||||
|
|
||||||
$('uploadForm').addEventListener("submit", function() {
|
$('uploadForm').addEventListener("submit", function() {
|
||||||
$('startTorrentHidden').value = $('startTorrent').checked ? 'false' : 'true';
|
$('startTorrentHidden').value = $('startTorrent').checked ? 'false' : 'true';
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var hashes = new URI().getData('hashes').split('|');
|
const hashes = new URI().getData('hashes').split('|');
|
||||||
var setUpLimit = function() {
|
const setUpLimit = function() {
|
||||||
var limit = $("uplimitUpdatevalue").value.toInt() * 1024;
|
const limit = $("uplimitUpdatevalue").value.toInt() * 1024;
|
||||||
if (hashes[0] == "global") {
|
if (hashes[0] == "global") {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/transfer/setUploadLimit',
|
url: 'api/v2/transfer/setUploadLimit',
|
||||||
|
@ -38,9 +38,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function submitLoginForm() {
|
function submitLoginForm() {
|
||||||
var errorMsgElement = document.getElementById('error_msg');
|
const errorMsgElement = document.getElementById('error_msg');
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open('POST', 'api/v2/auth/login', true);
|
xhr.open('POST', 'api/v2/auth/login', true);
|
||||||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');
|
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');
|
||||||
xhr.addEventListener('readystatechange', function() {
|
xhr.addEventListener('readystatechange', function() {
|
||||||
@ -57,9 +57,9 @@ function submitLoginForm() {
|
|||||||
: 'QBT_TR(Unable to log in, qBittorrent is probably unreachable.)QBT_TR[CONTEXT=HttpServer]';
|
: 'QBT_TR(Unable to log in, qBittorrent is probably unreachable.)QBT_TR[CONTEXT=HttpServer]';
|
||||||
});
|
});
|
||||||
|
|
||||||
var usernameElement = document.getElementById('username');
|
const usernameElement = document.getElementById('username');
|
||||||
var passwordElement = document.getElementById('password');
|
const passwordElement = document.getElementById('password');
|
||||||
var queryString = "username=" + encodeURIComponent(usernameElement.value) + "&password=" + encodeURIComponent(passwordElement.value);
|
const queryString = "username=" + encodeURIComponent(usernameElement.value) + "&password=" + encodeURIComponent(passwordElement.value);
|
||||||
xhr.send(queryString);
|
xhr.send(queryString);
|
||||||
|
|
||||||
// clear the field
|
// clear the field
|
||||||
|
Loading…
Reference in New Issue
Block a user