mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
WebUI: enforce string quotes coding style
This commit is contained in:
parent
6d073771ca
commit
cb90b6769c
58 changed files with 3522 additions and 3514 deletions
|
@ -1,8 +1,8 @@
|
||||||
import Globals from 'globals';
|
import Globals from "globals";
|
||||||
import Html from 'eslint-plugin-html';
|
import Html from "eslint-plugin-html";
|
||||||
import Js from '@eslint/js';
|
import Js from "@eslint/js";
|
||||||
import Stylistic from '@stylistic/eslint-plugin';
|
import Stylistic from "@stylistic/eslint-plugin";
|
||||||
import * as RegexpPlugin from 'eslint-plugin-regexp';
|
import * as RegexpPlugin from "eslint-plugin-regexp";
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
Js.configs.recommended,
|
Js.configs.recommended,
|
||||||
|
@ -38,6 +38,14 @@ export default [
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Stylistic/nonblock-statement-body-position": ["error", "below"],
|
"Stylistic/nonblock-statement-body-position": ["error", "below"],
|
||||||
|
"Stylistic/quotes": [
|
||||||
|
"error",
|
||||||
|
"double",
|
||||||
|
{
|
||||||
|
"avoidEscape": true,
|
||||||
|
"allowTemplateLiterals": true
|
||||||
|
}
|
||||||
|
],
|
||||||
"Stylistic/semi": "error"
|
"Stylistic/semi": "error"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"extract_translation": "i18next -c public/i18next-parser.config.mjs public/index.html public/scripts/login.js",
|
"extract_translation": "i18next -c public/i18next-parser.config.mjs public/index.html public/scripts/login.js",
|
||||||
"format": "js-beautify -r private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js && prettier --write **.css",
|
"format": "js-beautify -r *.mjs private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js && prettier --write **.css",
|
||||||
"lint": "eslint private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js && stylelint **/*.css && html-validate private public"
|
"lint": "eslint *.mjs private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js && stylelint **/*.css && html-validate private public"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@stylistic/eslint-plugin": "*",
|
"@stylistic/eslint-plugin": "*",
|
||||||
|
|
|
@ -8,42 +8,42 @@
|
||||||
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Escape': function(event) {
|
"Escape": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': function(event) {
|
"Esc": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent("domready", function() {
|
||||||
const hash = new URI().getData('hash');
|
const hash = new URI().getData("hash");
|
||||||
if (!hash)
|
if (!hash)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$('peers').focus();
|
$("peers").focus();
|
||||||
|
|
||||||
$('addPeersOk').addEvent('click', function(e) {
|
$("addPeersOk").addEvent("click", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
const peers = $('peers').get('value').trim().split(/[\r\n]+/);
|
const peers = $("peers").get("value").trim().split(/[\r\n]+/);
|
||||||
if (peers.length === 0)
|
if (peers.length === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/addPeers',
|
url: "api/v2/torrents/addPeers",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hash,
|
hashes: hash,
|
||||||
peers: peers.join('|')
|
peers: peers.join("|")
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: function() {
|
||||||
alert("QBT_TR(Unable to add peers. Please ensure you are adhering to the IP:port format.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Unable to add peers. Please ensure you are adhering to the IP:port format.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
|
|
|
@ -8,33 +8,33 @@
|
||||||
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent("domready", function() {
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Escape': function(event) {
|
"Escape": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': function(event) {
|
"Esc": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
$('trackersUrls').focus();
|
$("trackersUrls").focus();
|
||||||
$('addTrackersButton').addEvent('click', function(e) {
|
$("addTrackersButton").addEvent("click", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
const 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",
|
||||||
data: {
|
data: {
|
||||||
hash: hash,
|
hash: hash,
|
||||||
urls: $('trackersUrls').value
|
urls: $("trackersUrls").value
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
|
|
|
@ -8,73 +8,73 @@
|
||||||
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
function setRememberBtnEnabled(enable) {
|
function setRememberBtnEnabled(enable) {
|
||||||
const btn = $('rememberBtn');
|
const btn = $("rememberBtn");
|
||||||
btn.disabled = !enable;
|
btn.disabled = !enable;
|
||||||
|
|
||||||
const icon = btn.getElementsByTagName('path')[0];
|
const icon = btn.getElementsByTagName("path")[0];
|
||||||
if (enable)
|
if (enable)
|
||||||
icon.style.removeProperty('fill');
|
icon.style.removeProperty("fill");
|
||||||
else
|
else
|
||||||
icon.style.fill = "var(--color-border-default)";
|
icon.style.fill = "var(--color-border-default)";
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent("domready", function() {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'images/object-locked.svg',
|
url: "images/object-locked.svg",
|
||||||
method: 'get',
|
method: "get",
|
||||||
onSuccess: function(text, xml) {
|
onSuccess: function(text, xml) {
|
||||||
const newIcon = xml.childNodes[0];
|
const newIcon = xml.childNodes[0];
|
||||||
newIcon.style.height = '24px';
|
newIcon.style.height = "24px";
|
||||||
newIcon.style.width = '24px';
|
newIcon.style.width = "24px";
|
||||||
$('rememberBtn').appendChild(newIcon);
|
$("rememberBtn").appendChild(newIcon);
|
||||||
setRememberBtnEnabled(false);
|
setRememberBtnEnabled(false);
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
||||||
const isDeletingFiles = (new URI().getData('deleteFiles') === "true");
|
const isDeletingFiles = (new URI().getData("deleteFiles") === "true");
|
||||||
$('deleteFromDiskCB').checked = isDeletingFiles;
|
$("deleteFromDiskCB").checked = isDeletingFiles;
|
||||||
|
|
||||||
const prefCache = window.parent.qBittorrent.Cache.preferences.get();
|
const prefCache = window.parent.qBittorrent.Cache.preferences.get();
|
||||||
let prefDeleteContentFiles = prefCache.delete_torrent_content_files;
|
let prefDeleteContentFiles = prefCache.delete_torrent_content_files;
|
||||||
|
|
||||||
$('deleteFromDiskCB').checked ||= prefDeleteContentFiles;
|
$("deleteFromDiskCB").checked ||= prefDeleteContentFiles;
|
||||||
$('deleteFromDiskCB').addEvent('click', function(e) {
|
$("deleteFromDiskCB").addEvent("click", function(e) {
|
||||||
setRememberBtnEnabled($('deleteFromDiskCB').checked !== prefDeleteContentFiles);
|
setRememberBtnEnabled($("deleteFromDiskCB").checked !== prefDeleteContentFiles);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set current "Delete files" choice as the default
|
// Set current "Delete files" choice as the default
|
||||||
$('rememberBtn').addEvent('click', function(e) {
|
$("rememberBtn").addEvent("click", function(e) {
|
||||||
window.parent.qBittorrent.Cache.preferences.set({
|
window.parent.qBittorrent.Cache.preferences.set({
|
||||||
data: {
|
data: {
|
||||||
'delete_torrent_content_files': $('deleteFromDiskCB').checked
|
"delete_torrent_content_files": $("deleteFromDiskCB").checked
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: function() {
|
||||||
prefDeleteContentFiles = $('deleteFromDiskCB').checked;
|
prefDeleteContentFiles = $("deleteFromDiskCB").checked;
|
||||||
setRememberBtnEnabled(false);
|
setRememberBtnEnabled(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const hashes = new URI().getData('hashes').split('|');
|
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();
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
});
|
});
|
||||||
$('confirmBtn').addEvent('click', function(e) {
|
$("confirmBtn").addEvent("click", function(e) {
|
||||||
parent.torrentsTable.deselectAll();
|
parent.torrentsTable.deselectAll();
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
const cmd = 'api/v2/torrents/delete';
|
const cmd = "api/v2/torrents/delete";
|
||||||
const deleteFiles = $('deleteFromDiskCB').get('checked');
|
const deleteFiles = $("deleteFromDiskCB").get("checked");
|
||||||
new Request({
|
new Request({
|
||||||
url: cmd,
|
url: cmd,
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
'hashes': hashes.join('|'),
|
"hashes": hashes.join("|"),
|
||||||
'deleteFiles': deleteFiles
|
"deleteFiles": deleteFiles
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
|
|
|
@ -8,22 +8,22 @@
|
||||||
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
window.addEvent('domready', () => {
|
window.addEvent("domready", () => {
|
||||||
const paths = new URI().getData('paths').split('|');
|
const paths = new URI().getData("paths").split("|");
|
||||||
$('cancelBtn').focus();
|
$("cancelBtn").focus();
|
||||||
$('cancelBtn').addEvent('click', (e) => {
|
$("cancelBtn").addEvent("click", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
});
|
});
|
||||||
$('confirmBtn').addEvent('click', (e) => {
|
$("confirmBtn").addEvent("click", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
let completionCount = 0;
|
let completionCount = 0;
|
||||||
paths.forEach((path) => {
|
paths.forEach((path) => {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/rss/removeItem',
|
url: "api/v2/rss/removeItem",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
path: decodeURIComponent(path)
|
path: decodeURIComponent(path)
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,25 +8,25 @@
|
||||||
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
window.addEvent('domready', () => {
|
window.addEvent("domready", () => {
|
||||||
const rules = new URI().getData('rules').split('|');
|
const rules = new URI().getData("rules").split("|");
|
||||||
|
|
||||||
$('cancelBtn').focus();
|
$("cancelBtn").focus();
|
||||||
$('cancelBtn').addEvent('click', (e) => {
|
$("cancelBtn").addEvent("click", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
window.parent.MochaUI.closeWindow(window.parent.$('clearRulesPage'));
|
window.parent.MochaUI.closeWindow(window.parent.$("clearRulesPage"));
|
||||||
});
|
});
|
||||||
$('confirmBtn').addEvent('click', (e) => {
|
$("confirmBtn").addEvent("click", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
let completionCount = 0;
|
let completionCount = 0;
|
||||||
rules.forEach((rule) => {
|
rules.forEach((rule) => {
|
||||||
window.parent.qBittorrent.RssDownloader.modifyRuleState(decodeURIComponent(rule), 'previouslyMatchedEpisodes', [], () => {
|
window.parent.qBittorrent.RssDownloader.modifyRuleState(decodeURIComponent(rule), "previouslyMatchedEpisodes", [], () => {
|
||||||
++completionCount;
|
++completionCount;
|
||||||
if (completionCount === rules.length) {
|
if (completionCount === rules.length) {
|
||||||
window.parent.qBittorrent.RssDownloader.updateRulesList();
|
window.parent.qBittorrent.RssDownloader.updateRulesList();
|
||||||
window.parent.MochaUI.closeWindow(window.parent.$('clearRulesPage'));
|
window.parent.MochaUI.closeWindow(window.parent.$("clearRulesPage"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,23 +8,23 @@
|
||||||
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
window.addEvent('domready', () => {
|
window.addEvent("domready", () => {
|
||||||
const rules = new URI().getData('rules').split('|');
|
const rules = new URI().getData("rules").split("|");
|
||||||
|
|
||||||
$('cancelBtn').focus();
|
$("cancelBtn").focus();
|
||||||
$('cancelBtn').addEvent('click', (e) => {
|
$("cancelBtn").addEvent("click", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
window.parent.MochaUI.closeWindow(window.parent.$('removeRulePage'));
|
window.parent.MochaUI.closeWindow(window.parent.$("removeRulePage"));
|
||||||
});
|
});
|
||||||
$('confirmBtn').addEvent('click', (e) => {
|
$("confirmBtn").addEvent("click", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
let completionCount = 0;
|
let completionCount = 0;
|
||||||
rules.forEach((rule) => {
|
rules.forEach((rule) => {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/rss/removeRule',
|
url: "api/v2/rss/removeRule",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
ruleName: decodeURIComponent(rule)
|
ruleName: decodeURIComponent(rule)
|
||||||
},
|
},
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
++completionCount;
|
++completionCount;
|
||||||
if (completionCount === rules.length) {
|
if (completionCount === rules.length) {
|
||||||
window.parent.qBittorrent.RssDownloader.updateRulesList();
|
window.parent.qBittorrent.RssDownloader.updateRulesList();
|
||||||
window.parent.MochaUI.closeWindow(window.parent.$('removeRulePage'));
|
window.parent.MochaUI.closeWindow(window.parent.$("removeRulePage"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -163,31 +163,31 @@
|
||||||
<div id="download_spinner" class="mochaSpinner"></div>
|
<div id="download_spinner" class="mochaSpinner"></div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
const encodedUrls = new URI().getData('urls');
|
const encodedUrls = new URI().getData("urls");
|
||||||
if (encodedUrls) {
|
if (encodedUrls) {
|
||||||
const urls = encodedUrls.split('|').map(function(url) {
|
const urls = encodedUrls.split("|").map(function(url) {
|
||||||
return decodeURIComponent(url);
|
return decodeURIComponent(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (urls.length)
|
if (urls.length)
|
||||||
$('urls').set('value', urls.join("\n"));
|
$("urls").set("value", urls.join("\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
let 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";
|
||||||
|
|
||||||
$('dlLimitHidden').value = $('dlLimitText').value.toInt() * 1024;
|
$("dlLimitHidden").value = $("dlLimitText").value.toInt() * 1024;
|
||||||
$('upLimitHidden').value = $('upLimitText').value.toInt() * 1024;
|
$("upLimitHidden").value = $("upLimitText").value.toInt() * 1024;
|
||||||
|
|
||||||
$('download_spinner').style.display = "block";
|
$("download_spinner").style.display = "block";
|
||||||
submitted = true;
|
submitted = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('download_frame').addEventListener("load", function() {
|
$("download_frame").addEventListener("load", function() {
|
||||||
if (submitted)
|
if (submitted)
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,17 +25,17 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
const hashes = new URI().getData('hashes').split('|');
|
const hashes = new URI().getData("hashes").split("|");
|
||||||
const setDlLimit = function() {
|
const setDlLimit = function() {
|
||||||
const 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",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
'limit': limit
|
"limit": limit
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
window.parent.updateMainData();
|
window.parent.updateMainData();
|
||||||
|
@ -45,11 +45,11 @@
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/setDownloadLimit',
|
url: "api/v2/torrents/setDownloadLimit",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
'hashes': hashes.join('|'),
|
"hashes": hashes.join("|"),
|
||||||
'limit': limit
|
"limit": limit
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
|
@ -59,24 +59,24 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': function(event) {
|
"Enter": function(event) {
|
||||||
$('applyButton').click();
|
$("applyButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': function(event) {
|
"Escape": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': function(event) {
|
"Esc": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
$('dllimitUpdatevalue').focus();
|
$("dllimitUpdatevalue").focus();
|
||||||
|
|
||||||
MochaUI.addDlLimitSlider(hashes);
|
MochaUI.addDlLimitSlider(hashes);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -8,44 +8,44 @@
|
||||||
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent("domready", function() {
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': function(event) {
|
"Enter": function(event) {
|
||||||
$('editTrackerButton').click();
|
$("editTrackerButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': function(event) {
|
"Escape": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': function(event) {
|
"Esc": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
const currentUrl = new URI().getData('url');
|
const currentUrl = new URI().getData("url");
|
||||||
if (!currentUrl)
|
if (!currentUrl)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$('trackerUrl').value = currentUrl;
|
$("trackerUrl").value = currentUrl;
|
||||||
$('trackerUrl').focus();
|
$("trackerUrl").focus();
|
||||||
|
|
||||||
$('editTrackerButton').addEvent('click', function(e) {
|
$("editTrackerButton").addEvent("click", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
const 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",
|
||||||
data: {
|
data: {
|
||||||
hash: hash,
|
hash: hash,
|
||||||
origUrl: currentUrl,
|
origUrl: currentUrl,
|
||||||
newUrl: $('trackerUrl').value
|
newUrl: $("trackerUrl").value
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
|
|
|
@ -9,54 +9,54 @@
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': function(event) {
|
"Enter": function(event) {
|
||||||
$('categoryNameButton').click();
|
$("categoryNameButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': function(event) {
|
"Escape": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': function(event) {
|
"Esc": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent("domready", function() {
|
||||||
const uriAction = window.qBittorrent.Misc.safeTrim(new URI().getData('action'));
|
const uriAction = window.qBittorrent.Misc.safeTrim(new URI().getData("action"));
|
||||||
const uriHashes = window.qBittorrent.Misc.safeTrim(new URI().getData('hashes'));
|
const uriHashes = window.qBittorrent.Misc.safeTrim(new URI().getData("hashes"));
|
||||||
const uriCategoryName = window.qBittorrent.Misc.safeTrim(new URI().getData('categoryName'));
|
const uriCategoryName = window.qBittorrent.Misc.safeTrim(new URI().getData("categoryName"));
|
||||||
const uriSavePath = window.qBittorrent.Misc.safeTrim(new URI().getData('savePath'));
|
const uriSavePath = window.qBittorrent.Misc.safeTrim(new URI().getData("savePath"));
|
||||||
|
|
||||||
if (uriAction === "edit") {
|
if (uriAction === "edit") {
|
||||||
if (!uriCategoryName)
|
if (!uriCategoryName)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$('categoryName').set('disabled', true);
|
$("categoryName").set("disabled", true);
|
||||||
$('categoryName').set('value', window.qBittorrent.Misc.escapeHtml(uriCategoryName));
|
$("categoryName").set("value", window.qBittorrent.Misc.escapeHtml(uriCategoryName));
|
||||||
$('savePath').set('value', window.qBittorrent.Misc.escapeHtml(uriSavePath));
|
$("savePath").set("value", window.qBittorrent.Misc.escapeHtml(uriSavePath));
|
||||||
$('savePath').focus();
|
$("savePath").focus();
|
||||||
}
|
}
|
||||||
else if (uriAction === "createSubcategory") {
|
else if (uriAction === "createSubcategory") {
|
||||||
$('categoryName').set('value', window.qBittorrent.Misc.escapeHtml(uriCategoryName));
|
$("categoryName").set("value", window.qBittorrent.Misc.escapeHtml(uriCategoryName));
|
||||||
$('categoryName').focus();
|
$("categoryName").focus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('categoryName').focus();
|
$("categoryName").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('categoryNameButton').addEvent('click', function(e) {
|
$("categoryNameButton").addEvent("click", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
const savePath = $('savePath').value.trim();
|
const savePath = $("savePath").value.trim();
|
||||||
const categoryName = $('categoryName').value.trim();
|
const categoryName = $("categoryName").value.trim();
|
||||||
|
|
||||||
const verifyCategoryName = function(name) {
|
const verifyCategoryName = function(name) {
|
||||||
if ((name === null) || (name === ""))
|
if ((name === null) || (name === ""))
|
||||||
|
@ -74,16 +74,16 @@
|
||||||
return;
|
return;
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/createCategory',
|
url: "api/v2/torrents/createCategory",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
category: categoryName,
|
category: categoryName,
|
||||||
savePath: savePath
|
savePath: savePath
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: function() {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/setCategory',
|
url: "api/v2/torrents/setCategory",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: uriHashes,
|
hashes: uriHashes,
|
||||||
category: categoryName
|
category: categoryName
|
||||||
|
@ -104,8 +104,8 @@
|
||||||
return;
|
return;
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/createCategory',
|
url: "api/v2/torrents/createCategory",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
category: categoryName,
|
category: categoryName,
|
||||||
savePath: savePath
|
savePath: savePath
|
||||||
|
@ -117,8 +117,8 @@
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/editCategory',
|
url: "api/v2/torrents/editCategory",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
category: uriCategoryName, // category name can't be changed
|
category: uriCategoryName, // category name can't be changed
|
||||||
savePath: savePath
|
savePath: savePath
|
||||||
|
|
|
@ -9,45 +9,45 @@
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': (event) => {
|
"Enter": (event) => {
|
||||||
$('submitButton').click();
|
$("submitButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': (event) => {
|
"Escape": (event) => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': (event) => {
|
"Esc": (event) => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
window.addEvent('domready', () => {
|
window.addEvent("domready", () => {
|
||||||
$('feedURL').focus();
|
$("feedURL").focus();
|
||||||
const path = new URI().getData('path');
|
const path = new URI().getData("path");
|
||||||
$('submitButton').addEvent('click', (e) => {
|
$("submitButton").addEvent("click", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
// check field
|
// check field
|
||||||
const feedURL = $('feedURL').value.trim();
|
const feedURL = $("feedURL").value.trim();
|
||||||
if (feedURL === '') {
|
if (feedURL === "") {
|
||||||
alert('QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]');
|
alert("QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('submitButton').disabled = true;
|
$("submitButton").disabled = true;
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/rss/addFeed',
|
url: "api/v2/rss/addFeed",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
url: feedURL,
|
url: feedURL,
|
||||||
path: path ? (path + '\\' + feedURL) : ''
|
path: path ? (path + "\\" + feedURL) : ""
|
||||||
},
|
},
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
window.parent.qBittorrent.Rss.updateRssFeedList();
|
window.parent.qBittorrent.Rss.updateRssFeedList();
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
onFailure: (response) => {
|
onFailure: (response) => {
|
||||||
if (response.status === 409)
|
if (response.status === 409)
|
||||||
alert(response.responseText);
|
alert(response.responseText);
|
||||||
$('submitButton').disabled = false;
|
$("submitButton").disabled = false;
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,44 +9,44 @@
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': (event) => {
|
"Enter": (event) => {
|
||||||
$('submitButton').click();
|
$("submitButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': (event) => {
|
"Escape": (event) => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': (event) => {
|
"Esc": (event) => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
window.addEvent('domready', () => {
|
window.addEvent("domready", () => {
|
||||||
$('folderName').focus();
|
$("folderName").focus();
|
||||||
const path = new URI().getData('path');
|
const path = new URI().getData("path");
|
||||||
$('submitButton').addEvent('click', (e) => {
|
$("submitButton").addEvent("click", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
// check field
|
// check field
|
||||||
const folderName = $('folderName').value.trim();
|
const folderName = $("folderName").value.trim();
|
||||||
if (folderName === '') {
|
if (folderName === "") {
|
||||||
alert('QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]');
|
alert("QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('submitButton').disabled = true;
|
$("submitButton").disabled = true;
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/rss/addFolder',
|
url: "api/v2/rss/addFolder",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
path: path ? (path + '\\' + folderName) : folderName
|
path: path ? (path + "\\" + folderName) : folderName
|
||||||
},
|
},
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
window.parent.qBittorrent.Rss.updateRssFeedList();
|
window.parent.qBittorrent.Rss.updateRssFeedList();
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
onFailure: (response) => {
|
onFailure: (response) => {
|
||||||
if (response.status === 409)
|
if (response.status === 409)
|
||||||
alert(response.responseText);
|
alert(response.responseText);
|
||||||
$('submitButton').disabled = false;
|
$("submitButton").disabled = false;
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,46 +9,46 @@
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': (event) => {
|
"Enter": (event) => {
|
||||||
$('submitButton').click();
|
$("submitButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': (event) => {
|
"Escape": (event) => {
|
||||||
window.parent.MochaUI.closeWindow(window.parent.$('newRulePage'));
|
window.parent.MochaUI.closeWindow(window.parent.$("newRulePage"));
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': (event) => {
|
"Esc": (event) => {
|
||||||
window.parent.MochaUI.closeWindow(window.parent.$('newRulePage'));
|
window.parent.MochaUI.closeWindow(window.parent.$("newRulePage"));
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
window.addEvent('domready', () => {
|
window.addEvent("domready", () => {
|
||||||
$('name').focus();
|
$("name").focus();
|
||||||
$('submitButton').addEvent('click', (e) => {
|
$("submitButton").addEvent("click", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
// check field
|
// check field
|
||||||
const name = $('name').value.trim();
|
const name = $("name").value.trim();
|
||||||
if (name === '') {
|
if (name === "") {
|
||||||
alert('QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]');
|
alert("QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$('submitButton').disabled = true;
|
$("submitButton").disabled = true;
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/rss/setRule',
|
url: "api/v2/rss/setRule",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
ruleName: name,
|
ruleName: name,
|
||||||
ruleDef: '{}'
|
ruleDef: "{}"
|
||||||
},
|
},
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
window.parent.qBittorrent.RssDownloader.updateRulesList();
|
window.parent.qBittorrent.RssDownloader.updateRulesList();
|
||||||
window.parent.MochaUI.closeWindow(window.parent.$('newRulePage'));
|
window.parent.MochaUI.closeWindow(window.parent.$("newRulePage"));
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,39 +9,39 @@
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': function(event) {
|
"Enter": function(event) {
|
||||||
$('tagNameButton').click();
|
$("tagNameButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': function(event) {
|
"Escape": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': function(event) {
|
"Esc": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent("domready", function() {
|
||||||
const uriAction = window.qBittorrent.Misc.safeTrim(new URI().getData('action'));
|
const uriAction = window.qBittorrent.Misc.safeTrim(new URI().getData("action"));
|
||||||
const uriHashes = window.qBittorrent.Misc.safeTrim(new URI().getData('hashes'));
|
const uriHashes = window.qBittorrent.Misc.safeTrim(new URI().getData("hashes"));
|
||||||
|
|
||||||
if (uriAction === 'create')
|
if (uriAction === "create")
|
||||||
$('legendText').innerText = 'QBT_TR(Tag:)QBT_TR[CONTEXT=TagFilterWidget]';
|
$("legendText").innerText = "QBT_TR(Tag:)QBT_TR[CONTEXT=TagFilterWidget]";
|
||||||
|
|
||||||
$('tagName').focus();
|
$("tagName").focus();
|
||||||
|
|
||||||
$('tagNameButton').addEvent('click', function(e) {
|
$("tagNameButton").addEvent("click", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
const tagName = $('tagName').value.trim();
|
const tagName = $("tagName").value.trim();
|
||||||
|
|
||||||
const verifyTagName = function(name) {
|
const verifyTagName = function(name) {
|
||||||
if ((name === null) || (name === ""))
|
if ((name === null) || (name === ""))
|
||||||
|
@ -59,8 +59,8 @@
|
||||||
return;
|
return;
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/addTags',
|
url: "api/v2/torrents/addTags",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: uriHashes,
|
hashes: uriHashes,
|
||||||
tags: tagName,
|
tags: tagName,
|
||||||
|
@ -76,8 +76,8 @@
|
||||||
return;
|
return;
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/createTags',
|
url: "api/v2/torrents/createTags",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
tags: tagName,
|
tags: tagName,
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,45 +9,45 @@
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': function(event) {
|
"Enter": function(event) {
|
||||||
$('renameButton').click();
|
$("renameButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': function(event) {
|
"Escape": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': function(event) {
|
"Esc": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent("domready", function() {
|
||||||
const 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 = name;
|
$("rename").value = name;
|
||||||
|
|
||||||
$('rename').focus();
|
$("rename").focus();
|
||||||
$('renameButton').addEvent('click', function(e) {
|
$("renameButton").addEvent("click", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
// check field
|
// check field
|
||||||
const name = $('rename').value.trim();
|
const name = $("rename").value.trim();
|
||||||
if ((name === null) || (name === ""))
|
if ((name === null) || (name === ""))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const 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",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hash: hash,
|
hash: hash,
|
||||||
name: name
|
name: name
|
||||||
|
|
|
@ -9,51 +9,51 @@
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': (event) => {
|
"Enter": (event) => {
|
||||||
$('renameButton').click();
|
$("renameButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': (event) => {
|
"Escape": (event) => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': (event) => {
|
"Esc": (event) => {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
window.addEvent('domready', () => {
|
window.addEvent("domready", () => {
|
||||||
const oldPath = new URI().getData('oldPath');
|
const oldPath = new URI().getData("oldPath");
|
||||||
|
|
||||||
$('rename').value = oldPath;
|
$("rename").value = oldPath;
|
||||||
$('rename').focus();
|
$("rename").focus();
|
||||||
$('rename').setSelectionRange(0, oldPath.length);
|
$("rename").setSelectionRange(0, oldPath.length);
|
||||||
|
|
||||||
$('renameButton').addEvent('click', (e) => {
|
$("renameButton").addEvent("click", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
// check field
|
// check field
|
||||||
const newPath = $('rename').value.trim();
|
const newPath = $("rename").value.trim();
|
||||||
if (newPath === '') {
|
if (newPath === "") {
|
||||||
alert('QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]');
|
alert("QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newPath === oldPath) {
|
if (newPath === oldPath) {
|
||||||
alert('QBT_TR(Name is unchanged)QBT_TR[CONTEXT=HttpServer]');
|
alert("QBT_TR(Name is unchanged)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('renameButton').disabled = true;
|
$("renameButton").disabled = true;
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/rss/moveItem',
|
url: "api/v2/rss/moveItem",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
itemPath: oldPath,
|
itemPath: oldPath,
|
||||||
destPath: newPath
|
destPath: newPath
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
if (response.status === 409) {
|
if (response.status === 409) {
|
||||||
alert(response.responseText);
|
alert(response.responseText);
|
||||||
}
|
}
|
||||||
$('renameButton').disabled = false;
|
$("renameButton").disabled = false;
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,60 +10,60 @@
|
||||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script src="scripts/filesystem.js?v=${CACHEID}"></script>
|
<script src="scripts/filesystem.js?v=${CACHEID}"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': function(event) {
|
"Enter": function(event) {
|
||||||
$('renameButton').click();
|
$("renameButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': function(event) {
|
"Escape": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': function(event) {
|
"Esc": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent("domready", function() {
|
||||||
const hash = new URI().getData('hash');
|
const hash = new URI().getData("hash");
|
||||||
const oldPath = new URI().getData('path');
|
const oldPath = new URI().getData("path");
|
||||||
const isFolder = ((new URI().getData('isFolder')) === 'true');
|
const isFolder = ((new URI().getData("isFolder")) === "true");
|
||||||
|
|
||||||
const oldName = window.qBittorrent.Filesystem.fileName(oldPath);
|
const oldName = window.qBittorrent.Filesystem.fileName(oldPath);
|
||||||
$('rename').value = oldName;
|
$("rename").value = oldName;
|
||||||
$('rename').focus();
|
$("rename").focus();
|
||||||
if (!isFolder)
|
if (!isFolder)
|
||||||
$('rename').setSelectionRange(0, oldName.lastIndexOf('.'));
|
$("rename").setSelectionRange(0, oldName.lastIndexOf("."));
|
||||||
|
|
||||||
$('renameButton').addEvent('click', function(e) {
|
$("renameButton").addEvent("click", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
// check field
|
// check field
|
||||||
const newName = $('rename').value.trim();
|
const newName = $("rename").value.trim();
|
||||||
if (newName === '') {
|
if (newName === "") {
|
||||||
alert('QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]');
|
alert("QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newName === oldName) {
|
if (newName === oldName) {
|
||||||
alert('QBT_TR(Name is unchanged)QBT_TR[CONTEXT=HttpServer]');
|
alert("QBT_TR(Name is unchanged)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('renameButton').disabled = true;
|
$("renameButton").disabled = true;
|
||||||
|
|
||||||
const parentPath = window.qBittorrent.Filesystem.folderName(oldPath);
|
const parentPath = window.qBittorrent.Filesystem.folderName(oldPath);
|
||||||
const newPath = parentPath
|
const newPath = parentPath
|
||||||
? parentPath + window.qBittorrent.Filesystem.PathSeparator + newName
|
? parentPath + window.qBittorrent.Filesystem.PathSeparator + newName
|
||||||
: newName;
|
: newName;
|
||||||
new Request({
|
new Request({
|
||||||
url: isFolder ? 'api/v2/torrents/renameFolder' : 'api/v2/torrents/renameFile',
|
url: isFolder ? "api/v2/torrents/renameFolder" : "api/v2/torrents/renameFile",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hash: hash,
|
hash: hash,
|
||||||
oldPath: oldPath,
|
oldPath: oldPath,
|
||||||
|
@ -73,8 +73,8 @@
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
},
|
},
|
||||||
onFailure: function() {
|
onFailure: function() {
|
||||||
alert('QBT_TR(Failed to update name)QBT_TR[CONTEXT=HttpServer]');
|
alert("QBT_TR(Failed to update name)QBT_TR[CONTEXT=HttpServer]");
|
||||||
$('renameButton').disabled = false;
|
$("renameButton").disabled = false;
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<script src="scripts/dynamicTable.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/dynamicTable.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script src="scripts/rename-files.js?v=${CACHEID}"></script>
|
<script src="scripts/rename-files.js?v=${CACHEID}"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.parent.qBittorrent !== undefined) {
|
if (window.parent.qBittorrent !== undefined) {
|
||||||
window.qBittorrent = window.parent.qBittorrent;
|
window.qBittorrent = window.parent.qBittorrent;
|
||||||
|
@ -20,15 +20,15 @@
|
||||||
window.qBittorrent = window.parent.qBittorrent;
|
window.qBittorrent = window.parent.qBittorrent;
|
||||||
|
|
||||||
var TriState = window.qBittorrent.FileTree.TriState;
|
var TriState = window.qBittorrent.FileTree.TriState;
|
||||||
var data = window.MUI.Windows.instances['multiRenamePage'].options.data;
|
var data = window.MUI.Windows.instances["multiRenamePage"].options.data;
|
||||||
var bulkRenameFilesContextMenu;
|
var bulkRenameFilesContextMenu;
|
||||||
if (!bulkRenameFilesContextMenu) {
|
if (!bulkRenameFilesContextMenu) {
|
||||||
bulkRenameFilesContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
bulkRenameFilesContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
||||||
targets: '#bulkRenameFilesTableDiv tr',
|
targets: "#bulkRenameFilesTableDiv tr",
|
||||||
menu: 'multiRenameFilesMenu',
|
menu: "multiRenameFilesMenu",
|
||||||
actions: {
|
actions: {
|
||||||
ToggleSelection: function(element, ref) {
|
ToggleSelection: function(element, ref) {
|
||||||
const rowId = parseInt(element.get('data-row-id'));
|
const rowId = parseInt(element.get("data-row-id"));
|
||||||
const row = bulkRenameFilesTable.getNode(rowId);
|
const row = bulkRenameFilesTable.getNode(rowId);
|
||||||
const checkState = (row.checked === 1) ? 0 : 1;
|
const checkState = (row.checked === 1) ? 0 : 1;
|
||||||
bulkRenameFilesTable.toggleNodeTreeCheckbox(rowId, checkState);
|
bulkRenameFilesTable.toggleNodeTreeCheckbox(rowId, checkState);
|
||||||
|
@ -45,19 +45,19 @@
|
||||||
|
|
||||||
// Setup the dynamic table for bulk renaming
|
// Setup the dynamic table for bulk renaming
|
||||||
var bulkRenameFilesTable = new window.qBittorrent.DynamicTable.BulkRenameTorrentFilesTable();
|
var bulkRenameFilesTable = new window.qBittorrent.DynamicTable.BulkRenameTorrentFilesTable();
|
||||||
bulkRenameFilesTable.setup('bulkRenameFilesTableDiv', 'bulkRenameFilesTableFixedHeaderDiv', bulkRenameFilesContextMenu);
|
bulkRenameFilesTable.setup("bulkRenameFilesTableDiv", "bulkRenameFilesTableFixedHeaderDiv", bulkRenameFilesContextMenu);
|
||||||
|
|
||||||
// Inject checkbox into the first column of the table header
|
// Inject checkbox into the first column of the table header
|
||||||
var tableHeaders = $$('#bulkRenameFilesTableFixedHeaderDiv .dynamicTableHeader th');
|
var tableHeaders = $$("#bulkRenameFilesTableFixedHeaderDiv .dynamicTableHeader th");
|
||||||
var checkboxHeader;
|
var checkboxHeader;
|
||||||
if (tableHeaders.length > 0) {
|
if (tableHeaders.length > 0) {
|
||||||
if (checkboxHeader) {
|
if (checkboxHeader) {
|
||||||
checkboxHeader.remove();
|
checkboxHeader.remove();
|
||||||
}
|
}
|
||||||
checkboxHeader = new Element('input');
|
checkboxHeader = new Element("input");
|
||||||
checkboxHeader.set('type', 'checkbox');
|
checkboxHeader.set("type", "checkbox");
|
||||||
checkboxHeader.set('id', 'rootMultiRename_cb');
|
checkboxHeader.set("id", "rootMultiRename_cb");
|
||||||
checkboxHeader.addEvent('click', function(e) {
|
checkboxHeader.addEvent("click", function(e) {
|
||||||
bulkRenameFilesTable.toggleGlobalCheckbox();
|
bulkRenameFilesTable.toggleGlobalCheckbox();
|
||||||
fileRenamer.selectedFiles = bulkRenameFilesTable.getSelectedRows();
|
fileRenamer.selectedFiles = bulkRenameFilesTable.getSelectedRows();
|
||||||
fileRenamer.update();
|
fileRenamer.update();
|
||||||
|
@ -72,13 +72,13 @@
|
||||||
var keyboard;
|
var keyboard;
|
||||||
if (!keyboard) {
|
if (!keyboard) {
|
||||||
keyboard = new Keyboard({
|
keyboard = new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Escape': function(event) {
|
"Escape": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': function(event) {
|
"Esc": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
@ -91,51 +91,51 @@
|
||||||
fileRenamer.hash = data.hash;
|
fileRenamer.hash = data.hash;
|
||||||
|
|
||||||
// Load Multi Rename Preferences
|
// Load Multi Rename Preferences
|
||||||
var multiRenamePrefChecked = LocalPreferences.get('multirename_rememberPreferences', "true") === "true";
|
var multiRenamePrefChecked = LocalPreferences.get("multirename_rememberPreferences", "true") === "true";
|
||||||
$('multirename_rememberprefs_checkbox').setProperty('checked', multiRenamePrefChecked);
|
$("multirename_rememberprefs_checkbox").setProperty("checked", multiRenamePrefChecked);
|
||||||
|
|
||||||
if (multiRenamePrefChecked) {
|
if (multiRenamePrefChecked) {
|
||||||
var multirename_search = LocalPreferences.get('multirename_search', '');
|
var multirename_search = LocalPreferences.get("multirename_search", "");
|
||||||
fileRenamer.setSearch(multirename_search);
|
fileRenamer.setSearch(multirename_search);
|
||||||
$('multiRenameSearch').set('value', multirename_search);
|
$("multiRenameSearch").set("value", multirename_search);
|
||||||
|
|
||||||
var multirename_useRegex = LocalPreferences.get('multirename_useRegex', false);
|
var multirename_useRegex = LocalPreferences.get("multirename_useRegex", false);
|
||||||
fileRenamer.useRegex = multirename_useRegex === 'true';
|
fileRenamer.useRegex = multirename_useRegex === "true";
|
||||||
$('use_regex_search').checked = fileRenamer.useRegex;
|
$("use_regex_search").checked = fileRenamer.useRegex;
|
||||||
|
|
||||||
var multirename_matchAllOccurrences = LocalPreferences.get('multirename_matchAllOccurrences', false);
|
var multirename_matchAllOccurrences = LocalPreferences.get("multirename_matchAllOccurrences", false);
|
||||||
fileRenamer.matchAllOccurrences = multirename_matchAllOccurrences === 'true';
|
fileRenamer.matchAllOccurrences = multirename_matchAllOccurrences === "true";
|
||||||
$('match_all_occurrences').checked = fileRenamer.matchAllOccurrences;
|
$("match_all_occurrences").checked = fileRenamer.matchAllOccurrences;
|
||||||
|
|
||||||
var multirename_caseSensitive = LocalPreferences.get('multirename_caseSensitive', false);
|
var multirename_caseSensitive = LocalPreferences.get("multirename_caseSensitive", false);
|
||||||
fileRenamer.caseSensitive = multirename_caseSensitive === 'true';
|
fileRenamer.caseSensitive = multirename_caseSensitive === "true";
|
||||||
$('case_sensitive').checked = fileRenamer.caseSensitive;
|
$("case_sensitive").checked = fileRenamer.caseSensitive;
|
||||||
|
|
||||||
var multirename_replace = LocalPreferences.get('multirename_replace', '');
|
var multirename_replace = LocalPreferences.get("multirename_replace", "");
|
||||||
fileRenamer.setReplacement(multirename_replace);
|
fileRenamer.setReplacement(multirename_replace);
|
||||||
$('multiRenameReplace').set('value', multirename_replace);
|
$("multiRenameReplace").set("value", multirename_replace);
|
||||||
|
|
||||||
var multirename_appliesTo = LocalPreferences.get('multirename_appliesTo', window.qBittorrent.MultiRename.AppliesTo.FilenameExtension);
|
var multirename_appliesTo = LocalPreferences.get("multirename_appliesTo", window.qBittorrent.MultiRename.AppliesTo.FilenameExtension);
|
||||||
fileRenamer.appliesTo = window.qBittorrent.MultiRename.AppliesTo[multirename_appliesTo];
|
fileRenamer.appliesTo = window.qBittorrent.MultiRename.AppliesTo[multirename_appliesTo];
|
||||||
$('applies_to_option').set('value', fileRenamer.appliesTo);
|
$("applies_to_option").set("value", fileRenamer.appliesTo);
|
||||||
|
|
||||||
var multirename_includeFiles = LocalPreferences.get('multirename_includeFiles', true);
|
var multirename_includeFiles = LocalPreferences.get("multirename_includeFiles", true);
|
||||||
fileRenamer.includeFiles = multirename_includeFiles === 'true';
|
fileRenamer.includeFiles = multirename_includeFiles === "true";
|
||||||
$('include_files').checked = fileRenamer.includeFiles;
|
$("include_files").checked = fileRenamer.includeFiles;
|
||||||
|
|
||||||
var multirename_includeFolders = LocalPreferences.get('multirename_includeFolders', false);
|
var multirename_includeFolders = LocalPreferences.get("multirename_includeFolders", false);
|
||||||
fileRenamer.includeFolders = multirename_includeFolders === 'true';
|
fileRenamer.includeFolders = multirename_includeFolders === "true";
|
||||||
$('include_folders').checked = fileRenamer.includeFolders;
|
$("include_folders").checked = fileRenamer.includeFolders;
|
||||||
|
|
||||||
var multirename_fileEnumerationStart = LocalPreferences.get('multirename_fileEnumerationStart', 0);
|
var multirename_fileEnumerationStart = LocalPreferences.get("multirename_fileEnumerationStart", 0);
|
||||||
fileRenamer.fileEnumerationStart = parseInt(multirename_fileEnumerationStart);
|
fileRenamer.fileEnumerationStart = parseInt(multirename_fileEnumerationStart);
|
||||||
$('file_counter').set('value', fileRenamer.fileEnumerationStart);
|
$("file_counter").set("value", fileRenamer.fileEnumerationStart);
|
||||||
|
|
||||||
var multirename_replaceAll = LocalPreferences.get('multirename_replaceAll', false);
|
var multirename_replaceAll = LocalPreferences.get("multirename_replaceAll", false);
|
||||||
fileRenamer.replaceAll = multirename_replaceAll === 'true';
|
fileRenamer.replaceAll = multirename_replaceAll === "true";
|
||||||
var renameButtonValue = fileRenamer.replaceAll ? 'Replace All' : 'Replace';
|
var renameButtonValue = fileRenamer.replaceAll ? "Replace All" : "Replace";
|
||||||
$('renameOptions').set('value', renameButtonValue);
|
$("renameOptions").set("value", renameButtonValue);
|
||||||
$('renameButton').set('value', renameButtonValue);
|
$("renameButton").set("value", renameButtonValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fires every time a row's selection changes
|
// Fires every time a row's selection changes
|
||||||
|
@ -145,28 +145,28 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
// Setup Search Events that control renaming
|
// Setup Search Events that control renaming
|
||||||
$('multiRenameSearch').addEvent('input', function(e) {
|
$("multiRenameSearch").addEvent("input", function(e) {
|
||||||
let sanitized = e.target.value.replace(/\n/g, '');
|
let sanitized = e.target.value.replace(/\n/g, "");
|
||||||
$('multiRenameSearch').set('value', sanitized);
|
$("multiRenameSearch").set("value", sanitized);
|
||||||
|
|
||||||
// Search input has changed
|
// Search input has changed
|
||||||
$('multiRenameSearch').style['border-color'] = '';
|
$("multiRenameSearch").style["border-color"] = "";
|
||||||
LocalPreferences.set('multirename_search', sanitized);
|
LocalPreferences.set("multirename_search", sanitized);
|
||||||
fileRenamer.setSearch(sanitized);
|
fileRenamer.setSearch(sanitized);
|
||||||
});
|
});
|
||||||
$('use_regex_search').addEvent('change', function(e) {
|
$("use_regex_search").addEvent("change", function(e) {
|
||||||
fileRenamer.useRegex = e.target.checked;
|
fileRenamer.useRegex = e.target.checked;
|
||||||
LocalPreferences.set('multirename_useRegex', e.target.checked);
|
LocalPreferences.set("multirename_useRegex", e.target.checked);
|
||||||
fileRenamer.update();
|
fileRenamer.update();
|
||||||
});
|
});
|
||||||
$('match_all_occurrences').addEvent('change', function(e) {
|
$("match_all_occurrences").addEvent("change", function(e) {
|
||||||
fileRenamer.matchAllOccurrences = e.target.checked;
|
fileRenamer.matchAllOccurrences = e.target.checked;
|
||||||
LocalPreferences.set('multirename_matchAllOccurrences', e.target.checked);
|
LocalPreferences.set("multirename_matchAllOccurrences", e.target.checked);
|
||||||
fileRenamer.update();
|
fileRenamer.update();
|
||||||
});
|
});
|
||||||
$('case_sensitive').addEvent('change', function(e) {
|
$("case_sensitive").addEvent("change", function(e) {
|
||||||
fileRenamer.caseSensitive = e.target.checked;
|
fileRenamer.caseSensitive = e.target.checked;
|
||||||
LocalPreferences.set('multirename_caseSensitive', e.target.checked);
|
LocalPreferences.set("multirename_caseSensitive", e.target.checked);
|
||||||
fileRenamer.update();
|
fileRenamer.update();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -178,90 +178,90 @@
|
||||||
document
|
document
|
||||||
.querySelectorAll("span[id^='filesTablefileRenamed']")
|
.querySelectorAll("span[id^='filesTablefileRenamed']")
|
||||||
.forEach(function(span) {
|
.forEach(function(span) {
|
||||||
span.set('text', "");
|
span.set("text", "");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update renamed column for matched rows
|
// Update renamed column for matched rows
|
||||||
for (let i = 0; i < matchedRows.length; ++i) {
|
for (let i = 0; i < matchedRows.length; ++i) {
|
||||||
const row = matchedRows[i];
|
const row = matchedRows[i];
|
||||||
$('filesTablefileRenamed' + row.rowId).set('text', row.renamed);
|
$("filesTablefileRenamed" + row.rowId).set("text", row.renamed);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fileRenamer.onInvalidRegex = function(err) {
|
fileRenamer.onInvalidRegex = function(err) {
|
||||||
$('multiRenameSearch').style['border-color'] = '#CC0033';
|
$("multiRenameSearch").style["border-color"] = "#CC0033";
|
||||||
};
|
};
|
||||||
|
|
||||||
// Setup Replace Events that control renaming
|
// Setup Replace Events that control renaming
|
||||||
$('multiRenameReplace').addEvent('input', function(e) {
|
$("multiRenameReplace").addEvent("input", function(e) {
|
||||||
let sanitized = e.target.value.replace(/\n/g, '');
|
let sanitized = e.target.value.replace(/\n/g, "");
|
||||||
$('multiRenameReplace').set('value', sanitized);
|
$("multiRenameReplace").set("value", sanitized);
|
||||||
|
|
||||||
// Replace input has changed
|
// Replace input has changed
|
||||||
$('multiRenameReplace').style['border-color'] = '';
|
$("multiRenameReplace").style["border-color"] = "";
|
||||||
LocalPreferences.set('multirename_replace', sanitized);
|
LocalPreferences.set("multirename_replace", sanitized);
|
||||||
fileRenamer.setReplacement(sanitized);
|
fileRenamer.setReplacement(sanitized);
|
||||||
});
|
});
|
||||||
$('applies_to_option').addEvent('change', function(e) {
|
$("applies_to_option").addEvent("change", function(e) {
|
||||||
fileRenamer.appliesTo = e.target.value;
|
fileRenamer.appliesTo = e.target.value;
|
||||||
LocalPreferences.set('multirename_appliesTo', e.target.value);
|
LocalPreferences.set("multirename_appliesTo", e.target.value);
|
||||||
fileRenamer.update();
|
fileRenamer.update();
|
||||||
});
|
});
|
||||||
$('include_files').addEvent('change', function(e) {
|
$("include_files").addEvent("change", function(e) {
|
||||||
fileRenamer.includeFiles = e.target.checked;
|
fileRenamer.includeFiles = e.target.checked;
|
||||||
LocalPreferences.set('multirename_includeFiles', e.target.checked);
|
LocalPreferences.set("multirename_includeFiles", e.target.checked);
|
||||||
fileRenamer.update();
|
fileRenamer.update();
|
||||||
});
|
});
|
||||||
$('include_folders').addEvent('change', function(e) {
|
$("include_folders").addEvent("change", function(e) {
|
||||||
fileRenamer.includeFolders = e.target.checked;
|
fileRenamer.includeFolders = e.target.checked;
|
||||||
LocalPreferences.set('multirename_includeFolders', e.target.checked);
|
LocalPreferences.set("multirename_includeFolders", e.target.checked);
|
||||||
fileRenamer.update();
|
fileRenamer.update();
|
||||||
});
|
});
|
||||||
$('file_counter').addEvent('input', function(e) {
|
$("file_counter").addEvent("input", function(e) {
|
||||||
let value = e.target.valueAsNumber;
|
let value = e.target.valueAsNumber;
|
||||||
if (!value) { value = 0; }
|
if (!value) { value = 0; }
|
||||||
if (value < 0) { value = 0; }
|
if (value < 0) { value = 0; }
|
||||||
if (value > 99999999) { value = 99999999; }
|
if (value > 99999999) { value = 99999999; }
|
||||||
fileRenamer.fileEnumerationStart = value;
|
fileRenamer.fileEnumerationStart = value;
|
||||||
$('file_counter').set('value', value);
|
$("file_counter").set("value", value);
|
||||||
LocalPreferences.set('multirename_fileEnumerationStart', value);
|
LocalPreferences.set("multirename_fileEnumerationStart", value);
|
||||||
fileRenamer.update();
|
fileRenamer.update();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Setup Rename Operation Events
|
// Setup Rename Operation Events
|
||||||
$('renameButton').addEvent('click', function(e) {
|
$("renameButton").addEvent("click", function(e) {
|
||||||
// Disable Search Options
|
// Disable Search Options
|
||||||
$('multiRenameSearch').disabled = true;
|
$("multiRenameSearch").disabled = true;
|
||||||
$('use_regex_search').disabled = true;
|
$("use_regex_search").disabled = true;
|
||||||
$('match_all_occurrences').disabled = true;
|
$("match_all_occurrences").disabled = true;
|
||||||
$('case_sensitive').disabled = true;
|
$("case_sensitive").disabled = true;
|
||||||
// Disable Replace Options
|
// Disable Replace Options
|
||||||
$('multiRenameReplace').disabled = true;
|
$("multiRenameReplace").disabled = true;
|
||||||
$('applies_to_option').disabled = true;
|
$("applies_to_option").disabled = true;
|
||||||
$('include_files').disabled = true;
|
$("include_files").disabled = true;
|
||||||
$('include_folders').disabled = true;
|
$("include_folders").disabled = true;
|
||||||
$('file_counter').disabled = true;
|
$("file_counter").disabled = true;
|
||||||
// Disable Rename Buttons
|
// Disable Rename Buttons
|
||||||
$('renameButton').disabled = true;
|
$("renameButton").disabled = true;
|
||||||
$('renameOptions').disabled = true;
|
$("renameOptions").disabled = true;
|
||||||
// Clear error text
|
// Clear error text
|
||||||
$('rename_error').set('text', '');
|
$("rename_error").set("text", "");
|
||||||
fileRenamer.rename();
|
fileRenamer.rename();
|
||||||
});
|
});
|
||||||
fileRenamer.onRenamed = function(rows) {
|
fileRenamer.onRenamed = function(rows) {
|
||||||
// Disable Search Options
|
// Disable Search Options
|
||||||
$('multiRenameSearch').disabled = false;
|
$("multiRenameSearch").disabled = false;
|
||||||
$('use_regex_search').disabled = false;
|
$("use_regex_search").disabled = false;
|
||||||
$('match_all_occurrences').disabled = false;
|
$("match_all_occurrences").disabled = false;
|
||||||
$('case_sensitive').disabled = false;
|
$("case_sensitive").disabled = false;
|
||||||
// Disable Replace Options
|
// Disable Replace Options
|
||||||
$('multiRenameReplace').disabled = false;
|
$("multiRenameReplace").disabled = false;
|
||||||
$('applies_to_option').disabled = false;
|
$("applies_to_option").disabled = false;
|
||||||
$('include_files').disabled = false;
|
$("include_files").disabled = false;
|
||||||
$('include_folders').disabled = false;
|
$("include_folders").disabled = false;
|
||||||
$('file_counter').disabled = false;
|
$("file_counter").disabled = false;
|
||||||
// Disable Rename Buttons
|
// Disable Rename Buttons
|
||||||
$('renameButton').disabled = false;
|
$("renameButton").disabled = false;
|
||||||
$('renameOptions').disabled = false;
|
$("renameOptions").disabled = false;
|
||||||
|
|
||||||
// Recreate table
|
// Recreate table
|
||||||
let selectedRows = bulkRenameFilesTable.getSelectedRows().map(row => row.rowId.toString());
|
let selectedRows = bulkRenameFilesTable.getSelectedRows().map(row => row.rowId.toString());
|
||||||
|
@ -273,16 +273,16 @@
|
||||||
// Adjust file enumeration count by 1 when replacing single files to prevent naming conflicts
|
// Adjust file enumeration count by 1 when replacing single files to prevent naming conflicts
|
||||||
if (!fileRenamer.replaceAll) {
|
if (!fileRenamer.replaceAll) {
|
||||||
fileRenamer.fileEnumerationStart++;
|
fileRenamer.fileEnumerationStart++;
|
||||||
$('file_counter').set('value', fileRenamer.fileEnumerationStart);
|
$("file_counter").set("value", fileRenamer.fileEnumerationStart);
|
||||||
}
|
}
|
||||||
setupTable(selectedRows);
|
setupTable(selectedRows);
|
||||||
};
|
};
|
||||||
fileRenamer.onRenameError = function(err, row) {
|
fileRenamer.onRenameError = function(err, row) {
|
||||||
if (err.xhr.status === 409) {
|
if (err.xhr.status === 409) {
|
||||||
$('rename_error').set('text', `QBT_TR(Rename failed: file or folder already exists)QBT_TR[CONTEXT=PropertiesWidget] \`${row.renamed}\``);
|
$("rename_error").set("text", `QBT_TR(Rename failed: file or folder already exists)QBT_TR[CONTEXT=PropertiesWidget] \`${row.renamed}\``);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$('renameOptions').addEvent('change', function(e) {
|
$("renameOptions").addEvent("change", function(e) {
|
||||||
const combobox = e.target;
|
const combobox = e.target;
|
||||||
const replaceOperation = combobox.value;
|
const replaceOperation = combobox.value;
|
||||||
if (replaceOperation === "Replace") {
|
if (replaceOperation === "Replace") {
|
||||||
|
@ -294,17 +294,17 @@
|
||||||
else {
|
else {
|
||||||
fileRenamer.replaceAll = false;
|
fileRenamer.replaceAll = false;
|
||||||
}
|
}
|
||||||
LocalPreferences.set('multirename_replaceAll', fileRenamer.replaceAll);
|
LocalPreferences.set("multirename_replaceAll", fileRenamer.replaceAll);
|
||||||
$('renameButton').set('value', replaceOperation);
|
$("renameButton").set("value", replaceOperation);
|
||||||
});
|
});
|
||||||
$('closeButton').addEvent('click', function() {
|
$("closeButton").addEvent("click", function() {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
// synchronize header scrolling to table body
|
// synchronize header scrolling to table body
|
||||||
$('bulkRenameFilesTableDiv').onscroll = function() {
|
$("bulkRenameFilesTableDiv").onscroll = function() {
|
||||||
const length = $(this).scrollLeft;
|
const length = $(this).scrollLeft;
|
||||||
$('bulkRenameFilesTableFixedHeaderDiv').scrollLeft = length;
|
$("bulkRenameFilesTableFixedHeaderDiv").scrollLeft = length;
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleTorrentFiles = function(files, selectedRows) {
|
var handleTorrentFiles = function(files, selectedRows) {
|
||||||
|
@ -336,7 +336,7 @@
|
||||||
pathItems.pop(); // remove last item (i.e. file name)
|
pathItems.pop(); // remove last item (i.e. file name)
|
||||||
let parent = rootNode;
|
let parent = rootNode;
|
||||||
pathItems.forEach(function(folderName) {
|
pathItems.forEach(function(folderName) {
|
||||||
if (folderName === '.unwanted') {
|
if (folderName === ".unwanted") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,9 +396,9 @@
|
||||||
|
|
||||||
var setupTable = function(selectedRows) {
|
var setupTable = function(selectedRows) {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: new URI('api/v2/torrents/files?hash=' + data.hash),
|
url: new URI("api/v2/torrents/files?hash=" + data.hash),
|
||||||
noCache: true,
|
noCache: true,
|
||||||
method: 'get',
|
method: "get",
|
||||||
onSuccess: function(files) {
|
onSuccess: function(files) {
|
||||||
if (files.length === 0) {
|
if (files.length === 0) {
|
||||||
bulkRenameFilesTable.clear();
|
bulkRenameFilesTable.clear();
|
||||||
|
|
|
@ -9,57 +9,57 @@
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': (event) => {
|
"Enter": (event) => {
|
||||||
$('renameButton').click();
|
$("renameButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': (event) => {
|
"Escape": (event) => {
|
||||||
window.parent.MochaUI.closeWindow(window.parent.$('renameRulePage'));
|
window.parent.MochaUI.closeWindow(window.parent.$("renameRulePage"));
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': (event) => {
|
"Esc": (event) => {
|
||||||
window.parent.MochaUI.closeWindow(window.parent.$('renameRulePage'));
|
window.parent.MochaUI.closeWindow(window.parent.$("renameRulePage"));
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
window.addEvent('domready', () => {
|
window.addEvent("domready", () => {
|
||||||
const oldName = new URI().getData('rule');
|
const oldName = new URI().getData("rule");
|
||||||
|
|
||||||
$('rename').value = oldName;
|
$("rename").value = oldName;
|
||||||
$('rename').focus();
|
$("rename").focus();
|
||||||
$('rename').setSelectionRange(0, oldName.length);
|
$("rename").setSelectionRange(0, oldName.length);
|
||||||
|
|
||||||
$('renameButton').addEvent('click', (e) => {
|
$("renameButton").addEvent("click", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
// check field
|
// check field
|
||||||
const newName = $('rename').value.trim();
|
const newName = $("rename").value.trim();
|
||||||
if (newName === '') {
|
if (newName === "") {
|
||||||
alert('QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]');
|
alert("QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newName === oldName) {
|
if (newName === oldName) {
|
||||||
alert('QBT_TR(Name is unchanged)QBT_TR[CONTEXT=HttpServer]');
|
alert("QBT_TR(Name is unchanged)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('renameButton').disabled = true;
|
$("renameButton").disabled = true;
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/rss/renameRule',
|
url: "api/v2/rss/renameRule",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
ruleName: oldName,
|
ruleName: oldName,
|
||||||
newRuleName: newName
|
newRuleName: newName
|
||||||
},
|
},
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
window.parent.qBittorrent.RssDownloader.updateRulesList();
|
window.parent.qBittorrent.RssDownloader.updateRulesList();
|
||||||
window.parent.MochaUI.closeWindow(window.parent.$('renameRulePage'));
|
window.parent.MochaUI.closeWindow(window.parent.$("renameRulePage"));
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined)
|
if (window.qBittorrent === undefined)
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -46,7 +46,7 @@ window.qBittorrent.Cache = (() => {
|
||||||
const keys = Reflect.ownKeys(obj);
|
const keys = Reflect.ownKeys(obj);
|
||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
const value = obj[key];
|
const value = obj[key];
|
||||||
if ((value && (typeof value === 'object')) || (typeof value === 'function'))
|
if ((value && (typeof value === "object")) || (typeof value === "function"))
|
||||||
deepFreeze(value);
|
deepFreeze(value);
|
||||||
}
|
}
|
||||||
Object.freeze(obj);
|
Object.freeze(obj);
|
||||||
|
@ -57,8 +57,8 @@ window.qBittorrent.Cache = (() => {
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: 'api/v2/app/buildInfo',
|
url: "api/v2/app/buildInfo",
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onSuccess: (responseJSON) => {
|
onSuccess: (responseJSON) => {
|
||||||
if (!responseJSON)
|
if (!responseJSON)
|
||||||
|
@ -84,11 +84,11 @@ window.qBittorrent.Cache = (() => {
|
||||||
// }
|
// }
|
||||||
init(obj = {}) {
|
init(obj = {}) {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: 'api/v2/app/preferences',
|
url: "api/v2/app/preferences",
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onFailure: (xhr) => {
|
onFailure: (xhr) => {
|
||||||
if (typeof obj.onFailure === 'function')
|
if (typeof obj.onFailure === "function")
|
||||||
obj.onFailure(xhr);
|
obj.onFailure(xhr);
|
||||||
},
|
},
|
||||||
onSuccess: (responseJSON, responseText) => {
|
onSuccess: (responseJSON, responseText) => {
|
||||||
|
@ -98,7 +98,7 @@ window.qBittorrent.Cache = (() => {
|
||||||
deepFreeze(responseJSON);
|
deepFreeze(responseJSON);
|
||||||
this.#m_store = responseJSON;
|
this.#m_store = responseJSON;
|
||||||
|
|
||||||
if (typeof obj.onSuccess === 'function')
|
if (typeof obj.onSuccess === "function")
|
||||||
obj.onSuccess(responseJSON, responseText);
|
obj.onSuccess(responseJSON, responseText);
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -114,19 +114,19 @@ window.qBittorrent.Cache = (() => {
|
||||||
// onSuccess: () => {}
|
// onSuccess: () => {}
|
||||||
// }
|
// }
|
||||||
set(obj) {
|
set(obj) {
|
||||||
if (typeof obj !== 'object')
|
if (typeof obj !== "object")
|
||||||
throw new Error('`obj` is not an object.');
|
throw new Error("`obj` is not an object.");
|
||||||
if (typeof obj.data !== 'object')
|
if (typeof obj.data !== "object")
|
||||||
throw new Error('`data` is not an object.');
|
throw new Error("`data` is not an object.");
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/app/setPreferences',
|
url: "api/v2/app/setPreferences",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
'json': JSON.stringify(obj.data)
|
"json": JSON.stringify(obj.data)
|
||||||
},
|
},
|
||||||
onFailure: (xhr) => {
|
onFailure: (xhr) => {
|
||||||
if (typeof obj.onFailure === 'function')
|
if (typeof obj.onFailure === "function")
|
||||||
obj.onFailure(xhr);
|
obj.onFailure(xhr);
|
||||||
},
|
},
|
||||||
onSuccess: (responseText, responseXML) => {
|
onSuccess: (responseText, responseXML) => {
|
||||||
|
@ -140,7 +140,7 @@ window.qBittorrent.Cache = (() => {
|
||||||
}
|
}
|
||||||
deepFreeze(this.#m_store);
|
deepFreeze(this.#m_store);
|
||||||
|
|
||||||
if (typeof obj.onSuccess === 'function')
|
if (typeof obj.onSuccess === "function")
|
||||||
obj.onSuccess(responseText, responseXML);
|
obj.onSuccess(responseText, responseXML);
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -148,12 +148,12 @@ window.qBittorrent.Cache = (() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
class QbtVersionCache {
|
class QbtVersionCache {
|
||||||
#m_store = '';
|
#m_store = "";
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/app/version',
|
url: "api/v2/app/version",
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onSuccess: (responseText) => {
|
onSuccess: (responseText) => {
|
||||||
if (!responseText)
|
if (!responseText)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -54,9 +54,9 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
//options
|
//options
|
||||||
options: {
|
options: {
|
||||||
actions: {},
|
actions: {},
|
||||||
menu: 'menu_id',
|
menu: "menu_id",
|
||||||
stopEvent: true,
|
stopEvent: true,
|
||||||
targets: 'body',
|
targets: "body",
|
||||||
offsets: {
|
offsets: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0
|
y: 0
|
||||||
|
@ -79,14 +79,14 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
|
|
||||||
//fx
|
//fx
|
||||||
this.fx = new Fx.Tween(this.menu, {
|
this.fx = new Fx.Tween(this.menu, {
|
||||||
property: 'opacity',
|
property: "opacity",
|
||||||
duration: this.options.fadeSpeed,
|
duration: this.options.fadeSpeed,
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
if (this.getStyle('opacity')) {
|
if (this.getStyle("opacity")) {
|
||||||
this.setStyle('visibility', 'visible');
|
this.setStyle("visibility", "visible");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.setStyle('visibility', 'hidden');
|
this.setStyle("visibility", "hidden");
|
||||||
}
|
}
|
||||||
}.bind(this.menu)
|
}.bind(this.menu)
|
||||||
});
|
});
|
||||||
|
@ -96,9 +96,9 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
|
|
||||||
//hide the menu
|
//hide the menu
|
||||||
this.menu.setStyles({
|
this.menu.setStyles({
|
||||||
'position': 'absolute',
|
"position": "absolute",
|
||||||
'top': '-900000px',
|
"top": "-900000px",
|
||||||
'display': 'block'
|
"display": "block"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -107,13 +107,13 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
|
|
||||||
const 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);
|
||||||
|
|
||||||
// draw the menu off-screen to know the menu dimensions
|
// draw the menu off-screen to know the menu dimensions
|
||||||
this.menu.setStyles({
|
this.menu.setStyles({
|
||||||
left: '-999em',
|
left: "-999em",
|
||||||
top: '-999em'
|
top: "-999em"
|
||||||
});
|
});
|
||||||
|
|
||||||
// position the menu
|
// position the menu
|
||||||
|
@ -130,16 +130,16 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
this.menu.setStyles({
|
this.menu.setStyles({
|
||||||
left: xPosMenu,
|
left: xPosMenu,
|
||||||
top: yPosMenu,
|
top: yPosMenu,
|
||||||
position: 'absolute',
|
position: "absolute",
|
||||||
'z-index': '2000'
|
"z-index": "2000"
|
||||||
});
|
});
|
||||||
|
|
||||||
// position the sub-menu
|
// position the sub-menu
|
||||||
const uls = this.menu.getElementsByTagName('ul');
|
const uls = this.menu.getElementsByTagName("ul");
|
||||||
for (let i = 0; i < uls.length; ++i) {
|
for (let i = 0; i < uls.length; ++i) {
|
||||||
const 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);
|
||||||
const rectParent = ul.parentNode.getBoundingClientRect();
|
const rectParent = ul.parentNode.getBoundingClientRect();
|
||||||
const xPosOrigin = rectParent.left;
|
const xPosOrigin = rectParent.left;
|
||||||
const yPosOrigin = rectParent.bottom;
|
const yPosOrigin = rectParent.bottom;
|
||||||
|
@ -154,26 +154,26 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
if (yPos < 0)
|
if (yPos < 0)
|
||||||
yPos = 0;
|
yPos = 0;
|
||||||
ul.setStyles({
|
ul.setStyles({
|
||||||
'margin-left': xPos - xPosOrigin,
|
"margin-left": xPos - xPosOrigin,
|
||||||
'margin-top': yPos - yPosOrigin
|
"margin-top": yPos - yPosOrigin
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setupEventListeners: function(elem) {
|
setupEventListeners: function(elem) {
|
||||||
elem.addEvent('contextmenu', function(e) {
|
elem.addEvent("contextmenu", function(e) {
|
||||||
this.triggerMenu(e, elem);
|
this.triggerMenu(e, elem);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
elem.addEvent('click', function(e) {
|
elem.addEvent("click", function(e) {
|
||||||
this.hide();
|
this.hide();
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
elem.addEvent('touchstart', function(e) {
|
elem.addEvent("touchstart", function(e) {
|
||||||
this.hide();
|
this.hide();
|
||||||
this.touchStartAt = performance.now();
|
this.touchStartAt = performance.now();
|
||||||
this.touchStartEvent = e;
|
this.touchStartEvent = e;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
elem.addEvent('touchend', function(e) {
|
elem.addEvent("touchend", function(e) {
|
||||||
const now = performance.now();
|
const now = performance.now();
|
||||||
const touchStartAt = this.touchStartAt;
|
const touchStartAt = this.touchStartAt;
|
||||||
const touchStartEvent = this.touchStartEvent;
|
const touchStartEvent = this.touchStartEvent;
|
||||||
|
@ -190,8 +190,8 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
|
|
||||||
addTarget: function(t) {
|
addTarget: function(t) {
|
||||||
// prevent long press from selecting this text
|
// prevent long press from selecting this text
|
||||||
t.style.setProperty('user-select', 'none');
|
t.style.setProperty("user-select", "none");
|
||||||
t.style.setProperty('-webkit-user-select', 'none');
|
t.style.setProperty("-webkit-user-select", "none");
|
||||||
|
|
||||||
this.targets[this.targets.length] = t;
|
this.targets[this.targets.length] = t;
|
||||||
this.setupEventListeners(t);
|
this.setupEventListeners(t);
|
||||||
|
@ -220,18 +220,18 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
}.bind(this), this);
|
}.bind(this), this);
|
||||||
|
|
||||||
/* menu items */
|
/* menu items */
|
||||||
this.menu.getElements('a').each(function(item) {
|
this.menu.getElements("a").each(function(item) {
|
||||||
item.addEvent('click', function(e) {
|
item.addEvent("click", function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!item.hasClass('disabled')) {
|
if (!item.hasClass("disabled")) {
|
||||||
this.execute(item.get('href').split('#')[1], $(this.options.element));
|
this.execute(item.get("href").split("#")[1], $(this.options.element));
|
||||||
this.fireEvent('click', [item, e]);
|
this.fireEvent("click", [item, e]);
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
//hide on body click
|
//hide on body click
|
||||||
$(document.body).addEvent('click', function() {
|
$(document.body).addEvent("click", function() {
|
||||||
this.hide();
|
this.hide();
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
@ -243,40 +243,40 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
if (lastShownContextMenu && (lastShownContextMenu !== this))
|
if (lastShownContextMenu && (lastShownContextMenu !== this))
|
||||||
lastShownContextMenu.hide();
|
lastShownContextMenu.hide();
|
||||||
this.fx.start(1);
|
this.fx.start(1);
|
||||||
this.fireEvent('show');
|
this.fireEvent("show");
|
||||||
lastShownContextMenu = this;
|
lastShownContextMenu = this;
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
//hide the menu
|
//hide the menu
|
||||||
hide: function(trigger) {
|
hide: function(trigger) {
|
||||||
if (lastShownContextMenu && (lastShownContextMenu.menu.style.visibility !== 'hidden')) {
|
if (lastShownContextMenu && (lastShownContextMenu.menu.style.visibility !== "hidden")) {
|
||||||
this.fx.start(0);
|
this.fx.start(0);
|
||||||
//this.menu.fade('out');
|
//this.menu.fade('out');
|
||||||
this.fireEvent('hide');
|
this.fireEvent("hide");
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
setItemChecked: function(item, checked) {
|
setItemChecked: function(item, checked) {
|
||||||
this.menu.getElement('a[href$=' + item + ']').firstChild.style.opacity =
|
this.menu.getElement("a[href$=" + item + "]").firstChild.style.opacity =
|
||||||
checked ? '1' : '0';
|
checked ? "1" : "0";
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
getItemChecked: function(item) {
|
getItemChecked: function(item) {
|
||||||
return this.menu.getElement('a[href$=' + item + ']').firstChild.style.opacity !== '0';
|
return this.menu.getElement("a[href$=" + item + "]").firstChild.style.opacity !== "0";
|
||||||
},
|
},
|
||||||
|
|
||||||
//hide an item
|
//hide an item
|
||||||
hideItem: function(item) {
|
hideItem: function(item) {
|
||||||
this.menu.getElement('a[href$=' + item + ']').parentNode.addClass('invisible');
|
this.menu.getElement("a[href$=" + item + "]").parentNode.addClass("invisible");
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
//show an item
|
//show an item
|
||||||
showItem: function(item) {
|
showItem: function(item) {
|
||||||
this.menu.getElement('a[href$=' + item + ']').parentNode.removeClass('invisible');
|
this.menu.getElement("a[href$=" + item + "]").parentNode.removeClass("invisible");
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -323,37 +323,37 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
selectedRows.forEach((item, index) => {
|
selectedRows.forEach((item, index) => {
|
||||||
const 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;
|
||||||
else
|
else
|
||||||
there_are_seq_dl = true;
|
there_are_seq_dl = true;
|
||||||
|
|
||||||
if (data['f_l_piece_prio'] !== true)
|
if (data["f_l_piece_prio"] !== true)
|
||||||
all_are_f_l_piece_prio = false;
|
all_are_f_l_piece_prio = false;
|
||||||
else
|
else
|
||||||
there_are_f_l_piece_prio = true;
|
there_are_f_l_piece_prio = true;
|
||||||
|
|
||||||
if (data['progress'] !== 1.0) // not downloaded
|
if (data["progress"] !== 1.0) // not downloaded
|
||||||
all_are_downloaded = false;
|
all_are_downloaded = false;
|
||||||
else if (data['super_seeding'] !== true)
|
else if (data["super_seeding"] !== true)
|
||||||
all_are_super_seeding = false;
|
all_are_super_seeding = false;
|
||||||
|
|
||||||
if ((data['state'] !== 'stoppedUP') && (data['state'] !== 'stoppedDL'))
|
if ((data["state"] !== "stoppedUP") && (data["state"] !== "stoppedDL"))
|
||||||
all_are_stopped = false;
|
all_are_stopped = false;
|
||||||
else
|
else
|
||||||
there_are_stopped = true;
|
there_are_stopped = true;
|
||||||
|
|
||||||
if (data['force_start'] !== true)
|
if (data["force_start"] !== true)
|
||||||
all_are_force_start = false;
|
all_are_force_start = false;
|
||||||
else
|
else
|
||||||
there_are_force_start = true;
|
there_are_force_start = true;
|
||||||
|
|
||||||
if (data['auto_tmm'] === true)
|
if (data["auto_tmm"] === true)
|
||||||
there_are_auto_tmm = true;
|
there_are_auto_tmm = true;
|
||||||
else
|
else
|
||||||
all_are_auto_tmm = false;
|
all_are_auto_tmm = false;
|
||||||
|
|
||||||
const torrentTags = data['tags'].split(', ');
|
const torrentTags = data["tags"].split(", ");
|
||||||
for (const tag of torrentTags) {
|
for (const tag of torrentTags) {
|
||||||
const count = tagCount.get(tag);
|
const count = tagCount.get(tag);
|
||||||
tagCount.set(tag, ((count !== undefined) ? (count + 1) : 1));
|
tagCount.set(tag, ((count !== undefined) ? (count + 1) : 1));
|
||||||
|
@ -363,71 +363,71 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
// hide renameFiles when more than 1 torrent is selected
|
// hide renameFiles when more than 1 torrent is selected
|
||||||
if (selectedRows.length === 1) {
|
if (selectedRows.length === 1) {
|
||||||
const data = torrentsTable.rows.get(selectedRows[0]).full_data;
|
const data = torrentsTable.rows.get(selectedRows[0]).full_data;
|
||||||
let metadata_downloaded = !((data['state'] === 'metaDL') || (data['state'] === 'forcedMetaDL') || (data['total_size'] === -1));
|
let metadata_downloaded = !((data["state"] === "metaDL") || (data["state"] === "forcedMetaDL") || (data["total_size"] === -1));
|
||||||
|
|
||||||
// hide renameFiles when metadata hasn't been downloaded yet
|
// hide renameFiles when metadata hasn't been downloaded yet
|
||||||
metadata_downloaded
|
metadata_downloaded
|
||||||
? this.showItem('renameFiles')
|
? this.showItem("renameFiles")
|
||||||
: this.hideItem('renameFiles');
|
: this.hideItem("renameFiles");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.hideItem('renameFiles');
|
this.hideItem("renameFiles");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (all_are_downloaded) {
|
if (all_are_downloaded) {
|
||||||
this.hideItem('downloadLimit');
|
this.hideItem("downloadLimit");
|
||||||
this.menu.getElement('a[href$=uploadLimit]').parentNode.addClass('separator');
|
this.menu.getElement("a[href$=uploadLimit]").parentNode.addClass("separator");
|
||||||
this.hideItem('sequentialDownload');
|
this.hideItem("sequentialDownload");
|
||||||
this.hideItem('firstLastPiecePrio');
|
this.hideItem("firstLastPiecePrio");
|
||||||
this.showItem('superSeeding');
|
this.showItem("superSeeding");
|
||||||
this.setItemChecked('superSeeding', all_are_super_seeding);
|
this.setItemChecked("superSeeding", all_are_super_seeding);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const show_seq_dl = (all_are_seq_dl || !there_are_seq_dl);
|
const show_seq_dl = (all_are_seq_dl || !there_are_seq_dl);
|
||||||
const show_f_l_piece_prio = (all_are_f_l_piece_prio || !there_are_f_l_piece_prio);
|
const show_f_l_piece_prio = (all_are_f_l_piece_prio || !there_are_f_l_piece_prio);
|
||||||
|
|
||||||
if (!show_seq_dl && show_f_l_piece_prio)
|
if (!show_seq_dl && show_f_l_piece_prio)
|
||||||
this.menu.getElement('a[href$=firstLastPiecePrio]').parentNode.addClass('separator');
|
this.menu.getElement("a[href$=firstLastPiecePrio]").parentNode.addClass("separator");
|
||||||
else
|
else
|
||||||
this.menu.getElement('a[href$=firstLastPiecePrio]').parentNode.removeClass('separator');
|
this.menu.getElement("a[href$=firstLastPiecePrio]").parentNode.removeClass("separator");
|
||||||
|
|
||||||
if (show_seq_dl)
|
if (show_seq_dl)
|
||||||
this.showItem('sequentialDownload');
|
this.showItem("sequentialDownload");
|
||||||
else
|
else
|
||||||
this.hideItem('sequentialDownload');
|
this.hideItem("sequentialDownload");
|
||||||
|
|
||||||
if (show_f_l_piece_prio)
|
if (show_f_l_piece_prio)
|
||||||
this.showItem('firstLastPiecePrio');
|
this.showItem("firstLastPiecePrio");
|
||||||
else
|
else
|
||||||
this.hideItem('firstLastPiecePrio');
|
this.hideItem("firstLastPiecePrio");
|
||||||
|
|
||||||
this.setItemChecked('sequentialDownload', all_are_seq_dl);
|
this.setItemChecked("sequentialDownload", all_are_seq_dl);
|
||||||
this.setItemChecked('firstLastPiecePrio', all_are_f_l_piece_prio);
|
this.setItemChecked("firstLastPiecePrio", all_are_f_l_piece_prio);
|
||||||
|
|
||||||
this.showItem('downloadLimit');
|
this.showItem("downloadLimit");
|
||||||
this.menu.getElement('a[href$=uploadLimit]').parentNode.removeClass('separator');
|
this.menu.getElement("a[href$=uploadLimit]").parentNode.removeClass("separator");
|
||||||
this.hideItem('superSeeding');
|
this.hideItem("superSeeding");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.showItem('start');
|
this.showItem("start");
|
||||||
this.showItem('stop');
|
this.showItem("stop");
|
||||||
this.showItem('forceStart');
|
this.showItem("forceStart");
|
||||||
if (all_are_stopped)
|
if (all_are_stopped)
|
||||||
this.hideItem('stop');
|
this.hideItem("stop");
|
||||||
else if (all_are_force_start)
|
else if (all_are_force_start)
|
||||||
this.hideItem('forceStart');
|
this.hideItem("forceStart");
|
||||||
else if (!there_are_stopped && !there_are_force_start)
|
else if (!there_are_stopped && !there_are_force_start)
|
||||||
this.hideItem('start');
|
this.hideItem("start");
|
||||||
|
|
||||||
if (!all_are_auto_tmm && there_are_auto_tmm) {
|
if (!all_are_auto_tmm && there_are_auto_tmm) {
|
||||||
this.hideItem('autoTorrentManagement');
|
this.hideItem("autoTorrentManagement");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.showItem('autoTorrentManagement');
|
this.showItem("autoTorrentManagement");
|
||||||
this.setItemChecked('autoTorrentManagement', all_are_auto_tmm);
|
this.setItemChecked("autoTorrentManagement", all_are_auto_tmm);
|
||||||
}
|
}
|
||||||
|
|
||||||
const contextTagList = $('contextTagList');
|
const contextTagList = $("contextTagList");
|
||||||
tagList.forEach((tag, tagHash) => {
|
tagList.forEach((tag, tagHash) => {
|
||||||
const checkbox = contextTagList.getElement(`a[href="#Tag/${tagHash}"] input[type="checkbox"]`);
|
const checkbox = contextTagList.getElement(`a[href="#Tag/${tagHash}"] input[type="checkbox"]`);
|
||||||
const count = tagCount.get(tag.name);
|
const count = tagCount.get(tag.name);
|
||||||
|
@ -439,12 +439,12 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
updateCategoriesSubMenu: function(categoryList) {
|
updateCategoriesSubMenu: function(categoryList) {
|
||||||
const contextCategoryList = $('contextCategoryList');
|
const contextCategoryList = $("contextCategoryList");
|
||||||
contextCategoryList.getChildren().each(c => c.destroy());
|
contextCategoryList.getChildren().each(c => c.destroy());
|
||||||
contextCategoryList.appendChild(new Element('li', {
|
contextCategoryList.appendChild(new Element("li", {
|
||||||
html: '<a href="javascript:torrentNewCategoryFN();"><img src="images/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/list-add.svg" alt="QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(New...)QBT_TR[CONTEXT=TransferListWidget]</a>'
|
||||||
}));
|
}));
|
||||||
contextCategoryList.appendChild(new Element('li', {
|
contextCategoryList.appendChild(new Element("li", {
|
||||||
html: '<a href="javascript:torrentSetCategoryFN(0);"><img src="images/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/edit-clear.svg" alt="QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]"/> QBT_TR(Reset)QBT_TR[CONTEXT=TransferListWidget]</a>'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -458,11 +458,11 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
|
|
||||||
let first = true;
|
let first = true;
|
||||||
for (const { categoryName, categoryHash } of sortedCategories) {
|
for (const { categoryName, categoryHash } of sortedCategories) {
|
||||||
const el = new Element('li', {
|
const el = new Element("li", {
|
||||||
html: `<a href="javascript:torrentSetCategoryFN(${categoryHash});"><img src="images/view-categories.svg"/>${window.qBittorrent.Misc.escapeHtml(categoryName)}</a>`
|
html: `<a href="javascript:torrentSetCategoryFN(${categoryHash});"><img src="images/view-categories.svg"/>${window.qBittorrent.Misc.escapeHtml(categoryName)}</a>`
|
||||||
});
|
});
|
||||||
if (first) {
|
if (first) {
|
||||||
el.addClass('separator');
|
el.addClass("separator");
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
contextCategoryList.appendChild(el);
|
contextCategoryList.appendChild(el);
|
||||||
|
@ -470,21 +470,21 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
updateTagsSubMenu: function(tagList) {
|
updateTagsSubMenu: function(tagList) {
|
||||||
const contextTagList = $('contextTagList');
|
const contextTagList = $("contextTagList");
|
||||||
while (contextTagList.firstChild !== null)
|
while (contextTagList.firstChild !== null)
|
||||||
contextTagList.removeChild(contextTagList.firstChild);
|
contextTagList.removeChild(contextTagList.firstChild);
|
||||||
|
|
||||||
contextTagList.appendChild(new Element('li', {
|
contextTagList.appendChild(new Element("li", {
|
||||||
html: '<a href="javascript:torrentAddTagsFN();">'
|
html: '<a href="javascript:torrentAddTagsFN();">'
|
||||||
+ '<img src="images/list-add.svg" alt="QBT_TR(Add...)QBT_TR[CONTEXT=TransferListWidget]"/>'
|
+ '<img src="images/list-add.svg" alt="QBT_TR(Add...)QBT_TR[CONTEXT=TransferListWidget]"/>'
|
||||||
+ ' QBT_TR(Add...)QBT_TR[CONTEXT=TransferListWidget]'
|
+ " QBT_TR(Add...)QBT_TR[CONTEXT=TransferListWidget]"
|
||||||
+ '</a>'
|
+ "</a>"
|
||||||
}));
|
}));
|
||||||
contextTagList.appendChild(new Element('li', {
|
contextTagList.appendChild(new Element("li", {
|
||||||
html: '<a href="javascript:torrentRemoveAllTagsFN();">'
|
html: '<a href="javascript:torrentRemoveAllTagsFN();">'
|
||||||
+ '<img src="images/edit-clear.svg" alt="QBT_TR(Remove All)QBT_TR[CONTEXT=TransferListWidget]"/>'
|
+ '<img src="images/edit-clear.svg" alt="QBT_TR(Remove All)QBT_TR[CONTEXT=TransferListWidget]"/>'
|
||||||
+ ' QBT_TR(Remove All)QBT_TR[CONTEXT=TransferListWidget]'
|
+ " QBT_TR(Remove All)QBT_TR[CONTEXT=TransferListWidget]"
|
||||||
+ '</a>'
|
+ "</a>"
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const sortedTags = [];
|
const sortedTags = [];
|
||||||
|
@ -496,13 +496,13 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
|
|
||||||
for (let i = 0; i < sortedTags.length; ++i) {
|
for (let i = 0; i < sortedTags.length; ++i) {
|
||||||
const { tagName, tagHash } = sortedTags[i];
|
const { tagName, tagHash } = sortedTags[i];
|
||||||
const el = new Element('li', {
|
const el = new Element("li", {
|
||||||
html: `<a href="#Tag/${tagHash}" onclick="event.preventDefault(); torrentSetTagsFN(${tagHash}, !event.currentTarget.getElement('input[type=checkbox]').checked);">`
|
html: `<a href="#Tag/${tagHash}" onclick="event.preventDefault(); torrentSetTagsFN(${tagHash}, !event.currentTarget.getElement('input[type=checkbox]').checked);">`
|
||||||
+ '<input type="checkbox" onclick="this.checked = !this.checked;"> ' + window.qBittorrent.Misc.escapeHtml(tagName)
|
+ '<input type="checkbox" onclick="this.checked = !this.checked;"> ' + window.qBittorrent.Misc.escapeHtml(tagName)
|
||||||
+ '</a>'
|
+ "</a>"
|
||||||
});
|
});
|
||||||
if (i === 0)
|
if (i === 0)
|
||||||
el.addClass('separator');
|
el.addClass("separator");
|
||||||
contextTagList.appendChild(el);
|
contextTagList.appendChild(el);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -513,19 +513,19 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
updateMenuItems: function() {
|
updateMenuItems: function() {
|
||||||
const id = Number(this.options.element.id);
|
const id = Number(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");
|
||||||
if (useSubcategories) {
|
if (useSubcategories) {
|
||||||
this.showItem('createSubcategory');
|
this.showItem("createSubcategory");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.hideItem('createSubcategory');
|
this.hideItem("createSubcategory");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.hideItem('editCategory');
|
this.hideItem("editCategory");
|
||||||
this.hideItem('deleteCategory');
|
this.hideItem("deleteCategory");
|
||||||
this.hideItem('createSubcategory');
|
this.hideItem("createSubcategory");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -535,9 +535,9 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
updateMenuItems: function() {
|
updateMenuItems: function() {
|
||||||
const id = Number(this.options.element.id);
|
const id = Number(this.options.element.id);
|
||||||
if ((id !== TAGS_ALL) && (id !== TAGS_UNTAGGED))
|
if ((id !== TAGS_ALL) && (id !== TAGS_UNTAGGED))
|
||||||
this.showItem('deleteTag');
|
this.showItem("deleteTag");
|
||||||
else
|
else
|
||||||
this.hideItem('deleteTag');
|
this.hideItem("deleteTag");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -552,10 +552,10 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.showItem('Enabled');
|
this.showItem("Enabled");
|
||||||
this.setItemChecked('Enabled', this.options.element.getChildren("td")[enabledColumnIndex()].get("html") === "Yes");
|
this.setItemChecked("Enabled", this.options.element.getChildren("td")[enabledColumnIndex()].get("html") === "Yes");
|
||||||
|
|
||||||
this.showItem('Uninstall');
|
this.showItem("Uninstall");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -563,66 +563,66 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
Extends: ContextMenu,
|
Extends: ContextMenu,
|
||||||
updateMenuItems: function() {
|
updateMenuItems: function() {
|
||||||
let selectedRows = window.qBittorrent.Rss.rssFeedTable.selectedRowsIds();
|
let selectedRows = window.qBittorrent.Rss.rssFeedTable.selectedRowsIds();
|
||||||
this.menu.getElement('a[href$=newSubscription]').parentNode.addClass('separator');
|
this.menu.getElement("a[href$=newSubscription]").parentNode.addClass("separator");
|
||||||
switch (selectedRows.length) {
|
switch (selectedRows.length) {
|
||||||
case 0:
|
case 0:
|
||||||
// remove separator on top of newSubscription entry to avoid double line
|
// remove separator on top of newSubscription entry to avoid double line
|
||||||
this.menu.getElement('a[href$=newSubscription]').parentNode.removeClass('separator');
|
this.menu.getElement("a[href$=newSubscription]").parentNode.removeClass("separator");
|
||||||
// menu when nothing selected
|
// menu when nothing selected
|
||||||
this.hideItem('update');
|
this.hideItem("update");
|
||||||
this.hideItem('markRead');
|
this.hideItem("markRead");
|
||||||
this.hideItem('rename');
|
this.hideItem("rename");
|
||||||
this.hideItem('delete');
|
this.hideItem("delete");
|
||||||
this.showItem('newSubscription');
|
this.showItem("newSubscription");
|
||||||
this.showItem('newFolder');
|
this.showItem("newFolder");
|
||||||
this.showItem('updateAll');
|
this.showItem("updateAll");
|
||||||
this.hideItem('copyFeedURL');
|
this.hideItem("copyFeedURL");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (selectedRows[0] === 0) {
|
if (selectedRows[0] === 0) {
|
||||||
// menu when "unread" feed selected
|
// menu when "unread" feed selected
|
||||||
this.showItem('update');
|
this.showItem("update");
|
||||||
this.showItem('markRead');
|
this.showItem("markRead");
|
||||||
this.hideItem('rename');
|
this.hideItem("rename");
|
||||||
this.hideItem('delete');
|
this.hideItem("delete");
|
||||||
this.showItem('newSubscription');
|
this.showItem("newSubscription");
|
||||||
this.hideItem('newFolder');
|
this.hideItem("newFolder");
|
||||||
this.hideItem('updateAll');
|
this.hideItem("updateAll");
|
||||||
this.hideItem('copyFeedURL');
|
this.hideItem("copyFeedURL");
|
||||||
}
|
}
|
||||||
else if (window.qBittorrent.Rss.rssFeedTable.rows[selectedRows[0]].full_data.dataUid === '') {
|
else if (window.qBittorrent.Rss.rssFeedTable.rows[selectedRows[0]].full_data.dataUid === "") {
|
||||||
// menu when single folder selected
|
// menu when single folder selected
|
||||||
this.showItem('update');
|
this.showItem("update");
|
||||||
this.showItem('markRead');
|
this.showItem("markRead");
|
||||||
this.showItem('rename');
|
this.showItem("rename");
|
||||||
this.showItem('delete');
|
this.showItem("delete");
|
||||||
this.showItem('newSubscription');
|
this.showItem("newSubscription");
|
||||||
this.showItem('newFolder');
|
this.showItem("newFolder");
|
||||||
this.hideItem('updateAll');
|
this.hideItem("updateAll");
|
||||||
this.hideItem('copyFeedURL');
|
this.hideItem("copyFeedURL");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// menu when single feed selected
|
// menu when single feed selected
|
||||||
this.showItem('update');
|
this.showItem("update");
|
||||||
this.showItem('markRead');
|
this.showItem("markRead");
|
||||||
this.showItem('rename');
|
this.showItem("rename");
|
||||||
this.showItem('delete');
|
this.showItem("delete");
|
||||||
this.showItem('newSubscription');
|
this.showItem("newSubscription");
|
||||||
this.hideItem('newFolder');
|
this.hideItem("newFolder");
|
||||||
this.hideItem('updateAll');
|
this.hideItem("updateAll");
|
||||||
this.showItem('copyFeedURL');
|
this.showItem("copyFeedURL");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// menu when multiple items selected
|
// menu when multiple items selected
|
||||||
this.showItem('update');
|
this.showItem("update");
|
||||||
this.showItem('markRead');
|
this.showItem("markRead");
|
||||||
this.hideItem('rename');
|
this.hideItem("rename");
|
||||||
this.showItem('delete');
|
this.showItem("delete");
|
||||||
this.hideItem('newSubscription');
|
this.hideItem("newSubscription");
|
||||||
this.hideItem('newFolder');
|
this.hideItem("newFolder");
|
||||||
this.hideItem('updateAll');
|
this.hideItem("updateAll");
|
||||||
this.showItem('copyFeedURL');
|
this.showItem("copyFeedURL");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -639,12 +639,12 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
|
|
||||||
// draw the menu off-screen to know the menu dimensions
|
// draw the menu off-screen to know the menu dimensions
|
||||||
this.menu.setStyles({
|
this.menu.setStyles({
|
||||||
left: '-999em',
|
left: "-999em",
|
||||||
top: '-999em'
|
top: "-999em"
|
||||||
});
|
});
|
||||||
// position the menu
|
// position the menu
|
||||||
let xPosMenu = e.page.x + this.options.offsets.x - $('rssdownloaderpage').offsetLeft;
|
let xPosMenu = e.page.x + this.options.offsets.x - $("rssdownloaderpage").offsetLeft;
|
||||||
let yPosMenu = e.page.y + this.options.offsets.y - $('rssdownloaderpage').offsetTop;
|
let yPosMenu = e.page.y + this.options.offsets.y - $("rssdownloaderpage").offsetTop;
|
||||||
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)
|
||||||
|
@ -655,31 +655,31 @@ window.qBittorrent.ContextMenu = (function() {
|
||||||
this.menu.setStyles({
|
this.menu.setStyles({
|
||||||
left: xPosMenu,
|
left: xPosMenu,
|
||||||
top: yPosMenu,
|
top: yPosMenu,
|
||||||
position: 'absolute',
|
position: "absolute",
|
||||||
'z-index': '2000'
|
"z-index": "2000"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateMenuItems: function() {
|
updateMenuItems: function() {
|
||||||
let selectedRows = window.qBittorrent.RssDownloader.rssDownloaderRulesTable.selectedRowsIds();
|
let selectedRows = window.qBittorrent.RssDownloader.rssDownloaderRulesTable.selectedRowsIds();
|
||||||
this.showItem('addRule');
|
this.showItem("addRule");
|
||||||
switch (selectedRows.length) {
|
switch (selectedRows.length) {
|
||||||
case 0:
|
case 0:
|
||||||
// menu when nothing selected
|
// menu when nothing selected
|
||||||
this.hideItem('deleteRule');
|
this.hideItem("deleteRule");
|
||||||
this.hideItem('renameRule');
|
this.hideItem("renameRule");
|
||||||
this.hideItem('clearDownloadedEpisodes');
|
this.hideItem("clearDownloadedEpisodes");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// menu when single item selected
|
// menu when single item selected
|
||||||
this.showItem('deleteRule');
|
this.showItem("deleteRule");
|
||||||
this.showItem('renameRule');
|
this.showItem("renameRule");
|
||||||
this.showItem('clearDownloadedEpisodes');
|
this.showItem("clearDownloadedEpisodes");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// menu when multiple items selected
|
// menu when multiple items selected
|
||||||
this.showItem('deleteRule');
|
this.showItem("deleteRule");
|
||||||
this.hideItem('renameRule');
|
this.hideItem("renameRule");
|
||||||
this.showItem('clearDownloadedEpisodes');
|
this.showItem("clearDownloadedEpisodes");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -40,8 +40,8 @@ window.qBittorrent.Download = (function() {
|
||||||
|
|
||||||
const getCategories = function() {
|
const getCategories = function() {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: 'api/v2/torrents/categories',
|
url: "api/v2/torrents/categories",
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -49,9 +49,9 @@ window.qBittorrent.Download = (function() {
|
||||||
for (const i in data) {
|
for (const i in data) {
|
||||||
const category = data[i];
|
const category = data[i];
|
||||||
const 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,36 +62,36 @@ window.qBittorrent.Download = (function() {
|
||||||
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
||||||
|
|
||||||
defaultSavePath = pref.save_path;
|
defaultSavePath = pref.save_path;
|
||||||
$('savepath').setProperty('value', defaultSavePath);
|
$("savepath").setProperty("value", defaultSavePath);
|
||||||
$('startTorrent').checked = !pref.add_stopped_enabled;
|
$("startTorrent").checked = !pref.add_stopped_enabled;
|
||||||
$('addToTopOfQueue').checked = pref.add_to_top_of_queue;
|
$("addToTopOfQueue").checked = pref.add_to_top_of_queue;
|
||||||
|
|
||||||
if (pref.auto_tmm_enabled === 1) {
|
if (pref.auto_tmm_enabled === 1) {
|
||||||
$('autoTMM').selectedIndex = 1;
|
$("autoTMM").selectedIndex = 1;
|
||||||
$('savepath').disabled = true;
|
$("savepath").disabled = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('autoTMM').selectedIndex = 0;
|
$("autoTMM").selectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pref.torrent_stop_condition === "MetadataReceived") {
|
if (pref.torrent_stop_condition === "MetadataReceived") {
|
||||||
$('stopCondition').selectedIndex = 1;
|
$("stopCondition").selectedIndex = 1;
|
||||||
}
|
}
|
||||||
else if (pref.torrent_stop_condition === "FilesChecked") {
|
else if (pref.torrent_stop_condition === "FilesChecked") {
|
||||||
$('stopCondition').selectedIndex = 2;
|
$("stopCondition").selectedIndex = 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('stopCondition').selectedIndex = 0;
|
$("stopCondition").selectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pref.torrent_content_layout === "Subfolder") {
|
if (pref.torrent_content_layout === "Subfolder") {
|
||||||
$('contentLayout').selectedIndex = 1;
|
$("contentLayout").selectedIndex = 1;
|
||||||
}
|
}
|
||||||
else if (pref.torrent_content_layout === "NoSubfolder") {
|
else if (pref.torrent_content_layout === "NoSubfolder") {
|
||||||
$('contentLayout').selectedIndex = 2;
|
$("contentLayout").selectedIndex = 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('contentLayout').selectedIndex = 0;
|
$("contentLayout").selectedIndex = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -101,37 +101,37 @@ window.qBittorrent.Download = (function() {
|
||||||
item.nextElementSibling.value = "";
|
item.nextElementSibling.value = "";
|
||||||
item.nextElementSibling.select();
|
item.nextElementSibling.select();
|
||||||
|
|
||||||
if ($('autoTMM').selectedIndex === 1)
|
if ($("autoTMM").selectedIndex === 1)
|
||||||
$('savepath').value = defaultSavePath;
|
$("savepath").value = defaultSavePath;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
item.nextElementSibling.hidden = true;
|
item.nextElementSibling.hidden = true;
|
||||||
const text = item.options[item.selectedIndex].textContent;
|
const text = item.options[item.selectedIndex].textContent;
|
||||||
item.nextElementSibling.value = text;
|
item.nextElementSibling.value = text;
|
||||||
|
|
||||||
if ($('autoTMM').selectedIndex === 1) {
|
if ($("autoTMM").selectedIndex === 1) {
|
||||||
const categoryName = item.value;
|
const categoryName = item.value;
|
||||||
const category = categories[categoryName];
|
const category = categories[categoryName];
|
||||||
let 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeTMM = function(item) {
|
const changeTMM = function(item) {
|
||||||
if (item.selectedIndex === 1) {
|
if (item.selectedIndex === 1) {
|
||||||
$('savepath').disabled = true;
|
$("savepath").disabled = true;
|
||||||
|
|
||||||
const categorySelect = $('categorySelect');
|
const categorySelect = $("categorySelect");
|
||||||
const categoryName = categorySelect.options[categorySelect.selectedIndex].value;
|
const categoryName = categorySelect.options[categorySelect.selectedIndex].value;
|
||||||
const category = categories[categoryName];
|
const category = categories[categoryName];
|
||||||
$('savepath').value = (category === undefined) ? "" : category['savePath'];
|
$("savepath").value = (category === undefined) ? "" : category["savePath"];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('savepath').disabled = false;
|
$("savepath").disabled = false;
|
||||||
$('savepath').value = defaultSavePath;
|
$("savepath").value = defaultSavePath;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
// This file is the JavaScript implementation of base/utils/fs.cpp
|
// This file is the JavaScript implementation of base/utils/fs.cpp
|
||||||
|
|
||||||
|
@ -44,15 +44,15 @@ window.qBittorrent.Filesystem = (function() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const PathSeparator = '/';
|
const PathSeparator = "/";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the file extension part of a file name.
|
* Returns the file extension part of a file name.
|
||||||
*/
|
*/
|
||||||
const fileExtension = function(filename) {
|
const fileExtension = function(filename) {
|
||||||
const pointIndex = filename.lastIndexOf('.');
|
const pointIndex = filename.lastIndexOf(".");
|
||||||
if (pointIndex === -1)
|
if (pointIndex === -1)
|
||||||
return '';
|
return "";
|
||||||
return filename.substring(pointIndex + 1);
|
return filename.substring(pointIndex + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ window.qBittorrent.Filesystem = (function() {
|
||||||
const folderName = function(filepath) {
|
const folderName = function(filepath) {
|
||||||
const slashIndex = filepath.lastIndexOf(PathSeparator);
|
const slashIndex = filepath.lastIndexOf(PathSeparator);
|
||||||
if (slashIndex === -1)
|
if (slashIndex === -1)
|
||||||
return '';
|
return "";
|
||||||
return filepath.substring(0, slashIndex);
|
return filepath.substring(0, slashIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -152,7 +152,7 @@ window.qBittorrent.Misc = (function() {
|
||||||
valid: false
|
valid: false
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof versionString !== 'string')
|
if (typeof versionString !== "string")
|
||||||
return failure;
|
return failure;
|
||||||
|
|
||||||
const tryToNumber = (str) => {
|
const tryToNumber = (str) => {
|
||||||
|
@ -160,7 +160,7 @@ window.qBittorrent.Misc = (function() {
|
||||||
return (isNaN(num) ? str : num);
|
return (isNaN(num) ? str : num);
|
||||||
};
|
};
|
||||||
|
|
||||||
const ver = versionString.split('.', 4).map(val => tryToNumber(val));
|
const ver = versionString.split(".", 4).map(val => tryToNumber(val));
|
||||||
return {
|
return {
|
||||||
valid: true,
|
valid: true,
|
||||||
major: ver[0],
|
major: ver[0],
|
||||||
|
@ -171,7 +171,7 @@ window.qBittorrent.Misc = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const escapeHtml = function(str) {
|
const escapeHtml = function(str) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement("div");
|
||||||
div.appendChild(document.createTextNode(str));
|
div.appendChild(document.createTextNode(str));
|
||||||
const escapedString = div.innerHTML;
|
const escapedString = div.innerHTML;
|
||||||
div.remove();
|
div.remove();
|
||||||
|
@ -179,7 +179,7 @@ window.qBittorrent.Misc = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#parameters
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#parameters
|
||||||
const naturalSortCollator = new Intl.Collator(undefined, { numeric: true, usage: 'sort' });
|
const naturalSortCollator = new Intl.Collator(undefined, { numeric: true, usage: "sort" });
|
||||||
|
|
||||||
const safeTrim = function(value) {
|
const safeTrim = function(value) {
|
||||||
try {
|
try {
|
||||||
|
@ -207,8 +207,8 @@ window.qBittorrent.Misc = (function() {
|
||||||
const containsAllTerms = function(text, terms) {
|
const containsAllTerms = function(text, terms) {
|
||||||
const textToSearch = text.toLowerCase();
|
const textToSearch = text.toLowerCase();
|
||||||
return terms.every(function(term) {
|
return terms.every(function(term) {
|
||||||
const isTermRequired = (term[0] === '+');
|
const isTermRequired = (term[0] === "+");
|
||||||
const isTermExcluded = (term[0] === '-');
|
const isTermExcluded = (term[0] === "-");
|
||||||
if (isTermRequired || isTermExcluded) {
|
if (isTermRequired || isTermExcluded) {
|
||||||
// ignore lonely +/-
|
// ignore lonely +/-
|
||||||
if (term.length === 1)
|
if (term.length === 1)
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
it in the onContentLoaded function of the new window.
|
it in the onContentLoaded function of the new window.
|
||||||
|
|
||||||
----------------------------------------------------------------- */
|
----------------------------------------------------------------- */
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
const LocalPreferences = new window.qBittorrent.LocalPreferences.LocalPreferencesClass();
|
const LocalPreferences = new window.qBittorrent.LocalPreferences.LocalPreferencesClass();
|
||||||
|
|
||||||
|
@ -96,34 +96,34 @@ let exportTorrentFN = function() {};
|
||||||
const initializeWindows = function() {
|
const initializeWindows = function() {
|
||||||
saveWindowSize = function(windowId) {
|
saveWindowSize = function(windowId) {
|
||||||
const size = $(windowId).getSize();
|
const size = $(windowId).getSize();
|
||||||
LocalPreferences.set('window_' + windowId + '_width', size.x);
|
LocalPreferences.set("window_" + windowId + "_width", size.x);
|
||||||
LocalPreferences.set('window_' + windowId + '_height', size.y);
|
LocalPreferences.set("window_" + windowId + "_height", size.y);
|
||||||
};
|
};
|
||||||
|
|
||||||
loadWindowWidth = function(windowId, defaultValue) {
|
loadWindowWidth = function(windowId, defaultValue) {
|
||||||
return LocalPreferences.get('window_' + windowId + '_width', defaultValue);
|
return LocalPreferences.get("window_" + windowId + "_width", defaultValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
loadWindowHeight = function(windowId, defaultValue) {
|
loadWindowHeight = function(windowId, defaultValue) {
|
||||||
return LocalPreferences.get('window_' + windowId + '_height', defaultValue);
|
return LocalPreferences.get("window_" + windowId + "_height", defaultValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
function addClickEvent(el, fn) {
|
function addClickEvent(el, fn) {
|
||||||
['Link', 'Button'].each(function(item) {
|
["Link", "Button"].each(function(item) {
|
||||||
if ($(el + item)) {
|
if ($(el + item)) {
|
||||||
$(el + item).addEvent('click', fn);
|
$(el + item).addEvent("click", fn);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addClickEvent('download', function(e) {
|
addClickEvent("download", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
showDownloadPage();
|
showDownloadPage();
|
||||||
});
|
});
|
||||||
|
|
||||||
showDownloadPage = function(urls) {
|
showDownloadPage = function(urls) {
|
||||||
const id = 'downloadPage';
|
const id = "downloadPage";
|
||||||
let contentUri = new URI('download.html');
|
let contentUri = new URI("download.html");
|
||||||
|
|
||||||
if (urls && (urls.length > 0)) {
|
if (urls && (urls.length > 0)) {
|
||||||
contentUri.setData("urls", urls.map(encodeURIComponent).join("|"));
|
contentUri.setData("urls", urls.map(encodeURIComponent).join("|"));
|
||||||
|
@ -132,9 +132,9 @@ const initializeWindows = function() {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: id,
|
id: id,
|
||||||
title: "QBT_TR(Download from URLs)QBT_TR[CONTEXT=downloadFromURL]",
|
title: "QBT_TR(Download from URLs)QBT_TR[CONTEXT=downloadFromURL]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: contentUri.toString(),
|
contentURL: contentUri.toString(),
|
||||||
addClass: 'windowFrame', // fixes iframe scrolling on iOS Safari
|
addClass: "windowFrame", // fixes iframe scrolling on iOS Safari
|
||||||
scrollbars: true,
|
scrollbars: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
closable: true,
|
closable: true,
|
||||||
|
@ -149,19 +149,19 @@ const initializeWindows = function() {
|
||||||
updateMainData();
|
updateMainData();
|
||||||
};
|
};
|
||||||
|
|
||||||
addClickEvent('preferences', function(e) {
|
addClickEvent("preferences", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
const 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]",
|
||||||
loadMethod: 'xhr',
|
loadMethod: "xhr",
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
contentURL: new URI("views/preferences.html").toString(),
|
contentURL: new URI("views/preferences.html").toString(),
|
||||||
require: {
|
require: {
|
||||||
css: ['css/Tabs.css']
|
css: ["css/Tabs.css"]
|
||||||
},
|
},
|
||||||
toolbarURL: 'views/preferencesToolbar.html',
|
toolbarURL: "views/preferencesToolbar.html",
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
closable: true,
|
closable: true,
|
||||||
paddingVertical: 0,
|
paddingVertical: 0,
|
||||||
|
@ -174,15 +174,15 @@ const initializeWindows = function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
addClickEvent('upload', function(e) {
|
addClickEvent("upload", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
const 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]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("upload.html").toString(),
|
contentURL: new URI("upload.html").toString(),
|
||||||
addClass: 'windowFrame', // fixes iframe scrolling on iOS Safari
|
addClass: "windowFrame", // fixes iframe scrolling on iOS Safari
|
||||||
scrollbars: true,
|
scrollbars: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
paddingVertical: 0,
|
paddingVertical: 0,
|
||||||
|
@ -198,9 +198,9 @@ const initializeWindows = function() {
|
||||||
|
|
||||||
globalUploadLimitFN = function() {
|
globalUploadLimitFN = function() {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'uploadLimitPage',
|
id: "uploadLimitPage",
|
||||||
title: "QBT_TR(Global Upload Speed Limit)QBT_TR[CONTEXT=MainWindow]",
|
title: "QBT_TR(Global Upload Speed Limit)QBT_TR[CONTEXT=MainWindow]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("uploadlimit.html").setData("hashes", "global").toString(),
|
contentURL: new URI("uploadlimit.html").setData("hashes", "global").toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
|
@ -216,9 +216,9 @@ const initializeWindows = function() {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'uploadLimitPage',
|
id: "uploadLimitPage",
|
||||||
title: "QBT_TR(Torrent Upload Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]",
|
title: "QBT_TR(Torrent Upload Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("uploadlimit.html").setData("hashes", hashes.join("|")).toString(),
|
contentURL: new URI("uploadlimit.html").setData("hashes", hashes.join("|")).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
|
@ -257,9 +257,9 @@ const 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
|
||||||
const 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]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("shareratio.html").setData("hashes", hashes.join("|")).setData("orig", orig).toString(),
|
contentURL: new URI("shareratio.html").setData("hashes", hashes.join("|")).setData("orig", orig).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -275,8 +275,8 @@ const initializeWindows = function() {
|
||||||
const 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",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
}
|
}
|
||||||
|
@ -289,8 +289,8 @@ const initializeWindows = function() {
|
||||||
const 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",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
}
|
}
|
||||||
|
@ -303,8 +303,8 @@ const initializeWindows = function() {
|
||||||
const 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",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
value: val,
|
value: val,
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
|
@ -318,10 +318,10 @@ const initializeWindows = function() {
|
||||||
const 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",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
value: 'true',
|
value: "true",
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -331,9 +331,9 @@ const initializeWindows = function() {
|
||||||
|
|
||||||
globalDownloadLimitFN = function() {
|
globalDownloadLimitFN = function() {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'downloadLimitPage',
|
id: "downloadLimitPage",
|
||||||
title: "QBT_TR(Global Download Speed Limit)QBT_TR[CONTEXT=MainWindow]",
|
title: "QBT_TR(Global Download Speed Limit)QBT_TR[CONTEXT=MainWindow]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("downloadlimit.html").setData("hashes", "global").toString(),
|
contentURL: new URI("downloadlimit.html").setData("hashes", "global").toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
|
@ -346,11 +346,11 @@ const initializeWindows = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
StatisticsLinkFN = function() {
|
StatisticsLinkFN = function() {
|
||||||
const 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]",
|
||||||
loadMethod: 'xhr',
|
loadMethod: "xhr",
|
||||||
contentURL: new URI("views/statistics.html").toString(),
|
contentURL: new URI("views/statistics.html").toString(),
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
padding: 10,
|
padding: 10,
|
||||||
|
@ -366,9 +366,9 @@ const initializeWindows = function() {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'downloadLimitPage',
|
id: "downloadLimitPage",
|
||||||
title: "QBT_TR(Torrent Download Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]",
|
title: "QBT_TR(Torrent Download Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("downloadlimit.html").setData("hashes", hashes.join("|")).toString(),
|
contentURL: new URI("downloadlimit.html").setData("hashes", hashes.join("|")).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
|
@ -385,9 +385,9 @@ const initializeWindows = function() {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'confirmDeletionPage',
|
id: "confirmDeletionPage",
|
||||||
title: "QBT_TR(Remove torrent(s))QBT_TR[CONTEXT=confirmDeletionDlg]",
|
title: "QBT_TR(Remove torrent(s))QBT_TR[CONTEXT=confirmDeletionDlg]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("confirmdeletion.html").setData("hashes", hashes.join("|")).setData("deleteFiles", deleteFiles).toString(),
|
contentURL: new URI("confirmdeletion.html").setData("hashes", hashes.join("|")).setData("deleteFiles", deleteFiles).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -400,7 +400,7 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
addClickEvent('delete', function(e) {
|
addClickEvent("delete", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
deleteFN();
|
deleteFN();
|
||||||
});
|
});
|
||||||
|
@ -409,8 +409,8 @@ const initializeWindows = function() {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/stop',
|
url: "api/v2/torrents/stop",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
}
|
}
|
||||||
|
@ -423,8 +423,8 @@ const initializeWindows = function() {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/start',
|
url: "api/v2/torrents/start",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
}
|
}
|
||||||
|
@ -443,8 +443,8 @@ const initializeWindows = function() {
|
||||||
enable = true;
|
enable = true;
|
||||||
});
|
});
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/setAutoManagement',
|
url: "api/v2/torrents/setAutoManagement",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|"),
|
hashes: hashes.join("|"),
|
||||||
enable: enable
|
enable: enable
|
||||||
|
@ -458,8 +458,8 @@ const initializeWindows = function() {
|
||||||
const 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",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|"),
|
hashes: hashes.join("|"),
|
||||||
}
|
}
|
||||||
|
@ -472,8 +472,8 @@ const initializeWindows = function() {
|
||||||
const 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",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|"),
|
hashes: hashes.join("|"),
|
||||||
}
|
}
|
||||||
|
@ -489,10 +489,10 @@ const initializeWindows = function() {
|
||||||
const row = torrentsTable.rows[hash];
|
const row = torrentsTable.rows[hash];
|
||||||
|
|
||||||
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]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("setlocation.html").setData("hashes", hashes.join('|')).setData("path", encodeURIComponent(row.full_data.save_path)).toString(),
|
contentURL: new URI("setlocation.html").setData("hashes", hashes.join("|")).setData("path", encodeURIComponent(row.full_data.save_path)).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -511,9 +511,9 @@ const initializeWindows = function() {
|
||||||
const row = torrentsTable.rows[hash];
|
const row = torrentsTable.rows[hash];
|
||||||
if (row) {
|
if (row) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'renamePage',
|
id: "renamePage",
|
||||||
title: "QBT_TR(Rename)QBT_TR[CONTEXT=TransferListWidget]",
|
title: "QBT_TR(Rename)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("rename.html").setData("hash", hash).setData("name", row.full_data.name).toString(),
|
contentURL: new URI("rename.html").setData("hash", hash).setData("name", row.full_data.name).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -534,11 +534,11 @@ const initializeWindows = function() {
|
||||||
const row = torrentsTable.rows[hash];
|
const row = torrentsTable.rows[hash];
|
||||||
if (row) {
|
if (row) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'multiRenamePage',
|
id: "multiRenamePage",
|
||||||
title: "QBT_TR(Renaming)QBT_TR[CONTEXT=TransferListWidget]",
|
title: "QBT_TR(Renaming)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
data: { hash: hash, selectedRows: [] },
|
data: { hash: hash, selectedRows: [] },
|
||||||
loadMethod: 'xhr',
|
loadMethod: "xhr",
|
||||||
contentURL: 'rename_files.html',
|
contentURL: "rename_files.html",
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -546,7 +546,7 @@ const initializeWindows = function() {
|
||||||
paddingHorizontal: 0,
|
paddingHorizontal: 0,
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 420,
|
height: 420,
|
||||||
resizeLimit: { 'x': [800], 'y': [420] }
|
resizeLimit: { "x": [800], "y": [420] }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -557,10 +557,10 @@ const initializeWindows = function() {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'newCategoryPage',
|
id: "newCategoryPage",
|
||||||
title: "QBT_TR(New Category)QBT_TR[CONTEXT=TransferListWidget]",
|
title: "QBT_TR(New Category)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("newcategory.html").setData("action", action).setData("hashes", hashes.join('|')).toString(),
|
contentURL: new URI("newcategory.html").setData("action", action).setData("hashes", hashes.join("|")).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -579,10 +579,10 @@ const initializeWindows = function() {
|
||||||
|
|
||||||
const categoryName = category_list.has(categoryHash)
|
const categoryName = category_list.has(categoryHash)
|
||||||
? category_list.get(categoryHash).name
|
? category_list.get(categoryHash).name
|
||||||
: '';
|
: "";
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/setCategory',
|
url: "api/v2/torrents/setCategory",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|"),
|
hashes: hashes.join("|"),
|
||||||
category: categoryName
|
category: categoryName
|
||||||
|
@ -593,9 +593,9 @@ const initializeWindows = function() {
|
||||||
createCategoryFN = function() {
|
createCategoryFN = function() {
|
||||||
const 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]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("newcategory.html").setData("action", action).toString(),
|
contentURL: new URI("newcategory.html").setData("action", action).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -612,9 +612,9 @@ const initializeWindows = function() {
|
||||||
const action = "createSubcategory";
|
const action = "createSubcategory";
|
||||||
const categoryName = category_list.get(categoryHash).name + "/";
|
const categoryName = category_list.get(categoryHash).name + "/";
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'newSubcategoryPage',
|
id: "newSubcategoryPage",
|
||||||
title: "QBT_TR(New Category)QBT_TR[CONTEXT=CategoryFilterWidget]",
|
title: "QBT_TR(New Category)QBT_TR[CONTEXT=CategoryFilterWidget]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("newcategory.html").setData("action", action).setData("categoryName", categoryName).toString(),
|
contentURL: new URI("newcategory.html").setData("action", action).setData("categoryName", categoryName).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -631,10 +631,10 @@ const initializeWindows = function() {
|
||||||
const action = "edit";
|
const action = "edit";
|
||||||
const category = category_list.get(categoryHash);
|
const category = category_list.get(categoryHash);
|
||||||
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]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI('newcategory.html').setData("action", action).setData("categoryName", category.name).setData("savePath", category.savePath).toString(),
|
contentURL: new URI("newcategory.html").setData("action", action).setData("categoryName", category.name).setData("savePath", category.savePath).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -649,8 +649,8 @@ const initializeWindows = function() {
|
||||||
removeCategoryFN = function(categoryHash) {
|
removeCategoryFN = function(categoryHash) {
|
||||||
const categoryName = category_list.get(categoryHash).name;
|
const categoryName = category_list.get(categoryHash).name;
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/removeCategories',
|
url: "api/v2/torrents/removeCategories",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
categories: categoryName
|
categories: categoryName
|
||||||
}
|
}
|
||||||
|
@ -661,26 +661,26 @@ const initializeWindows = function() {
|
||||||
deleteUnusedCategoriesFN = function() {
|
deleteUnusedCategoriesFN = function() {
|
||||||
const categories = [];
|
const categories = [];
|
||||||
category_list.forEach((category, hash) => {
|
category_list.forEach((category, hash) => {
|
||||||
if (torrentsTable.getFilteredTorrentsNumber('all', hash, TAGS_ALL, TRACKERS_ALL) === 0)
|
if (torrentsTable.getFilteredTorrentsNumber("all", hash, TAGS_ALL, TRACKERS_ALL) === 0)
|
||||||
categories.push(category.name);
|
categories.push(category.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/removeCategories',
|
url: "api/v2/torrents/removeCategories",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
categories: categories.join('\n')
|
categories: categories.join("\n")
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
setCategoryFilter(CATEGORIES_ALL);
|
setCategoryFilter(CATEGORIES_ALL);
|
||||||
};
|
};
|
||||||
|
|
||||||
startTorrentsByCategoryFN = function(categoryHash) {
|
startTorrentsByCategoryFN = function(categoryHash) {
|
||||||
const hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash, TAGS_ALL, TRACKERS_ALL);
|
const hashes = torrentsTable.getFilteredTorrentsHashes("all", categoryHash, TAGS_ALL, TRACKERS_ALL);
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/start',
|
url: "api/v2/torrents/start",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
}
|
}
|
||||||
|
@ -690,11 +690,11 @@ const initializeWindows = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
stopTorrentsByCategoryFN = function(categoryHash) {
|
stopTorrentsByCategoryFN = function(categoryHash) {
|
||||||
const hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash, TAGS_ALL, TRACKERS_ALL);
|
const hashes = torrentsTable.getFilteredTorrentsHashes("all", categoryHash, TAGS_ALL, TRACKERS_ALL);
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/stop',
|
url: "api/v2/torrents/stop",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
}
|
}
|
||||||
|
@ -704,12 +704,12 @@ const initializeWindows = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteTorrentsByCategoryFN = function(categoryHash) {
|
deleteTorrentsByCategoryFN = function(categoryHash) {
|
||||||
const hashes = torrentsTable.getFilteredTorrentsHashes('all', categoryHash, TAGS_ALL, TRACKERS_ALL);
|
const hashes = torrentsTable.getFilteredTorrentsHashes("all", categoryHash, TAGS_ALL, TRACKERS_ALL);
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'confirmDeletionPage',
|
id: "confirmDeletionPage",
|
||||||
title: "QBT_TR(Remove torrent(s))QBT_TR[CONTEXT=confirmDeletionDlg]",
|
title: "QBT_TR(Remove torrent(s))QBT_TR[CONTEXT=confirmDeletionDlg]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("confirmdeletion.html").setData("hashes", hashes.join("|")).toString(),
|
contentURL: new URI("confirmdeletion.html").setData("hashes", hashes.join("|")).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -727,9 +727,9 @@ const initializeWindows = function() {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'newTagPage',
|
id: "newTagPage",
|
||||||
title: "QBT_TR(Add Tags)QBT_TR[CONTEXT=TransferListWidget]",
|
title: "QBT_TR(Add Tags)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("newtag.html").setData("action", action).setData("hashes", hashes.join("|")).toString(),
|
contentURL: new URI("newtag.html").setData("action", action).setData("hashes", hashes.join("|")).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -747,10 +747,10 @@ const initializeWindows = function() {
|
||||||
if (hashes.length <= 0)
|
if (hashes.length <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const tagName = tagList.has(tagHash) ? tagList.get(tagHash).name : '';
|
const tagName = tagList.has(tagHash) ? tagList.get(tagHash).name : "";
|
||||||
new Request({
|
new Request({
|
||||||
url: (isSet ? 'api/v2/torrents/addTags' : 'api/v2/torrents/removeTags'),
|
url: (isSet ? "api/v2/torrents/addTags" : "api/v2/torrents/removeTags"),
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|"),
|
hashes: hashes.join("|"),
|
||||||
tags: tagName,
|
tags: tagName,
|
||||||
|
@ -762,8 +762,8 @@ const initializeWindows = function() {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: ('api/v2/torrents/removeTags'),
|
url: ("api/v2/torrents/removeTags"),
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|"),
|
hashes: hashes.join("|"),
|
||||||
}
|
}
|
||||||
|
@ -774,9 +774,9 @@ const initializeWindows = function() {
|
||||||
createTagFN = function() {
|
createTagFN = function() {
|
||||||
const action = "create";
|
const action = "create";
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'newTagPage',
|
id: "newTagPage",
|
||||||
title: "QBT_TR(New Tag)QBT_TR[CONTEXT=TagFilterWidget]",
|
title: "QBT_TR(New Tag)QBT_TR[CONTEXT=TagFilterWidget]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("newtag.html").setData("action", action).toString(),
|
contentURL: new URI("newtag.html").setData("action", action).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -792,8 +792,8 @@ const initializeWindows = function() {
|
||||||
removeTagFN = function(tagHash) {
|
removeTagFN = function(tagHash) {
|
||||||
const tagName = tagList.get(tagHash).name;
|
const tagName = tagList.get(tagHash).name;
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/deleteTags',
|
url: "api/v2/torrents/deleteTags",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
tags: tagName
|
tags: tagName
|
||||||
}
|
}
|
||||||
|
@ -804,25 +804,25 @@ const initializeWindows = function() {
|
||||||
deleteUnusedTagsFN = function() {
|
deleteUnusedTagsFN = function() {
|
||||||
const tags = [];
|
const tags = [];
|
||||||
tagList.forEach((tag, hash) => {
|
tagList.forEach((tag, hash) => {
|
||||||
if (torrentsTable.getFilteredTorrentsNumber('all', CATEGORIES_ALL, hash, TRACKERS_ALL) === 0)
|
if (torrentsTable.getFilteredTorrentsNumber("all", CATEGORIES_ALL, hash, TRACKERS_ALL) === 0)
|
||||||
tags.push(tag.name);
|
tags.push(tag.name);
|
||||||
});
|
});
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/deleteTags',
|
url: "api/v2/torrents/deleteTags",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
tags: tags.join(',')
|
tags: tags.join(",")
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
setTagFilter(TAGS_ALL);
|
setTagFilter(TAGS_ALL);
|
||||||
};
|
};
|
||||||
|
|
||||||
startTorrentsByTagFN = function(tagHash) {
|
startTorrentsByTagFN = function(tagHash) {
|
||||||
const hashes = torrentsTable.getFilteredTorrentsHashes('all', CATEGORIES_ALL, tagHash, TRACKERS_ALL);
|
const hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, tagHash, TRACKERS_ALL);
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/start',
|
url: "api/v2/torrents/start",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
}
|
}
|
||||||
|
@ -832,11 +832,11 @@ const initializeWindows = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
stopTorrentsByTagFN = function(tagHash) {
|
stopTorrentsByTagFN = function(tagHash) {
|
||||||
const hashes = torrentsTable.getFilteredTorrentsHashes('all', CATEGORIES_ALL, tagHash, TRACKERS_ALL);
|
const hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, tagHash, TRACKERS_ALL);
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/stop',
|
url: "api/v2/torrents/stop",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
}
|
}
|
||||||
|
@ -846,12 +846,12 @@ const initializeWindows = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteTorrentsByTagFN = function(tagHash) {
|
deleteTorrentsByTagFN = function(tagHash) {
|
||||||
const hashes = torrentsTable.getFilteredTorrentsHashes('all', CATEGORIES_ALL, tagHash, TRACKERS_ALL);
|
const hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, tagHash, TRACKERS_ALL);
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'confirmDeletionPage',
|
id: "confirmDeletionPage",
|
||||||
title: "QBT_TR(Remove torrent(s))QBT_TR[CONTEXT=confirmDeletionDlg]",
|
title: "QBT_TR(Remove torrent(s))QBT_TR[CONTEXT=confirmDeletionDlg]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("confirmdeletion.html").setData("hashes", hashes.join("|")).toString(),
|
contentURL: new URI("confirmdeletion.html").setData("hashes", hashes.join("|")).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -869,10 +869,10 @@ const initializeWindows = function() {
|
||||||
let hashes = [];
|
let hashes = [];
|
||||||
switch (trackerHashInt) {
|
switch (trackerHashInt) {
|
||||||
case TRACKERS_ALL:
|
case TRACKERS_ALL:
|
||||||
hashes = torrentsTable.getFilteredTorrentsHashes('all', CATEGORIES_ALL, TAGS_ALL, TRACKERS_ALL);
|
hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, TAGS_ALL, TRACKERS_ALL);
|
||||||
break;
|
break;
|
||||||
case TRACKERS_TRACKERLESS:
|
case TRACKERS_TRACKERLESS:
|
||||||
hashes = torrentsTable.getFilteredTorrentsHashes('all', CATEGORIES_ALL, TAGS_ALL, TRACKERS_TRACKERLESS);
|
hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, TAGS_ALL, TRACKERS_TRACKERLESS);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
const uniqueTorrents = new Set();
|
const uniqueTorrents = new Set();
|
||||||
|
@ -888,8 +888,8 @@ const initializeWindows = function() {
|
||||||
|
|
||||||
if (hashes.length > 0) {
|
if (hashes.length > 0) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/start',
|
url: "api/v2/torrents/start",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
}
|
}
|
||||||
|
@ -903,10 +903,10 @@ const initializeWindows = function() {
|
||||||
let hashes = [];
|
let hashes = [];
|
||||||
switch (trackerHashInt) {
|
switch (trackerHashInt) {
|
||||||
case TRACKERS_ALL:
|
case TRACKERS_ALL:
|
||||||
hashes = torrentsTable.getFilteredTorrentsHashes('all', CATEGORIES_ALL, TAGS_ALL, TRACKERS_ALL);
|
hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, TAGS_ALL, TRACKERS_ALL);
|
||||||
break;
|
break;
|
||||||
case TRACKERS_TRACKERLESS:
|
case TRACKERS_TRACKERLESS:
|
||||||
hashes = torrentsTable.getFilteredTorrentsHashes('all', CATEGORIES_ALL, TAGS_ALL, TRACKERS_TRACKERLESS);
|
hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, TAGS_ALL, TRACKERS_TRACKERLESS);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
const uniqueTorrents = new Set();
|
const uniqueTorrents = new Set();
|
||||||
|
@ -922,8 +922,8 @@ const initializeWindows = function() {
|
||||||
|
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/stop',
|
url: "api/v2/torrents/stop",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
}
|
}
|
||||||
|
@ -937,10 +937,10 @@ const initializeWindows = function() {
|
||||||
let hashes = [];
|
let hashes = [];
|
||||||
switch (trackerHashInt) {
|
switch (trackerHashInt) {
|
||||||
case TRACKERS_ALL:
|
case TRACKERS_ALL:
|
||||||
hashes = torrentsTable.getFilteredTorrentsHashes('all', CATEGORIES_ALL, TAGS_ALL, TRACKERS_ALL);
|
hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, TAGS_ALL, TRACKERS_ALL);
|
||||||
break;
|
break;
|
||||||
case TRACKERS_TRACKERLESS:
|
case TRACKERS_TRACKERLESS:
|
||||||
hashes = torrentsTable.getFilteredTorrentsHashes('all', CATEGORIES_ALL, TAGS_ALL, TRACKERS_TRACKERLESS);
|
hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, TAGS_ALL, TRACKERS_TRACKERLESS);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
const uniqueTorrents = new Set();
|
const uniqueTorrents = new Set();
|
||||||
|
@ -956,9 +956,9 @@ const initializeWindows = function() {
|
||||||
|
|
||||||
if (hashes.length) {
|
if (hashes.length) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'confirmDeletionPage',
|
id: "confirmDeletionPage",
|
||||||
title: "QBT_TR(Remove torrent(s))QBT_TR[CONTEXT=confirmDeletionDlg]",
|
title: "QBT_TR(Remove torrent(s))QBT_TR[CONTEXT=confirmDeletionDlg]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("confirmdeletion.html").setData("hashes", hashes.join("|")).toString(),
|
contentURL: new URI("confirmdeletion.html").setData("hashes", hashes.join("|")).toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -1068,13 +1068,13 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
addClickEvent('stopAll', (e) => {
|
addClickEvent("stopAll", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
if (confirm('QBT_TR(Would you like to stop all torrents?)QBT_TR[CONTEXT=MainWindow]')) {
|
if (confirm("QBT_TR(Would you like to stop all torrents?)QBT_TR[CONTEXT=MainWindow]")) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/stop',
|
url: "api/v2/torrents/stop",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: "all"
|
hashes: "all"
|
||||||
}
|
}
|
||||||
|
@ -1083,13 +1083,13 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addClickEvent('startAll', (e) => {
|
addClickEvent("startAll", (e) => {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
if (confirm('QBT_TR(Would you like to start all torrents?)QBT_TR[CONTEXT=MainWindow]')) {
|
if (confirm("QBT_TR(Would you like to start all torrents?)QBT_TR[CONTEXT=MainWindow]")) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/start',
|
url: "api/v2/torrents/start",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: "all"
|
hashes: "all"
|
||||||
}
|
}
|
||||||
|
@ -1098,15 +1098,15 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
['stop', 'start', 'recheck'].each(function(item) {
|
["stop", "start", "recheck"].each(function(item) {
|
||||||
addClickEvent(item, function(e) {
|
addClickEvent(item, function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
const 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({
|
||||||
url: 'api/v2/torrents/' + item,
|
url: "api/v2/torrents/" + item,
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hash
|
hashes: hash
|
||||||
}
|
}
|
||||||
|
@ -1117,7 +1117,7 @@ const initializeWindows = function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
['decreasePrio', 'increasePrio', 'topPrio', 'bottomPrio'].each(function(item) {
|
["decreasePrio", "increasePrio", "topPrio", "bottomPrio"].each(function(item) {
|
||||||
addClickEvent(item, function(e) {
|
addClickEvent(item, function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
setQueuePositionFN(item);
|
setQueuePositionFN(item);
|
||||||
|
@ -1128,8 +1128,8 @@ const initializeWindows = function() {
|
||||||
const 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,
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join("|")
|
hashes: hashes.join("|")
|
||||||
}
|
}
|
||||||
|
@ -1138,19 +1138,19 @@ const initializeWindows = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
addClickEvent('about', function(e) {
|
addClickEvent("about", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
const 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]",
|
||||||
loadMethod: 'xhr',
|
loadMethod: "xhr",
|
||||||
contentURL: new URI("views/about.html").toString(),
|
contentURL: new URI("views/about.html").toString(),
|
||||||
require: {
|
require: {
|
||||||
css: ['css/Tabs.css']
|
css: ["css/Tabs.css"]
|
||||||
},
|
},
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
toolbarURL: 'views/aboutToolbar.html',
|
toolbarURL: "views/aboutToolbar.html",
|
||||||
padding: 10,
|
padding: 10,
|
||||||
width: loadWindowWidth(id, 550),
|
width: loadWindowWidth(id, 550),
|
||||||
height: loadWindowHeight(id, 360),
|
height: loadWindowHeight(id, 360),
|
||||||
|
@ -1160,25 +1160,25 @@ const initializeWindows = function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
addClickEvent('logout', function(e) {
|
addClickEvent("logout", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/auth/logout',
|
url: "api/v2/auth/logout",
|
||||||
method: 'post',
|
method: "post",
|
||||||
onSuccess: function() {
|
onSuccess: function() {
|
||||||
window.location.reload(true);
|
window.location.reload(true);
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
|
|
||||||
addClickEvent('shutdown', function(e) {
|
addClickEvent("shutdown", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
if (confirm('QBT_TR(Are you sure you want to quit qBittorrent?)QBT_TR[CONTEXT=MainWindow]')) {
|
if (confirm("QBT_TR(Are you sure you want to quit qBittorrent?)QBT_TR[CONTEXT=MainWindow]")) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/app/shutdown',
|
url: "api/v2/app/shutdown",
|
||||||
method: 'post',
|
method: "post",
|
||||||
onSuccess: function() {
|
onSuccess: function() {
|
||||||
const shutdownMessage = 'QBT_TR(%1 has been shutdown)QBT_TR[CONTEXT=HttpServer]'.replace("%1", window.qBittorrent.Client.mainTitle());
|
const shutdownMessage = "QBT_TR(%1 has been shutdown)QBT_TR[CONTEXT=HttpServer]".replace("%1", window.qBittorrent.Client.mainTitle());
|
||||||
document.write(`<!doctype html><html lang="${LANG}"><head> <meta charset="UTF-8"> <meta name="color-scheme" content="light dark"> <title>${shutdownMessage}</title> <style>* {font-family: Arial, Helvetica, sans-serif;}</style></head><body> <h1 style="text-align: center;">${shutdownMessage}</h1></body></html>`);
|
document.write(`<!doctype html><html lang="${LANG}"><head> <meta charset="UTF-8"> <meta name="color-scheme" content="light dark"> <title>${shutdownMessage}</title> <style>* {font-family: Arial, Helvetica, sans-serif;}</style></head><body> <h1 style="text-align: center;">${shutdownMessage}</h1></body></html>`);
|
||||||
document.close();
|
document.close();
|
||||||
window.stop();
|
window.stop();
|
||||||
|
@ -1189,8 +1189,8 @@ const initializeWindows = function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Deactivate menu header links
|
// Deactivate menu header links
|
||||||
$$('a.returnFalse').each(function(el) {
|
$$("a.returnFalse").each(function(el) {
|
||||||
el.addEvent('click', function(e) {
|
el.addEvent("click", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -51,35 +51,35 @@ window.qBittorrent.PiecesBar = (() => {
|
||||||
const PiecesBar = new Class({
|
const PiecesBar = new Class({
|
||||||
initialize(pieces, parameters) {
|
initialize(pieces, parameters) {
|
||||||
const vals = {
|
const vals = {
|
||||||
'id': 'piecesbar_' + (piecesBarUniqueId++),
|
"id": "piecesbar_" + (piecesBarUniqueId++),
|
||||||
'width': 0,
|
"width": 0,
|
||||||
'height': 0,
|
"height": 0,
|
||||||
'downloadingColor': 'hsl(110deg 94% 27%)', // @TODO palette vars not supported for this value, apply average
|
"downloadingColor": "hsl(110deg 94% 27%)", // @TODO palette vars not supported for this value, apply average
|
||||||
'haveColor': 'hsl(210deg 55% 55%)', // @TODO palette vars not supported for this value, apply average
|
"haveColor": "hsl(210deg 55% 55%)", // @TODO palette vars not supported for this value, apply average
|
||||||
'borderSize': 1,
|
"borderSize": 1,
|
||||||
'borderColor': 'var(--color-border-default)'
|
"borderColor": "var(--color-border-default)"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (parameters && (typeOf(parameters) === 'object'))
|
if (parameters && (typeOf(parameters) === "object"))
|
||||||
Object.append(vals, parameters);
|
Object.append(vals, parameters);
|
||||||
vals.height = Math.max(vals.height, 12);
|
vals.height = Math.max(vals.height, 12);
|
||||||
|
|
||||||
const obj = new Element('div', {
|
const obj = new Element("div", {
|
||||||
'id': vals.id,
|
"id": vals.id,
|
||||||
'class': 'piecesbarWrapper',
|
"class": "piecesbarWrapper",
|
||||||
'styles': {
|
"styles": {
|
||||||
'border': vals.borderSize.toString() + 'px solid ' + vals.borderColor,
|
"border": vals.borderSize.toString() + "px solid " + vals.borderColor,
|
||||||
'height': vals.height.toString() + 'px',
|
"height": vals.height.toString() + "px",
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
obj.vals = vals;
|
obj.vals = vals;
|
||||||
obj.vals.pieces = [pieces, []].pick();
|
obj.vals.pieces = [pieces, []].pick();
|
||||||
|
|
||||||
obj.vals.canvas = new Element('canvas', {
|
obj.vals.canvas = new Element("canvas", {
|
||||||
'id': vals.id + '_canvas',
|
"id": vals.id + "_canvas",
|
||||||
'class': 'piecesbarCanvas',
|
"class": "piecesbarCanvas",
|
||||||
'width': (vals.width - (2 * vals.borderSize)).toString(),
|
"width": (vals.width - (2 * vals.borderSize)).toString(),
|
||||||
'height': '1' // will stretch vertically to take up the height of the parent
|
"height": "1" // will stretch vertically to take up the height of the parent
|
||||||
});
|
});
|
||||||
obj.appendChild(obj.vals.canvas);
|
obj.appendChild(obj.vals.canvas);
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ window.qBittorrent.PiecesBar = (() => {
|
||||||
this.vals.canvas.width = width - (2 * this.vals.borderSize);
|
this.vals.canvas.width = width - (2 * this.vals.borderSize);
|
||||||
|
|
||||||
const canvas = this.vals.canvas;
|
const canvas = this.vals.canvas;
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext("2d");
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
const imageWidth = canvas.width;
|
const imageWidth = canvas.width;
|
||||||
|
@ -246,7 +246,7 @@ window.qBittorrent.PiecesBar = (() => {
|
||||||
|
|
||||||
function drawStatus(ctx, start, width, statusValues) {
|
function drawStatus(ctx, start, width, statusValues) {
|
||||||
// mix the colors by using transparency and a composite mode
|
// mix the colors by using transparency and a composite mode
|
||||||
ctx.globalCompositeOperation = 'lighten';
|
ctx.globalCompositeOperation = "lighten";
|
||||||
|
|
||||||
if (statusValues[STATUS_DOWNLOADING]) {
|
if (statusValues[STATUS_DOWNLOADING]) {
|
||||||
ctx.globalAlpha = statusValues[STATUS_DOWNLOADING];
|
ctx.globalAlpha = statusValues[STATUS_DOWNLOADING];
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -43,60 +43,60 @@ window.qBittorrent.ProgressBar = (function() {
|
||||||
const ProgressBar = new Class({
|
const ProgressBar = new Class({
|
||||||
initialize: function(value, parameters) {
|
initialize: function(value, parameters) {
|
||||||
const vals = {
|
const vals = {
|
||||||
'id': 'progressbar_' + (ProgressBars++),
|
"id": "progressbar_" + (ProgressBars++),
|
||||||
'value': [value, 0].pick(),
|
"value": [value, 0].pick(),
|
||||||
'width': 0,
|
"width": 0,
|
||||||
'height': 0,
|
"height": 0,
|
||||||
'darkbg': 'var(--color-background-blue)',
|
"darkbg": "var(--color-background-blue)",
|
||||||
'darkfg': 'var(--color-text-white)',
|
"darkfg": "var(--color-text-white)",
|
||||||
'lightbg': 'var(--color-background-default)',
|
"lightbg": "var(--color-background-default)",
|
||||||
'lightfg': 'var(--color-text-default)'
|
"lightfg": "var(--color-text-default)"
|
||||||
};
|
};
|
||||||
if (parameters && (typeOf(parameters) === 'object'))
|
if (parameters && (typeOf(parameters) === "object"))
|
||||||
Object.append(vals, parameters);
|
Object.append(vals, parameters);
|
||||||
if (vals.height < 12)
|
if (vals.height < 12)
|
||||||
vals.height = 12;
|
vals.height = 12;
|
||||||
const obj = new Element('div', {
|
const obj = new Element("div", {
|
||||||
'id': vals.id,
|
"id": vals.id,
|
||||||
'class': 'progressbar_wrapper',
|
"class": "progressbar_wrapper",
|
||||||
'styles': {
|
"styles": {
|
||||||
'border': '1px solid var(--color-border-default)',
|
"border": "1px solid var(--color-border-default)",
|
||||||
'width': vals.width,
|
"width": vals.width,
|
||||||
'height': vals.height,
|
"height": vals.height,
|
||||||
'position': 'relative',
|
"position": "relative",
|
||||||
'margin': '0 auto'
|
"margin": "0 auto"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
obj.vals = vals;
|
obj.vals = vals;
|
||||||
obj.vals.value = [value, 0].pick();
|
obj.vals.value = [value, 0].pick();
|
||||||
obj.vals.dark = new Element('div', {
|
obj.vals.dark = new Element("div", {
|
||||||
'id': vals.id + '_dark',
|
"id": vals.id + "_dark",
|
||||||
'class': 'progressbar_dark',
|
"class": "progressbar_dark",
|
||||||
'styles': {
|
"styles": {
|
||||||
'width': vals.width,
|
"width": vals.width,
|
||||||
'height': vals.height,
|
"height": vals.height,
|
||||||
'background': vals.darkbg,
|
"background": vals.darkbg,
|
||||||
'color': vals.darkfg,
|
"color": vals.darkfg,
|
||||||
'position': 'absolute',
|
"position": "absolute",
|
||||||
'text-align': 'center',
|
"text-align": "center",
|
||||||
'left': 0,
|
"left": 0,
|
||||||
'top': 0,
|
"top": 0,
|
||||||
'line-height': vals.height
|
"line-height": vals.height
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
obj.vals.light = new Element('div', {
|
obj.vals.light = new Element("div", {
|
||||||
'id': vals.id + '_light',
|
"id": vals.id + "_light",
|
||||||
'class': 'progressbar_light',
|
"class": "progressbar_light",
|
||||||
'styles': {
|
"styles": {
|
||||||
'width': vals.width,
|
"width": vals.width,
|
||||||
'height': vals.height,
|
"height": vals.height,
|
||||||
'background': vals.lightbg,
|
"background": vals.lightbg,
|
||||||
'color': vals.lightfg,
|
"color": vals.lightfg,
|
||||||
'position': 'absolute',
|
"position": "absolute",
|
||||||
'text-align': 'center',
|
"text-align": "center",
|
||||||
'left': 0,
|
"left": 0,
|
||||||
'top': 0,
|
"top": 0,
|
||||||
'line-height': vals.height
|
"line-height": vals.height
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
obj.appendChild(obj.vals.dark);
|
obj.appendChild(obj.vals.dark);
|
||||||
|
@ -127,19 +127,19 @@ window.qBittorrent.ProgressBar = (function() {
|
||||||
this.vals.value = value;
|
this.vals.value = value;
|
||||||
this.vals.dark.empty();
|
this.vals.dark.empty();
|
||||||
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) + "%");
|
||||||
const 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)");
|
||||||
}
|
}
|
||||||
|
|
||||||
function ProgressBar_setWidth(value) {
|
function ProgressBar_setWidth(value) {
|
||||||
if (this.vals.width !== value) {
|
if (this.vals.width !== value) {
|
||||||
this.vals.width = value;
|
this.vals.width = value;
|
||||||
this.setStyle('width', value);
|
this.setStyle("width", value);
|
||||||
this.vals.dark.setStyle('width', value);
|
this.vals.dark.setStyle("width", value);
|
||||||
this.vals.light.setStyle('width', value);
|
this.vals.light.setStyle("width", value);
|
||||||
this.setValue(this.vals.value);
|
this.setValue(this.vals.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,10 +150,10 @@ window.qBittorrent.ProgressBar = (function() {
|
||||||
return;
|
return;
|
||||||
if (!obj.parentNode)
|
if (!obj.parentNode)
|
||||||
return setTimeout('ProgressBar_checkForParent("' + id + '")', 1);
|
return setTimeout('ProgressBar_checkForParent("' + id + '")', 1);
|
||||||
obj.setStyle('width', '100%');
|
obj.setStyle("width", "100%");
|
||||||
const 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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -107,8 +107,8 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
|
|
||||||
const checkbox = e.target;
|
const checkbox = e.target;
|
||||||
const priority = checkbox.checked ? FilePriority.Normal : FilePriority.Ignored;
|
const priority = checkbox.checked ? FilePriority.Normal : FilePriority.Ignored;
|
||||||
const id = checkbox.get('data-id');
|
const id = checkbox.get("data-id");
|
||||||
const fileId = checkbox.get('data-file-id');
|
const fileId = checkbox.get("data-file-id");
|
||||||
|
|
||||||
const rows = getAllChildren(id, fileId);
|
const rows = getAllChildren(id, fileId);
|
||||||
|
|
||||||
|
@ -119,8 +119,8 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
const fileComboboxChanged = function(e) {
|
const fileComboboxChanged = function(e) {
|
||||||
const combobox = e.target;
|
const combobox = e.target;
|
||||||
const priority = combobox.value;
|
const priority = combobox.value;
|
||||||
const id = combobox.get('data-id');
|
const id = combobox.get("data-id");
|
||||||
const fileId = combobox.get('data-file-id');
|
const fileId = combobox.get("data-file-id");
|
||||||
|
|
||||||
const rows = getAllChildren(id, fileId);
|
const rows = getAllChildren(id, fileId);
|
||||||
|
|
||||||
|
@ -129,24 +129,24 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const isDownloadCheckboxExists = function(id) {
|
const isDownloadCheckboxExists = function(id) {
|
||||||
return ($('cbPrio' + id) !== null);
|
return ($("cbPrio" + id) !== null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const createDownloadCheckbox = function(id, fileId, checked) {
|
const createDownloadCheckbox = function(id, fileId, checked) {
|
||||||
const checkbox = new Element('input');
|
const checkbox = new Element("input");
|
||||||
checkbox.set('type', 'checkbox');
|
checkbox.set("type", "checkbox");
|
||||||
checkbox.set('id', 'cbPrio' + id);
|
checkbox.set("id", "cbPrio" + id);
|
||||||
checkbox.set('data-id', id);
|
checkbox.set("data-id", id);
|
||||||
checkbox.set('data-file-id', fileId);
|
checkbox.set("data-file-id", fileId);
|
||||||
checkbox.set('class', 'DownloadedCB');
|
checkbox.set("class", "DownloadedCB");
|
||||||
checkbox.addEvent('click', fileCheckboxClicked);
|
checkbox.addEvent("click", fileCheckboxClicked);
|
||||||
|
|
||||||
updateCheckbox(checkbox, checked);
|
updateCheckbox(checkbox, checked);
|
||||||
return checkbox;
|
return checkbox;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateDownloadCheckbox = function(id, checked) {
|
const updateDownloadCheckbox = function(id, checked) {
|
||||||
const checkbox = $('cbPrio' + id);
|
const checkbox = $("cbPrio" + id);
|
||||||
updateCheckbox(checkbox, checked);
|
updateCheckbox(checkbox, checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -165,41 +165,41 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const isPriorityComboExists = function(id) {
|
const isPriorityComboExists = function(id) {
|
||||||
return ($('comboPrio' + id) !== null);
|
return ($("comboPrio" + id) !== null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const createPriorityOptionElement = function(priority, selected, html) {
|
const createPriorityOptionElement = function(priority, selected, html) {
|
||||||
const 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)
|
||||||
elem.selected = true;
|
elem.selected = true;
|
||||||
return elem;
|
return elem;
|
||||||
};
|
};
|
||||||
|
|
||||||
const createPriorityCombo = function(id, fileId, selectedPriority) {
|
const createPriorityCombo = function(id, fileId, selectedPriority) {
|
||||||
const 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('data-file-id', fileId);
|
select.set("data-file-id", fileId);
|
||||||
select.addClass('combo_priority');
|
select.addClass("combo_priority");
|
||||||
select.addEvent('change', fileComboboxChanged);
|
select.addEvent("change", fileComboboxChanged);
|
||||||
|
|
||||||
createPriorityOptionElement(FilePriority.Ignored, (FilePriority.Ignored === selectedPriority), 'QBT_TR(Do not download)QBT_TR[CONTEXT=PropListDelegate]').injectInside(select);
|
createPriorityOptionElement(FilePriority.Ignored, (FilePriority.Ignored === selectedPriority), "QBT_TR(Do not download)QBT_TR[CONTEXT=PropListDelegate]").injectInside(select);
|
||||||
createPriorityOptionElement(FilePriority.Normal, (FilePriority.Normal === selectedPriority), 'QBT_TR(Normal)QBT_TR[CONTEXT=PropListDelegate]').injectInside(select);
|
createPriorityOptionElement(FilePriority.Normal, (FilePriority.Normal === selectedPriority), "QBT_TR(Normal)QBT_TR[CONTEXT=PropListDelegate]").injectInside(select);
|
||||||
createPriorityOptionElement(FilePriority.High, (FilePriority.High === selectedPriority), 'QBT_TR(High)QBT_TR[CONTEXT=PropListDelegate]').injectInside(select);
|
createPriorityOptionElement(FilePriority.High, (FilePriority.High === selectedPriority), "QBT_TR(High)QBT_TR[CONTEXT=PropListDelegate]").injectInside(select);
|
||||||
createPriorityOptionElement(FilePriority.Maximum, (FilePriority.Maximum === selectedPriority), 'QBT_TR(Maximum)QBT_TR[CONTEXT=PropListDelegate]').injectInside(select);
|
createPriorityOptionElement(FilePriority.Maximum, (FilePriority.Maximum === selectedPriority), "QBT_TR(Maximum)QBT_TR[CONTEXT=PropListDelegate]").injectInside(select);
|
||||||
|
|
||||||
// "Mixed" priority is for display only; it shouldn't be selectable
|
// "Mixed" priority is for display only; it shouldn't be selectable
|
||||||
const mixedPriorityOption = createPriorityOptionElement(FilePriority.Mixed, (FilePriority.Mixed === selectedPriority), 'QBT_TR(Mixed)QBT_TR[CONTEXT=PropListDelegate]');
|
const mixedPriorityOption = createPriorityOptionElement(FilePriority.Mixed, (FilePriority.Mixed === selectedPriority), "QBT_TR(Mixed)QBT_TR[CONTEXT=PropListDelegate]");
|
||||||
mixedPriorityOption.set('disabled', true);
|
mixedPriorityOption.set("disabled", true);
|
||||||
mixedPriorityOption.injectInside(select);
|
mixedPriorityOption.injectInside(select);
|
||||||
|
|
||||||
return select;
|
return select;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updatePriorityCombo = function(id, selectedPriority) {
|
const updatePriorityCombo = function(id, selectedPriority) {
|
||||||
const combobox = $('comboPrio' + id);
|
const combobox = $("comboPrio" + id);
|
||||||
|
|
||||||
if (parseInt(combobox.value) !== selectedPriority)
|
if (parseInt(combobox.value) !== selectedPriority)
|
||||||
selectComboboxPriority(combobox, selectedPriority);
|
selectComboboxPriority(combobox, selectedPriority);
|
||||||
|
@ -224,7 +224,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
const rowIds = [];
|
const rowIds = [];
|
||||||
const fileIds = [];
|
const fileIds = [];
|
||||||
let priority = FilePriority.Ignored;
|
let priority = FilePriority.Ignored;
|
||||||
const checkbox = $('tristate_cb');
|
const checkbox = $("tristate_cb");
|
||||||
|
|
||||||
if (checkbox.state === "checked") {
|
if (checkbox.state === "checked") {
|
||||||
setCheckboxUnchecked(checkbox);
|
setCheckboxUnchecked(checkbox);
|
||||||
|
@ -261,7 +261,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateGlobalCheckbox = function() {
|
const updateGlobalCheckbox = function() {
|
||||||
const checkbox = $('tristate_cb');
|
const checkbox = $("tristate_cb");
|
||||||
if (isAllCheckboxesChecked())
|
if (isAllCheckboxesChecked())
|
||||||
setCheckboxChecked(checkbox);
|
setCheckboxChecked(checkbox);
|
||||||
else if (isAllCheckboxesUnchecked())
|
else if (isAllCheckboxesUnchecked())
|
||||||
|
@ -288,7 +288,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAllCheckboxesChecked = function() {
|
const isAllCheckboxesChecked = function() {
|
||||||
const checkboxes = $$('input.DownloadedCB');
|
const checkboxes = $$("input.DownloadedCB");
|
||||||
for (let 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;
|
||||||
|
@ -297,7 +297,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAllCheckboxesUnchecked = function() {
|
const isAllCheckboxesUnchecked = function() {
|
||||||
const checkboxes = $$('input.DownloadedCB');
|
const checkboxes = $$("input.DownloadedCB");
|
||||||
for (let 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;
|
||||||
|
@ -311,12 +311,12 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
|
|
||||||
clearTimeout(loadTorrentFilesDataTimer);
|
clearTimeout(loadTorrentFilesDataTimer);
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/filePrio',
|
url: "api/v2/torrents/filePrio",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
'hash': current_hash,
|
"hash": current_hash,
|
||||||
'id': fileIds.join('|'),
|
"id": fileIds.join("|"),
|
||||||
'priority': priority
|
"priority": priority
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
loadTorrentFilesDataTimer = loadTorrentFilesData.delay(1000);
|
loadTorrentFilesDataTimer = loadTorrentFilesData.delay(1000);
|
||||||
|
@ -327,7 +327,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
ids.forEach(function(_id) {
|
ids.forEach(function(_id) {
|
||||||
torrentFilesTable.setIgnored(_id, ignore);
|
torrentFilesTable.setIgnored(_id, ignore);
|
||||||
|
|
||||||
const combobox = $('comboPrio' + _id);
|
const combobox = $("comboPrio" + _id);
|
||||||
if (combobox !== null)
|
if (combobox !== null)
|
||||||
selectComboboxPriority(combobox, priority);
|
selectComboboxPriority(combobox, priority);
|
||||||
});
|
});
|
||||||
|
@ -337,8 +337,8 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
|
|
||||||
let loadTorrentFilesDataTimer;
|
let loadTorrentFilesDataTimer;
|
||||||
const 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;
|
||||||
}
|
}
|
||||||
|
@ -355,10 +355,10 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
current_hash = new_hash;
|
current_hash = new_hash;
|
||||||
loadedNewTorrent = true;
|
loadedNewTorrent = true;
|
||||||
}
|
}
|
||||||
const 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,
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
clearTimeout(loadTorrentFilesDataTimer);
|
clearTimeout(loadTorrentFilesDataTimer);
|
||||||
|
@ -427,7 +427,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
pathItems.pop(); // remove last item (i.e. file name)
|
pathItems.pop(); // remove last item (i.e. file name)
|
||||||
let parent = rootNode;
|
let parent = rootNode;
|
||||||
pathItems.forEach(function(folderName) {
|
pathItems.forEach(function(folderName) {
|
||||||
if (folderName === '.unwanted')
|
if (folderName === ".unwanted")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let folderNode = null;
|
let folderNode = null;
|
||||||
|
@ -517,7 +517,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
const rowIds = [];
|
const rowIds = [];
|
||||||
const fileIds = [];
|
const fileIds = [];
|
||||||
selectedRows.forEach(function(rowId) {
|
selectedRows.forEach(function(rowId) {
|
||||||
const elem = $('comboPrio' + rowId);
|
const elem = $("comboPrio" + rowId);
|
||||||
rowIds.push(rowId);
|
rowIds.push(rowId);
|
||||||
fileIds.push(elem.get("data-file-id"));
|
fileIds.push(elem.get("data-file-id"));
|
||||||
});
|
});
|
||||||
|
@ -549,11 +549,11 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
const path = node.path;
|
const path = node.path;
|
||||||
|
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'renamePage',
|
id: "renamePage",
|
||||||
title: "QBT_TR(Renaming)QBT_TR[CONTEXT=TorrentContentTreeView]",
|
title: "QBT_TR(Renaming)QBT_TR[CONTEXT=TorrentContentTreeView]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: 'rename_file.html?hash=' + hash + '&isFolder=' + node.isFolder
|
contentURL: "rename_file.html?hash=" + hash + "&isFolder=" + node.isFolder
|
||||||
+ '&path=' + encodeURIComponent(path),
|
+ "&path=" + encodeURIComponent(path),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -566,11 +566,11 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
|
|
||||||
const multiFileRename = function(hash) {
|
const multiFileRename = function(hash) {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'multiRenamePage',
|
id: "multiRenamePage",
|
||||||
title: "QBT_TR(Renaming)QBT_TR[CONTEXT=TorrentContentTreeView]",
|
title: "QBT_TR(Renaming)QBT_TR[CONTEXT=TorrentContentTreeView]",
|
||||||
data: { hash: hash, selectedRows: torrentFilesTable.selectedRows },
|
data: { hash: hash, selectedRows: torrentFilesTable.selectedRows },
|
||||||
loadMethod: 'xhr',
|
loadMethod: "xhr",
|
||||||
contentURL: 'rename_files.html',
|
contentURL: "rename_files.html",
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -578,13 +578,13 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
paddingHorizontal: 0,
|
paddingHorizontal: 0,
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 420,
|
height: 420,
|
||||||
resizeLimit: { 'x': [800], 'y': [420] }
|
resizeLimit: { "x": [800], "y": [420] }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const torrentFilesContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
const torrentFilesContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
||||||
targets: '#torrentFilesTableDiv tr',
|
targets: "#torrentFilesTableDiv tr",
|
||||||
menu: 'torrentFilesMenu',
|
menu: "torrentFilesMenu",
|
||||||
actions: {
|
actions: {
|
||||||
Rename: function(element, ref) {
|
Rename: function(element, ref) {
|
||||||
const hash = torrentsTable.getCurrentTorrentID();
|
const hash = torrentsTable.getCurrentTorrentID();
|
||||||
|
@ -618,20 +618,20 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
if (is_seed)
|
if (is_seed)
|
||||||
this.hideItem('FilePrio');
|
this.hideItem("FilePrio");
|
||||||
else
|
else
|
||||||
this.showItem('FilePrio');
|
this.showItem("FilePrio");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
torrentFilesTable.setup('torrentFilesTableDiv', 'torrentFilesTableFixedHeaderDiv', torrentFilesContextMenu);
|
torrentFilesTable.setup("torrentFilesTableDiv", "torrentFilesTableFixedHeaderDiv", torrentFilesContextMenu);
|
||||||
// inject checkbox into table header
|
// inject checkbox into table header
|
||||||
const tableHeaders = $$('#torrentFilesTableFixedHeaderDiv .dynamicTableHeader th');
|
const tableHeaders = $$("#torrentFilesTableFixedHeaderDiv .dynamicTableHeader th");
|
||||||
if (tableHeaders.length > 0) {
|
if (tableHeaders.length > 0) {
|
||||||
const 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);
|
||||||
|
|
||||||
const checkboxTH = tableHeaders[0];
|
const checkboxTH = tableHeaders[0];
|
||||||
checkbox.injectInside(checkboxTH);
|
checkbox.injectInside(checkboxTH);
|
||||||
|
@ -639,14 +639,14 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
|
|
||||||
// default sort by name column
|
// default sort by name column
|
||||||
if (torrentFilesTable.getSortedColumn() === null)
|
if (torrentFilesTable.getSortedColumn() === null)
|
||||||
torrentFilesTable.setSortedColumn('name');
|
torrentFilesTable.setSortedColumn("name");
|
||||||
|
|
||||||
// listen for changes to torrentFilesFilterInput
|
// listen for changes to torrentFilesFilterInput
|
||||||
let torrentFilesFilterInputTimer = -1;
|
let torrentFilesFilterInputTimer = -1;
|
||||||
$('torrentFilesFilterInput').addEvent('input', () => {
|
$("torrentFilesFilterInput").addEvent("input", () => {
|
||||||
clearTimeout(torrentFilesFilterInputTimer);
|
clearTimeout(torrentFilesFilterInputTimer);
|
||||||
|
|
||||||
const value = $('torrentFilesFilterInput').get("value");
|
const value = $("torrentFilesFilterInput").get("value");
|
||||||
torrentFilesTable.setFilter(value);
|
torrentFilesTable.setFilter(value);
|
||||||
|
|
||||||
torrentFilesFilterInputTimer = setTimeout(() => {
|
torrentFilesFilterInputTimer = setTimeout(() => {
|
||||||
|
@ -668,7 +668,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
* Show/hide a node's row
|
* Show/hide a node's row
|
||||||
*/
|
*/
|
||||||
const _hideNode = function(node, shouldHide) {
|
const _hideNode = function(node, shouldHide) {
|
||||||
const span = $('filesTablefileName' + node.rowId);
|
const span = $("filesTablefileName" + node.rowId);
|
||||||
// span won't exist if row has been filtered out
|
// span won't exist if row has been filtered out
|
||||||
if (span === null)
|
if (span === null)
|
||||||
return;
|
return;
|
||||||
|
@ -683,7 +683,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
* Update a node's collapsed state and icon
|
* Update a node's collapsed state and icon
|
||||||
*/
|
*/
|
||||||
const _updateNodeState = function(node, isCollapsed) {
|
const _updateNodeState = function(node, isCollapsed) {
|
||||||
const span = $('filesTablefileName' + node.rowId);
|
const span = $("filesTablefileName" + node.rowId);
|
||||||
// span won't exist if row has been filtered out
|
// span won't exist if row has been filtered out
|
||||||
if (span === null)
|
if (span === null)
|
||||||
return;
|
return;
|
||||||
|
@ -701,7 +701,7 @@ window.qBittorrent.PropFiles = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const _isCollapsed = function(node) {
|
const _isCollapsed = function(node) {
|
||||||
const span = $('filesTablefileName' + node.rowId);
|
const span = $("filesTablefileName" + node.rowId);
|
||||||
if (span === null)
|
if (span === null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -42,42 +42,42 @@ window.qBittorrent.PropGeneral = (function() {
|
||||||
const piecesBar = new window.qBittorrent.PiecesBar.PiecesBar([], {
|
const piecesBar = new window.qBittorrent.PiecesBar.PiecesBar([], {
|
||||||
height: 16
|
height: 16
|
||||||
});
|
});
|
||||||
$('progress').appendChild(piecesBar);
|
$("progress").appendChild(piecesBar);
|
||||||
|
|
||||||
const 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", "");
|
||||||
$('total_downloaded').set('html', '');
|
$("total_downloaded").set("html", "");
|
||||||
$('total_uploaded').set('html', '');
|
$("total_uploaded").set("html", "");
|
||||||
$('dl_speed').set('html', '');
|
$("dl_speed").set("html", "");
|
||||||
$('up_speed').set('html', '');
|
$("up_speed").set("html", "");
|
||||||
$('dl_limit').set('html', '');
|
$("dl_limit").set("html", "");
|
||||||
$('up_limit').set('html', '');
|
$("up_limit").set("html", "");
|
||||||
$('total_wasted').set('html', '');
|
$("total_wasted").set("html", "");
|
||||||
$('seeds').set('html', '');
|
$("seeds").set("html", "");
|
||||||
$('peers').set('html', '');
|
$("peers").set("html", "");
|
||||||
$('share_ratio').set('html', '');
|
$("share_ratio").set("html", "");
|
||||||
$('popularity').set('html', '');
|
$("popularity").set("html", "");
|
||||||
$('reannounce').set('html', '');
|
$("reannounce").set("html", "");
|
||||||
$('last_seen').set('html', '');
|
$("last_seen").set("html", "");
|
||||||
$('total_size').set('html', '');
|
$("total_size").set("html", "");
|
||||||
$('pieces').set('html', '');
|
$("pieces").set("html", "");
|
||||||
$('created_by').set('html', '');
|
$("created_by").set("html", "");
|
||||||
$('addition_date').set('html', '');
|
$("addition_date").set("html", "");
|
||||||
$('completion_date').set('html', '');
|
$("completion_date").set("html", "");
|
||||||
$('creation_date').set('html', '');
|
$("creation_date").set("html", "");
|
||||||
$('torrent_hash_v1').set('html', '');
|
$("torrent_hash_v1").set("html", "");
|
||||||
$('torrent_hash_v2').set('html', '');
|
$("torrent_hash_v2").set("html", "");
|
||||||
$('save_path').set('html', '');
|
$("save_path").set("html", "");
|
||||||
$('comment').set('html', '');
|
$("comment").set("html", "");
|
||||||
piecesBar.clear();
|
piecesBar.clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
let loadTorrentDataTimer;
|
let loadTorrentDataTimer;
|
||||||
const 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;
|
||||||
}
|
}
|
||||||
|
@ -88,18 +88,18 @@ window.qBittorrent.PropGeneral = (function() {
|
||||||
loadTorrentDataTimer = loadTorrentData.delay(5000);
|
loadTorrentDataTimer = loadTorrentData.delay(5000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const url = new URI('api/v2/torrents/properties?hash=' + current_id);
|
const url = new URI("api/v2/torrents/properties?hash=" + current_id);
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onFailure: function() {
|
onFailure: function() {
|
||||||
$('error_div').set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
|
$("error_div").set("html", "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]");
|
||||||
clearTimeout(loadTorrentDataTimer);
|
clearTimeout(loadTorrentDataTimer);
|
||||||
loadTorrentDataTimer = loadTorrentData.delay(10000);
|
loadTorrentDataTimer = loadTorrentData.delay(10000);
|
||||||
},
|
},
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
$('error_div').set('html', '');
|
$("error_div").set("html", "");
|
||||||
if (data) {
|
if (data) {
|
||||||
// Update Torrent data
|
// Update Torrent data
|
||||||
|
|
||||||
|
@ -108,109 +108,109 @@ window.qBittorrent.PropGeneral = (function() {
|
||||||
.replace("%1", window.qBittorrent.Misc.friendlyDuration(data.time_elapsed))
|
.replace("%1", window.qBittorrent.Misc.friendlyDuration(data.time_elapsed))
|
||||||
.replace("%2", window.qBittorrent.Misc.friendlyDuration(data.seeding_time))
|
.replace("%2", window.qBittorrent.Misc.friendlyDuration(data.seeding_time))
|
||||||
: window.qBittorrent.Misc.friendlyDuration(data.time_elapsed);
|
: window.qBittorrent.Misc.friendlyDuration(data.time_elapsed);
|
||||||
$('time_elapsed').set('html', timeElapsed);
|
$("time_elapsed").set("html", timeElapsed);
|
||||||
|
|
||||||
$('eta').set('html', window.qBittorrent.Misc.friendlyDuration(data.eta, window.qBittorrent.Misc.MAX_ETA));
|
$("eta").set("html", window.qBittorrent.Misc.friendlyDuration(data.eta, window.qBittorrent.Misc.MAX_ETA));
|
||||||
|
|
||||||
const nbConnections = "QBT_TR(%1 (%2 max))QBT_TR[CONTEXT=PropertiesWidget]"
|
const nbConnections = "QBT_TR(%1 (%2 max))QBT_TR[CONTEXT=PropertiesWidget]"
|
||||||
.replace("%1", data.nb_connections)
|
.replace("%1", data.nb_connections)
|
||||||
.replace("%2", ((data.nb_connections_limit < 0) ? "∞" : data.nb_connections_limit));
|
.replace("%2", ((data.nb_connections_limit < 0) ? "∞" : data.nb_connections_limit));
|
||||||
$('nb_connections').set('html', nbConnections);
|
$("nb_connections").set("html", nbConnections);
|
||||||
|
|
||||||
const totalDownloaded = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]"
|
const totalDownloaded = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]"
|
||||||
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.total_downloaded))
|
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.total_downloaded))
|
||||||
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.total_downloaded_session));
|
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.total_downloaded_session));
|
||||||
$('total_downloaded').set('html', totalDownloaded);
|
$("total_downloaded").set("html", totalDownloaded);
|
||||||
|
|
||||||
const totalUploaded = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]"
|
const totalUploaded = "QBT_TR(%1 (%2 this session))QBT_TR[CONTEXT=PropertiesWidget]"
|
||||||
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.total_uploaded))
|
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.total_uploaded))
|
||||||
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.total_uploaded_session));
|
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.total_uploaded_session));
|
||||||
$('total_uploaded').set('html', totalUploaded);
|
$("total_uploaded").set("html", totalUploaded);
|
||||||
|
|
||||||
const dlSpeed = "QBT_TR(%1 (%2 avg.))QBT_TR[CONTEXT=PropertiesWidget]"
|
const dlSpeed = "QBT_TR(%1 (%2 avg.))QBT_TR[CONTEXT=PropertiesWidget]"
|
||||||
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.dl_speed, true))
|
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.dl_speed, true))
|
||||||
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.dl_speed_avg, true));
|
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.dl_speed_avg, true));
|
||||||
$('dl_speed').set('html', dlSpeed);
|
$("dl_speed").set("html", dlSpeed);
|
||||||
|
|
||||||
const upSpeed = "QBT_TR(%1 (%2 avg.))QBT_TR[CONTEXT=PropertiesWidget]"
|
const upSpeed = "QBT_TR(%1 (%2 avg.))QBT_TR[CONTEXT=PropertiesWidget]"
|
||||||
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.up_speed, true))
|
.replace("%1", window.qBittorrent.Misc.friendlyUnit(data.up_speed, true))
|
||||||
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.up_speed_avg, true));
|
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.up_speed_avg, true));
|
||||||
$('up_speed').set('html', upSpeed);
|
$("up_speed").set("html", upSpeed);
|
||||||
|
|
||||||
const dlLimit = (data.dl_limit === -1)
|
const dlLimit = (data.dl_limit === -1)
|
||||||
? "∞"
|
? "∞"
|
||||||
: window.qBittorrent.Misc.friendlyUnit(data.dl_limit, true);
|
: window.qBittorrent.Misc.friendlyUnit(data.dl_limit, true);
|
||||||
$('dl_limit').set('html', dlLimit);
|
$("dl_limit").set("html", dlLimit);
|
||||||
|
|
||||||
const upLimit = (data.up_limit === -1)
|
const upLimit = (data.up_limit === -1)
|
||||||
? "∞"
|
? "∞"
|
||||||
: window.qBittorrent.Misc.friendlyUnit(data.up_limit, true);
|
: window.qBittorrent.Misc.friendlyUnit(data.up_limit, true);
|
||||||
$('up_limit').set('html', upLimit);
|
$("up_limit").set("html", upLimit);
|
||||||
|
|
||||||
$('total_wasted').set('html', window.qBittorrent.Misc.friendlyUnit(data.total_wasted));
|
$("total_wasted").set("html", window.qBittorrent.Misc.friendlyUnit(data.total_wasted));
|
||||||
|
|
||||||
const seeds = "QBT_TR(%1 (%2 total))QBT_TR[CONTEXT=PropertiesWidget]"
|
const seeds = "QBT_TR(%1 (%2 total))QBT_TR[CONTEXT=PropertiesWidget]"
|
||||||
.replace("%1", data.seeds)
|
.replace("%1", data.seeds)
|
||||||
.replace("%2", data.seeds_total);
|
.replace("%2", data.seeds_total);
|
||||||
$('seeds').set('html', seeds);
|
$("seeds").set("html", seeds);
|
||||||
|
|
||||||
const peers = "QBT_TR(%1 (%2 total))QBT_TR[CONTEXT=PropertiesWidget]"
|
const peers = "QBT_TR(%1 (%2 total))QBT_TR[CONTEXT=PropertiesWidget]"
|
||||||
.replace("%1", data.peers)
|
.replace("%1", data.peers)
|
||||||
.replace("%2", data.peers_total);
|
.replace("%2", data.peers_total);
|
||||||
$('peers').set('html', peers);
|
$("peers").set("html", peers);
|
||||||
|
|
||||||
$('share_ratio').set('html', data.share_ratio.toFixed(2));
|
$("share_ratio").set("html", data.share_ratio.toFixed(2));
|
||||||
|
|
||||||
$('popularity').set('html', data.popularity.toFixed(2));
|
$("popularity").set("html", data.popularity.toFixed(2));
|
||||||
|
|
||||||
$('reannounce').set('html', window.qBittorrent.Misc.friendlyDuration(data.reannounce));
|
$("reannounce").set("html", window.qBittorrent.Misc.friendlyDuration(data.reannounce));
|
||||||
|
|
||||||
const lastSeen = (data.last_seen >= 0)
|
const lastSeen = (data.last_seen >= 0)
|
||||||
? new Date(data.last_seen * 1000).toLocaleString()
|
? new Date(data.last_seen * 1000).toLocaleString()
|
||||||
: "QBT_TR(Never)QBT_TR[CONTEXT=PropertiesWidget]";
|
: "QBT_TR(Never)QBT_TR[CONTEXT=PropertiesWidget]";
|
||||||
$('last_seen').set('html', lastSeen);
|
$("last_seen").set("html", lastSeen);
|
||||||
|
|
||||||
const totalSize = (data.total_size >= 0) ? window.qBittorrent.Misc.friendlyUnit(data.total_size) : "";
|
const totalSize = (data.total_size >= 0) ? window.qBittorrent.Misc.friendlyUnit(data.total_size) : "";
|
||||||
$('total_size').set('html', totalSize);
|
$("total_size").set("html", totalSize);
|
||||||
|
|
||||||
const pieces = (data.pieces_num >= 0)
|
const pieces = (data.pieces_num >= 0)
|
||||||
? "QBT_TR(%1 x %2 (have %3))QBT_TR[CONTEXT=PropertiesWidget]"
|
? "QBT_TR(%1 x %2 (have %3))QBT_TR[CONTEXT=PropertiesWidget]"
|
||||||
.replace("%1", data.pieces_num)
|
.replace("%1", data.pieces_num)
|
||||||
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.piece_size))
|
.replace("%2", window.qBittorrent.Misc.friendlyUnit(data.piece_size))
|
||||||
.replace("%3", data.pieces_have)
|
.replace("%3", data.pieces_have)
|
||||||
: '';
|
: "";
|
||||||
$('pieces').set('html', pieces);
|
$("pieces").set("html", pieces);
|
||||||
|
|
||||||
$('created_by').set('text', data.created_by);
|
$("created_by").set("text", data.created_by);
|
||||||
|
|
||||||
const additionDate = (data.addition_date >= 0)
|
const additionDate = (data.addition_date >= 0)
|
||||||
? new Date(data.addition_date * 1000).toLocaleString()
|
? new Date(data.addition_date * 1000).toLocaleString()
|
||||||
: "QBT_TR(Unknown)QBT_TR[CONTEXT=HttpServer]";
|
: "QBT_TR(Unknown)QBT_TR[CONTEXT=HttpServer]";
|
||||||
$('addition_date').set('html', additionDate);
|
$("addition_date").set("html", additionDate);
|
||||||
|
|
||||||
const completionDate = (data.completion_date >= 0)
|
const completionDate = (data.completion_date >= 0)
|
||||||
? new Date(data.completion_date * 1000).toLocaleString()
|
? new Date(data.completion_date * 1000).toLocaleString()
|
||||||
: "";
|
: "";
|
||||||
$('completion_date').set('html', completionDate);
|
$("completion_date").set("html", completionDate);
|
||||||
|
|
||||||
const creationDate = (data.creation_date >= 0)
|
const creationDate = (data.creation_date >= 0)
|
||||||
? new Date(data.creation_date * 1000).toLocaleString()
|
? new Date(data.creation_date * 1000).toLocaleString()
|
||||||
: "";
|
: "";
|
||||||
$('creation_date').set('html', creationDate);
|
$("creation_date").set("html", creationDate);
|
||||||
|
|
||||||
const torrentHashV1 = (data.infohash_v1 !== "")
|
const torrentHashV1 = (data.infohash_v1 !== "")
|
||||||
? data.infohash_v1
|
? data.infohash_v1
|
||||||
: "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]";
|
: "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]";
|
||||||
$('torrent_hash_v1').set('html', torrentHashV1);
|
$("torrent_hash_v1").set("html", torrentHashV1);
|
||||||
|
|
||||||
const torrentHashV2 = (data.infohash_v2 !== "")
|
const torrentHashV2 = (data.infohash_v2 !== "")
|
||||||
? data.infohash_v2
|
? data.infohash_v2
|
||||||
: "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]";
|
: "QBT_TR(N/A)QBT_TR[CONTEXT=PropertiesWidget]";
|
||||||
$('torrent_hash_v2').set('html', torrentHashV2);
|
$("torrent_hash_v2").set("html", torrentHashV2);
|
||||||
|
|
||||||
$('save_path').set('html', data.save_path);
|
$("save_path").set("html", data.save_path);
|
||||||
|
|
||||||
$('comment').set('html', window.qBittorrent.Misc.parseHtmlLinks(window.qBittorrent.Misc.escapeHtml(data.comment)));
|
$("comment").set("html", window.qBittorrent.Misc.parseHtmlLinks(window.qBittorrent.Misc.escapeHtml(data.comment)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
clearData();
|
clearData();
|
||||||
|
@ -220,18 +220,18 @@ window.qBittorrent.PropGeneral = (function() {
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
|
||||||
const piecesUrl = new URI('api/v2/torrents/pieceStates?hash=' + current_id);
|
const piecesUrl = new URI("api/v2/torrents/pieceStates?hash=" + current_id);
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: piecesUrl,
|
url: piecesUrl,
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onFailure: function() {
|
onFailure: function() {
|
||||||
$('error_div').set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
|
$("error_div").set("html", "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]");
|
||||||
clearTimeout(loadTorrentDataTimer);
|
clearTimeout(loadTorrentDataTimer);
|
||||||
loadTorrentDataTimer = loadTorrentData.delay(10000);
|
loadTorrentDataTimer = loadTorrentData.delay(10000);
|
||||||
},
|
},
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
$('error_div').set('html', '');
|
$("error_div").set("html", "");
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
piecesBar.setPieces(data);
|
piecesBar.setPieces(data);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -45,8 +45,8 @@ window.qBittorrent.PropPeers = (function() {
|
||||||
let show_flags = true;
|
let show_flags = true;
|
||||||
|
|
||||||
const 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;
|
||||||
|
@ -59,45 +59,45 @@ window.qBittorrent.PropPeers = (function() {
|
||||||
loadTorrentPeersTimer = loadTorrentPeersData.delay(window.qBittorrent.Client.getSyncMainDataInterval());
|
loadTorrentPeersTimer = loadTorrentPeersData.delay(window.qBittorrent.Client.getSyncMainDataInterval());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const 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({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
clearTimeout(loadTorrentPeersTimer);
|
clearTimeout(loadTorrentPeersTimer);
|
||||||
loadTorrentPeersTimer = loadTorrentPeersData.delay(window.qBittorrent.Client.getSyncMainDataInterval());
|
loadTorrentPeersTimer = loadTorrentPeersData.delay(window.qBittorrent.Client.getSyncMainDataInterval());
|
||||||
},
|
},
|
||||||
onSuccess: function(response) {
|
onSuccess: function(response) {
|
||||||
$('error_div').set('html', '');
|
$("error_div").set("html", "");
|
||||||
if (response) {
|
if (response) {
|
||||||
const 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 (const key in response['peers']) {
|
for (const key in response["peers"]) {
|
||||||
response['peers'][key]['rowId'] = key;
|
response["peers"][key]["rowId"] = key;
|
||||||
|
|
||||||
torrentPeersTable.updateRowData(response['peers'][key]);
|
torrentPeersTable.updateRowData(response["peers"][key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (response['peers_removed']) {
|
if (response["peers_removed"]) {
|
||||||
response['peers_removed'].each(function(hash) {
|
response["peers_removed"].each(function(hash) {
|
||||||
torrentPeersTable.removeRow(hash);
|
torrentPeersTable.removeRow(hash);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
torrentPeersTable.updateTable(full_update);
|
torrentPeersTable.updateTable(full_update);
|
||||||
torrentPeersTable.altRow();
|
torrentPeersTable.altRow();
|
||||||
|
|
||||||
if (response['show_flags']) {
|
if (response["show_flags"]) {
|
||||||
if (show_flags !== response['show_flags']) {
|
if (show_flags !== response["show_flags"]) {
|
||||||
show_flags = response['show_flags'];
|
show_flags = response["show_flags"];
|
||||||
torrentPeersTable.columns['country'].force_hide = !show_flags;
|
torrentPeersTable.columns["country"].force_hide = !show_flags;
|
||||||
torrentPeersTable.updateColumn('country');
|
torrentPeersTable.updateColumn("country");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,8 +114,8 @@ window.qBittorrent.PropPeers = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const torrentPeersContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
const torrentPeersContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
||||||
targets: '#torrentPeersTableDiv',
|
targets: "#torrentPeersTableDiv",
|
||||||
menu: 'torrentPeersMenu',
|
menu: "torrentPeersMenu",
|
||||||
actions: {
|
actions: {
|
||||||
addPeer: function(element, ref) {
|
addPeer: function(element, ref) {
|
||||||
const hash = torrentsTable.getCurrentTorrentID();
|
const hash = torrentsTable.getCurrentTorrentID();
|
||||||
|
@ -123,10 +123,10 @@ window.qBittorrent.PropPeers = (function() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'addPeersPage',
|
id: "addPeersPage",
|
||||||
title: "QBT_TR(Add Peers)QBT_TR[CONTEXT=PeersAdditionDialog]",
|
title: "QBT_TR(Add Peers)QBT_TR[CONTEXT=PeersAdditionDialog]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: 'addpeers.html?hash=' + hash,
|
contentURL: "addpeers.html?hash=" + hash,
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -141,13 +141,13 @@ window.qBittorrent.PropPeers = (function() {
|
||||||
if (selectedPeers.length === 0)
|
if (selectedPeers.length === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (confirm('QBT_TR(Are you sure you want to permanently ban the selected peers?)QBT_TR[CONTEXT=PeerListWidget]')) {
|
if (confirm("QBT_TR(Are you sure you want to permanently ban the selected peers?)QBT_TR[CONTEXT=PeerListWidget]")) {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/transfer/banPeers',
|
url: "api/v2/transfer/banPeers",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hash: torrentsTable.getCurrentTorrentID(),
|
hash: torrentsTable.getCurrentTorrentID(),
|
||||||
peers: selectedPeers.join('|')
|
peers: selectedPeers.join("|")
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
@ -161,23 +161,23 @@ window.qBittorrent.PropPeers = (function() {
|
||||||
const selectedPeers = torrentPeersTable.selectedRowsIds();
|
const selectedPeers = torrentPeersTable.selectedRowsIds();
|
||||||
|
|
||||||
if (selectedPeers.length >= 1) {
|
if (selectedPeers.length >= 1) {
|
||||||
this.showItem('copyPeer');
|
this.showItem("copyPeer");
|
||||||
this.showItem('banPeer');
|
this.showItem("banPeer");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.hideItem('copyPeer');
|
this.hideItem("copyPeer");
|
||||||
this.hideItem('banPeer');
|
this.hideItem("banPeer");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
new ClipboardJS('#CopyPeerInfo', {
|
new ClipboardJS("#CopyPeerInfo", {
|
||||||
text: function(trigger) {
|
text: function(trigger) {
|
||||||
return torrentPeersTable.selectedRowsIds().join("\n");
|
return torrentPeersTable.selectedRowsIds().join("\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
torrentPeersTable.setup('torrentPeersTableDiv', 'torrentPeersTableFixedHeaderDiv', torrentPeersContextMenu);
|
torrentPeersTable.setup("torrentPeersTableDiv", "torrentPeersTableFixedHeaderDiv", torrentPeersContextMenu);
|
||||||
|
|
||||||
return exports();
|
return exports();
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -45,8 +45,8 @@ window.qBittorrent.PropTrackers = (function() {
|
||||||
let loadTrackersDataTimer;
|
let loadTrackersDataTimer;
|
||||||
|
|
||||||
const 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;
|
||||||
}
|
}
|
||||||
|
@ -61,10 +61,10 @@ window.qBittorrent.PropTrackers = (function() {
|
||||||
torrentTrackersTable.clear();
|
torrentTrackersTable.clear();
|
||||||
current_hash = new_hash;
|
current_hash = new_hash;
|
||||||
}
|
}
|
||||||
const 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,
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
clearTimeout(loadTrackersDataTimer);
|
clearTimeout(loadTrackersDataTimer);
|
||||||
|
@ -126,8 +126,8 @@ window.qBittorrent.PropTrackers = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const torrentTrackersContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
const torrentTrackersContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
||||||
targets: '#torrentTrackersTableDiv',
|
targets: "#torrentTrackersTableDiv",
|
||||||
menu: 'torrentTrackersMenu',
|
menu: "torrentTrackersMenu",
|
||||||
actions: {
|
actions: {
|
||||||
AddTracker: function(element, ref) {
|
AddTracker: function(element, ref) {
|
||||||
addTrackerFN();
|
addTrackerFN();
|
||||||
|
@ -152,14 +152,14 @@ window.qBittorrent.PropTrackers = (function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (containsStaticTracker || (selectedTrackers.length === 0)) {
|
if (containsStaticTracker || (selectedTrackers.length === 0)) {
|
||||||
this.hideItem('EditTracker');
|
this.hideItem("EditTracker");
|
||||||
this.hideItem('RemoveTracker');
|
this.hideItem("RemoveTracker");
|
||||||
this.hideItem('CopyTrackerUrl');
|
this.hideItem("CopyTrackerUrl");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.showItem('EditTracker');
|
this.showItem("EditTracker");
|
||||||
this.showItem('RemoveTracker');
|
this.showItem("RemoveTracker");
|
||||||
this.showItem('CopyTrackerUrl');
|
this.showItem("CopyTrackerUrl");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -168,10 +168,10 @@ window.qBittorrent.PropTrackers = (function() {
|
||||||
if (current_hash.length === 0)
|
if (current_hash.length === 0)
|
||||||
return;
|
return;
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'trackersPage',
|
id: "trackersPage",
|
||||||
title: "QBT_TR(Add trackers)QBT_TR[CONTEXT=TrackersAdditionDialog]",
|
title: "QBT_TR(Add trackers)QBT_TR[CONTEXT=TrackersAdditionDialog]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: 'addtrackers.html?hash=' + current_hash,
|
contentURL: "addtrackers.html?hash=" + current_hash,
|
||||||
scrollbars: true,
|
scrollbars: true,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -192,10 +192,10 @@ window.qBittorrent.PropTrackers = (function() {
|
||||||
|
|
||||||
const 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]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: 'edittracker.html?hash=' + current_hash + '&url=' + trackerUrl,
|
contentURL: "edittracker.html?hash=" + current_hash + "&url=" + trackerUrl,
|
||||||
scrollbars: true,
|
scrollbars: true,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -216,8 +216,8 @@ window.qBittorrent.PropTrackers = (function() {
|
||||||
|
|
||||||
const 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",
|
||||||
data: {
|
data: {
|
||||||
hash: current_hash,
|
hash: current_hash,
|
||||||
urls: selectedTrackers.join("|")
|
urls: selectedTrackers.join("|")
|
||||||
|
@ -228,13 +228,13 @@ window.qBittorrent.PropTrackers = (function() {
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
new ClipboardJS('#CopyTrackerUrl', {
|
new ClipboardJS("#CopyTrackerUrl", {
|
||||||
text: function(trigger) {
|
text: function(trigger) {
|
||||||
return torrentTrackersTable.selectedRowsIds().join("\n");
|
return torrentTrackersTable.selectedRowsIds().join("\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
torrentTrackersTable.setup('torrentTrackersTableDiv', 'torrentTrackersTableFixedHeaderDiv', torrentTrackersContextMenu);
|
torrentTrackersTable.setup("torrentTrackersTableDiv", "torrentTrackersTableFixedHeaderDiv", torrentTrackersContextMenu);
|
||||||
|
|
||||||
return exports();
|
return exports();
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -64,9 +64,9 @@ window.qBittorrent.PropWebseeds = (function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
updateRow: function(tr, row) {
|
updateRow: function(tr, row) {
|
||||||
const tds = tr.getElements('td');
|
const tds = tr.getElements("td");
|
||||||
for (let 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;
|
||||||
},
|
},
|
||||||
|
@ -79,11 +79,11 @@ window.qBittorrent.PropWebseeds = (function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//this.removeRow(id);
|
//this.removeRow(id);
|
||||||
const tr = new Element('tr');
|
const tr = new Element("tr");
|
||||||
this.rows.set(url, tr);
|
this.rows.set(url, tr);
|
||||||
for (let i = 0; i < row.length; ++i) {
|
for (let i = 0; i < row.length; ++i) {
|
||||||
const 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);
|
||||||
}
|
}
|
||||||
tr.injectInside(this.table);
|
tr.injectInside(this.table);
|
||||||
|
@ -94,8 +94,8 @@ window.qBittorrent.PropWebseeds = (function() {
|
||||||
|
|
||||||
let loadWebSeedsDataTimer;
|
let loadWebSeedsDataTimer;
|
||||||
const 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;
|
||||||
}
|
}
|
||||||
|
@ -110,18 +110,18 @@ window.qBittorrent.PropWebseeds = (function() {
|
||||||
wsTable.removeAllRows();
|
wsTable.removeAllRows();
|
||||||
current_hash = new_hash;
|
current_hash = new_hash;
|
||||||
}
|
}
|
||||||
const 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,
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onFailure: function() {
|
onFailure: function() {
|
||||||
$('error_div').set('html', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
|
$("error_div").set("html", "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]");
|
||||||
clearTimeout(loadWebSeedsDataTimer);
|
clearTimeout(loadWebSeedsDataTimer);
|
||||||
loadWebSeedsDataTimer = loadWebSeedsData.delay(20000);
|
loadWebSeedsDataTimer = loadWebSeedsData.delay(20000);
|
||||||
},
|
},
|
||||||
onSuccess: function(webseeds) {
|
onSuccess: function(webseeds) {
|
||||||
$('error_div').set('html', '');
|
$("error_div").set("html", "");
|
||||||
if (webseeds) {
|
if (webseeds) {
|
||||||
// Update WebSeeds data
|
// Update WebSeeds data
|
||||||
webseeds.each(function(webseed) {
|
webseeds.each(function(webseed) {
|
||||||
|
@ -146,7 +146,7 @@ window.qBittorrent.PropWebseeds = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const wsTable = new webseedsDynTable();
|
const wsTable = new webseedsDynTable();
|
||||||
wsTable.setup($('webseedsTable'));
|
wsTable.setup($("webseedsTable"));
|
||||||
|
|
||||||
return exports();
|
return exports();
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -19,7 +19,7 @@ window.qBittorrent.MultiRename = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const RenameFiles = new Class({
|
const RenameFiles = new Class({
|
||||||
hash: '',
|
hash: "",
|
||||||
selectedFiles: [],
|
selectedFiles: [],
|
||||||
matchedFiles: [],
|
matchedFiles: [],
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ window.qBittorrent.MultiRename = (function() {
|
||||||
return input.substring(0, start) + replacement + input.substring(end);
|
return input.substring(0, start) + replacement + input.substring(end);
|
||||||
};
|
};
|
||||||
const replaceGroup = (input, search, replacement, escape, stripEscape = true) => {
|
const replaceGroup = (input, search, replacement, escape, stripEscape = true) => {
|
||||||
let result = '';
|
let result = "";
|
||||||
let i = 0;
|
let i = 0;
|
||||||
while (i < input.length) {
|
while (i < input.length) {
|
||||||
// Check if the current index contains the escape string
|
// Check if the current index contains the escape string
|
||||||
|
@ -135,7 +135,7 @@ window.qBittorrent.MultiRename = (function() {
|
||||||
|
|
||||||
// Setup regex search
|
// Setup regex search
|
||||||
const regexEscapeExp = new RegExp(/[/\-\\^$*+?.()|[\]{}]/g);
|
const regexEscapeExp = new RegExp(/[/\-\\^$*+?.()|[\]{}]/g);
|
||||||
const standardSearch = new RegExp(this._inner_search.replace(regexEscapeExp, '\\$&'), regexFlags);
|
const standardSearch = new RegExp(this._inner_search.replace(regexEscapeExp, "\\$&"), regexFlags);
|
||||||
let regexSearch;
|
let regexSearch;
|
||||||
try {
|
try {
|
||||||
regexSearch = new RegExp(this._inner_search, regexFlags);
|
regexSearch = new RegExp(this._inner_search, regexFlags);
|
||||||
|
@ -195,21 +195,21 @@ window.qBittorrent.MultiRename = (function() {
|
||||||
for (let g = 0; g < match.length; ++g) {
|
for (let g = 0; g < match.length; ++g) {
|
||||||
let group = match[g];
|
let group = match[g];
|
||||||
if (!group) { continue; }
|
if (!group) { continue; }
|
||||||
replacement = replaceGroup(replacement, `$${g}`, group, '\\', false);
|
replacement = replaceGroup(replacement, `$${g}`, group, "\\", false);
|
||||||
}
|
}
|
||||||
// Replace named groups
|
// Replace named groups
|
||||||
for (let namedGroup in match.groups) {
|
for (let namedGroup in match.groups) {
|
||||||
replacement = replaceGroup(replacement, `$${namedGroup}`, match.groups[namedGroup], '\\', false);
|
replacement = replaceGroup(replacement, `$${namedGroup}`, match.groups[namedGroup], "\\", false);
|
||||||
}
|
}
|
||||||
// Replace auxiliary variables
|
// Replace auxiliary variables
|
||||||
for (let v = 'dddddddd'; v !== ''; v = v.substring(1)) {
|
for (let v = "dddddddd"; v !== ""; v = v.substring(1)) {
|
||||||
let fileCount = fileEnumeration.toString().padStart(v.length, '0');
|
let fileCount = fileEnumeration.toString().padStart(v.length, "0");
|
||||||
replacement = replaceGroup(replacement, `$${v}`, fileCount, '\\', false);
|
replacement = replaceGroup(replacement, `$${v}`, fileCount, "\\", false);
|
||||||
}
|
}
|
||||||
// Remove empty $ variable
|
// Remove empty $ variable
|
||||||
replacement = replaceGroup(replacement, '$', '', '\\');
|
replacement = replaceGroup(replacement, "$", "", "\\");
|
||||||
const wholeMatch = match[0];
|
const wholeMatch = match[0];
|
||||||
const index = match['index'];
|
const index = match["index"];
|
||||||
renamed = replaceBetween(renamed, index + offset, index + offset + wholeMatch.length, replacement);
|
renamed = replaceBetween(renamed, index + offset, index + offset + wholeMatch.length, replacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,8 +243,8 @@ window.qBittorrent.MultiRename = (function() {
|
||||||
? parentPath + window.qBittorrent.Filesystem.PathSeparator + newName
|
? parentPath + window.qBittorrent.Filesystem.PathSeparator + newName
|
||||||
: newName;
|
: newName;
|
||||||
let renameRequest = new Request({
|
let renameRequest = new Request({
|
||||||
url: isFolder ? 'api/v2/torrents/renameFolder' : 'api/v2/torrents/renameFile',
|
url: isFolder ? "api/v2/torrents/renameFolder" : "api/v2/torrents/renameFile",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hash: this.hash,
|
hash: this.hash,
|
||||||
oldPath: oldPath,
|
oldPath: oldPath,
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -91,10 +91,10 @@ window.qBittorrent.Search = (function() {
|
||||||
|
|
||||||
const init = function() {
|
const init = function() {
|
||||||
// load "Search in" preference from local storage
|
// load "Search in" preference from local storage
|
||||||
$('searchInTorrentName').set('value', (LocalPreferences.get('search_in_filter') === "names") ? "names" : "everywhere");
|
$("searchInTorrentName").set("value", (LocalPreferences.get("search_in_filter") === "names") ? "names" : "everywhere");
|
||||||
const searchResultsTableContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
const searchResultsTableContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
||||||
targets: '.searchTableRow',
|
targets: ".searchTableRow",
|
||||||
menu: 'searchResultsTableMenu',
|
menu: "searchResultsTableMenu",
|
||||||
actions: {
|
actions: {
|
||||||
Download: downloadSearchTorrent,
|
Download: downloadSearchTorrent,
|
||||||
OpenDescriptionUrl: openSearchTorrentDescriptionUrl
|
OpenDescriptionUrl: openSearchTorrentDescriptionUrl
|
||||||
|
@ -105,32 +105,32 @@ window.qBittorrent.Search = (function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
searchResultsTable = new window.qBittorrent.DynamicTable.SearchResultsTable();
|
searchResultsTable = new window.qBittorrent.DynamicTable.SearchResultsTable();
|
||||||
searchResultsTable.setup('searchResultsTableDiv', 'searchResultsTableFixedHeaderDiv', searchResultsTableContextMenu);
|
searchResultsTable.setup("searchResultsTableDiv", "searchResultsTableFixedHeaderDiv", searchResultsTableContextMenu);
|
||||||
getPlugins();
|
getPlugins();
|
||||||
|
|
||||||
// listen for changes to searchInNameFilter
|
// listen for changes to searchInNameFilter
|
||||||
let searchInNameFilterTimer = -1;
|
let searchInNameFilterTimer = -1;
|
||||||
$('searchInNameFilter').addEvent('input', () => {
|
$("searchInNameFilter").addEvent("input", () => {
|
||||||
clearTimeout(searchInNameFilterTimer);
|
clearTimeout(searchInNameFilterTimer);
|
||||||
searchInNameFilterTimer = setTimeout(() => {
|
searchInNameFilterTimer = setTimeout(() => {
|
||||||
searchInNameFilterTimer = -1;
|
searchInNameFilterTimer = -1;
|
||||||
|
|
||||||
const value = $('searchInNameFilter').get("value");
|
const value = $("searchInNameFilter").get("value");
|
||||||
searchText.filterPattern = value;
|
searchText.filterPattern = value;
|
||||||
searchFilterChanged();
|
searchFilterChanged();
|
||||||
}, window.qBittorrent.Misc.FILTER_INPUT_DELAY);
|
}, window.qBittorrent.Misc.FILTER_INPUT_DELAY);
|
||||||
});
|
});
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': function(e) {
|
"Enter": function(e) {
|
||||||
// accept enter key as a click
|
// accept enter key as a click
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
const 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,14 +144,14 @@ window.qBittorrent.Search = (function() {
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
// restore search tabs
|
// restore search tabs
|
||||||
const searchJobs = JSON.parse(LocalPreferences.get('search_jobs', '[]'));
|
const searchJobs = JSON.parse(LocalPreferences.get("search_jobs", "[]"));
|
||||||
for (const { id, pattern } of searchJobs) {
|
for (const { id, pattern } of searchJobs) {
|
||||||
createSearchTab(id, pattern);
|
createSearchTab(id, pattern);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const numSearchTabs = function() {
|
const numSearchTabs = function() {
|
||||||
return $('searchTabs').getElements('li').length;
|
return $("searchTabs").getElements("li").length;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSearchIdFromTab = function(tab) {
|
const getSearchIdFromTab = function(tab) {
|
||||||
|
@ -160,38 +160,38 @@ window.qBittorrent.Search = (function() {
|
||||||
|
|
||||||
const createSearchTab = function(searchId, pattern) {
|
const createSearchTab = function(searchId, pattern) {
|
||||||
const newTabId = `${searchTabIdPrefix}${searchId}`;
|
const newTabId = `${searchTabIdPrefix}${searchId}`;
|
||||||
const tabElem = new Element('a', {
|
const tabElem = new Element("a", {
|
||||||
text: pattern,
|
text: pattern,
|
||||||
});
|
});
|
||||||
const closeTabElem = new Element('img', {
|
const closeTabElem = new Element("img", {
|
||||||
alt: 'QBT_TR(Close tab)QBT_TR[CONTEXT=SearchWidget]',
|
alt: "QBT_TR(Close tab)QBT_TR[CONTEXT=SearchWidget]",
|
||||||
title: 'QBT_TR(Close tab)QBT_TR[CONTEXT=SearchWidget]',
|
title: "QBT_TR(Close tab)QBT_TR[CONTEXT=SearchWidget]",
|
||||||
src: 'images/application-exit.svg',
|
src: "images/application-exit.svg",
|
||||||
width: '8',
|
width: "8",
|
||||||
height: '8',
|
height: "8",
|
||||||
style: 'padding-right: 7px; margin-bottom: -1px; margin-left: -5px',
|
style: "padding-right: 7px; margin-bottom: -1px; margin-left: -5px",
|
||||||
onclick: 'qBittorrent.Search.closeSearchTab(this)',
|
onclick: "qBittorrent.Search.closeSearchTab(this)",
|
||||||
});
|
});
|
||||||
closeTabElem.inject(tabElem, 'top');
|
closeTabElem.inject(tabElem, "top");
|
||||||
tabElem.appendChild(getStatusIconElement('QBT_TR(Searching...)QBT_TR[CONTEXT=SearchJobWidget]', 'images/queued.svg'));
|
tabElem.appendChild(getStatusIconElement("QBT_TR(Searching...)QBT_TR[CONTEXT=SearchJobWidget]", "images/queued.svg"));
|
||||||
$('searchTabs').appendChild(new Element('li', {
|
$("searchTabs").appendChild(new Element("li", {
|
||||||
id: newTabId,
|
id: newTabId,
|
||||||
class: 'selected',
|
class: "selected",
|
||||||
html: tabElem.outerHTML,
|
html: tabElem.outerHTML,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// unhide the results elements
|
// unhide the results elements
|
||||||
if (numSearchTabs() >= 1) {
|
if (numSearchTabs() >= 1) {
|
||||||
$('searchResultsNoSearches').style.display = "none";
|
$("searchResultsNoSearches").style.display = "none";
|
||||||
$('searchResultsFilters').style.display = "block";
|
$("searchResultsFilters").style.display = "block";
|
||||||
$('searchResultsTableContainer').style.display = "block";
|
$("searchResultsTableContainer").style.display = "block";
|
||||||
$('searchTabsToolbar').style.display = "block";
|
$("searchTabsToolbar").style.display = "block";
|
||||||
}
|
}
|
||||||
|
|
||||||
// reinitialize tabs
|
// reinitialize tabs
|
||||||
$('searchTabs').getElements('li').removeEvents('click');
|
$("searchTabs").getElements("li").removeEvents("click");
|
||||||
$('searchTabs').getElements('li').addEvent('click', function(e) {
|
$("searchTabs").getElements("li").addEvent("click", function(e) {
|
||||||
$('startSearchButton').set('text', 'QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]');
|
$("startSearchButton").set("text", "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]");
|
||||||
setActiveTab(this);
|
setActiveTab(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ window.qBittorrent.Search = (function() {
|
||||||
const closeSearchTab = function(el) {
|
const closeSearchTab = function(el) {
|
||||||
const tab = el.parentElement.parentElement;
|
const tab = el.parentElement.parentElement;
|
||||||
const searchId = getSearchIdFromTab(tab);
|
const searchId = getSearchIdFromTab(tab);
|
||||||
const isTabSelected = tab.hasClass('selected');
|
const isTabSelected = tab.hasClass("selected");
|
||||||
const newTabToSelect = isTabSelected ? tab.nextSibling || tab.previousSibling : null;
|
const newTabToSelect = isTabSelected ? tab.nextSibling || tab.previousSibling : null;
|
||||||
|
|
||||||
const currentSearchId = getSelectedSearchId();
|
const currentSearchId = getSelectedSearchId();
|
||||||
|
@ -233,34 +233,34 @@ window.qBittorrent.Search = (function() {
|
||||||
tab.destroy();
|
tab.destroy();
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: new URI('api/v2/search/delete'),
|
url: new URI("api/v2/search/delete"),
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
id: searchId
|
id: searchId
|
||||||
},
|
},
|
||||||
}).send();
|
}).send();
|
||||||
|
|
||||||
const searchJobs = JSON.parse(LocalPreferences.get('search_jobs', '[]'));
|
const searchJobs = JSON.parse(LocalPreferences.get("search_jobs", "[]"));
|
||||||
const jobIndex = searchJobs.findIndex((job) => job.id === searchId);
|
const jobIndex = searchJobs.findIndex((job) => job.id === searchId);
|
||||||
if (jobIndex >= 0) {
|
if (jobIndex >= 0) {
|
||||||
searchJobs.splice(jobIndex, 1);
|
searchJobs.splice(jobIndex, 1);
|
||||||
LocalPreferences.set('search_jobs', JSON.stringify(searchJobs));
|
LocalPreferences.set("search_jobs", JSON.stringify(searchJobs));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numSearchTabs() === 0) {
|
if (numSearchTabs() === 0) {
|
||||||
resetSearchState();
|
resetSearchState();
|
||||||
resetFilters();
|
resetFilters();
|
||||||
|
|
||||||
$('numSearchResultsVisible').set('html', 0);
|
$("numSearchResultsVisible").set("html", 0);
|
||||||
$('numSearchResultsTotal').set('html', 0);
|
$("numSearchResultsTotal").set("html", 0);
|
||||||
$('searchResultsNoSearches').style.display = "block";
|
$("searchResultsNoSearches").style.display = "block";
|
||||||
$('searchResultsFilters').style.display = "none";
|
$("searchResultsFilters").style.display = "none";
|
||||||
$('searchResultsTableContainer').style.display = "none";
|
$("searchResultsTableContainer").style.display = "none";
|
||||||
$('searchTabsToolbar').style.display = "none";
|
$("searchTabsToolbar").style.display = "none";
|
||||||
}
|
}
|
||||||
else if (isTabSelected && newTabToSelect) {
|
else if (isTabSelected && newTabToSelect) {
|
||||||
setActiveTab(newTabToSelect);
|
setActiveTab(newTabToSelect);
|
||||||
$('startSearchButton').set('text', 'QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]');
|
$("startSearchButton").set("text", "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ window.qBittorrent.Search = (function() {
|
||||||
|
|
||||||
saveCurrentTabState();
|
saveCurrentTabState();
|
||||||
|
|
||||||
MochaUI.selected(tab, 'searchTabs');
|
MochaUI.selected(tab, "searchTabs");
|
||||||
|
|
||||||
const state = searchState.get(searchId);
|
const state = searchState.get(searchId);
|
||||||
let rowsToSelect = [];
|
let rowsToSelect = [];
|
||||||
|
@ -319,32 +319,32 @@ window.qBittorrent.Search = (function() {
|
||||||
// restore filters
|
// restore filters
|
||||||
searchText.pattern = state.searchPattern;
|
searchText.pattern = state.searchPattern;
|
||||||
searchText.filterPattern = state.filterPattern;
|
searchText.filterPattern = state.filterPattern;
|
||||||
$('searchInNameFilter').set("value", state.filterPattern);
|
$("searchInNameFilter").set("value", state.filterPattern);
|
||||||
|
|
||||||
searchSeedsFilter.min = state.seedsFilter.min;
|
searchSeedsFilter.min = state.seedsFilter.min;
|
||||||
searchSeedsFilter.max = state.seedsFilter.max;
|
searchSeedsFilter.max = state.seedsFilter.max;
|
||||||
$('searchMinSeedsFilter').set('value', state.seedsFilter.min);
|
$("searchMinSeedsFilter").set("value", state.seedsFilter.min);
|
||||||
$('searchMaxSeedsFilter').set('value', state.seedsFilter.max);
|
$("searchMaxSeedsFilter").set("value", state.seedsFilter.max);
|
||||||
|
|
||||||
searchSizeFilter.min = state.sizeFilter.min;
|
searchSizeFilter.min = state.sizeFilter.min;
|
||||||
searchSizeFilter.minUnit = state.sizeFilter.minUnit;
|
searchSizeFilter.minUnit = state.sizeFilter.minUnit;
|
||||||
searchSizeFilter.max = state.sizeFilter.max;
|
searchSizeFilter.max = state.sizeFilter.max;
|
||||||
searchSizeFilter.maxUnit = state.sizeFilter.maxUnit;
|
searchSizeFilter.maxUnit = state.sizeFilter.maxUnit;
|
||||||
$('searchMinSizeFilter').set('value', state.sizeFilter.min);
|
$("searchMinSizeFilter").set("value", state.sizeFilter.min);
|
||||||
$('searchMinSizePrefix').set('value', state.sizeFilter.minUnit);
|
$("searchMinSizePrefix").set("value", state.sizeFilter.minUnit);
|
||||||
$('searchMaxSizeFilter').set('value', state.sizeFilter.max);
|
$("searchMaxSizeFilter").set("value", state.sizeFilter.max);
|
||||||
$('searchMaxSizePrefix').set('value', state.sizeFilter.maxUnit);
|
$("searchMaxSizePrefix").set("value", state.sizeFilter.maxUnit);
|
||||||
|
|
||||||
const currentSearchPattern = $('searchPattern').getProperty('value').trim();
|
const currentSearchPattern = $("searchPattern").getProperty("value").trim();
|
||||||
if (state.running && (state.searchPattern === currentSearchPattern)) {
|
if (state.running && (state.searchPattern === currentSearchPattern)) {
|
||||||
// allow search to be stopped
|
// allow search to be stopped
|
||||||
$('startSearchButton').set('text', 'QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]');
|
$("startSearchButton").set("text", "QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]");
|
||||||
searchPatternChanged = false;
|
searchPatternChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
searchResultsTable.setSortedColumn(state.sort.column, state.sort.reverse);
|
searchResultsTable.setSortedColumn(state.sort.column, state.sort.reverse);
|
||||||
|
|
||||||
$('searchInTorrentName').set('value', state.searchIn);
|
$("searchInTorrentName").set("value", state.searchIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// must restore all filters before calling updateTable
|
// must restore all filters before calling updateTable
|
||||||
|
@ -356,76 +356,76 @@ window.qBittorrent.Search = (function() {
|
||||||
searchResultsTable.reselectRows(rowsToSelect);
|
searchResultsTable.reselectRows(rowsToSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('numSearchResultsVisible').set('html', searchResultsTable.getFilteredAndSortedRows().length);
|
$("numSearchResultsVisible").set("html", searchResultsTable.getFilteredAndSortedRows().length);
|
||||||
$('numSearchResultsTotal').set('html', searchResultsTable.getRowIds().length);
|
$("numSearchResultsTotal").set("html", searchResultsTable.getRowIds().length);
|
||||||
|
|
||||||
setupSearchTableEvents(true);
|
setupSearchTableEvents(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStatusIconElement = function(text, image) {
|
const getStatusIconElement = function(text, image) {
|
||||||
return new Element('img', {
|
return new Element("img", {
|
||||||
alt: text,
|
alt: text,
|
||||||
title: text,
|
title: text,
|
||||||
src: image,
|
src: image,
|
||||||
class: 'statusIcon',
|
class: "statusIcon",
|
||||||
width: '10',
|
width: "10",
|
||||||
height: '10',
|
height: "10",
|
||||||
style: 'margin-bottom: -2px; margin-left: 7px',
|
style: "margin-bottom: -2px; margin-left: 7px",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateStatusIconElement = function(searchId, text, image) {
|
const updateStatusIconElement = function(searchId, text, image) {
|
||||||
const searchTab = $(`${searchTabIdPrefix}${searchId}`);
|
const searchTab = $(`${searchTabIdPrefix}${searchId}`);
|
||||||
if (searchTab) {
|
if (searchTab) {
|
||||||
const statusIcon = searchTab.getElement('.statusIcon');
|
const statusIcon = searchTab.getElement(".statusIcon");
|
||||||
statusIcon.set('alt', text);
|
statusIcon.set("alt", text);
|
||||||
statusIcon.set('title', text);
|
statusIcon.set("title", text);
|
||||||
statusIcon.set('src', image);
|
statusIcon.set("src", image);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const startSearch = function(pattern, category, plugins) {
|
const startSearch = function(pattern, category, plugins) {
|
||||||
searchPatternChanged = false;
|
searchPatternChanged = false;
|
||||||
|
|
||||||
const 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,
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
pattern: pattern,
|
pattern: pattern,
|
||||||
category: category,
|
category: category,
|
||||||
plugins: plugins
|
plugins: plugins
|
||||||
},
|
},
|
||||||
onSuccess: function(response) {
|
onSuccess: function(response) {
|
||||||
$('startSearchButton').set('text', 'QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]');
|
$("startSearchButton").set("text", "QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]");
|
||||||
const searchId = response.id;
|
const searchId = response.id;
|
||||||
createSearchTab(searchId, pattern);
|
createSearchTab(searchId, pattern);
|
||||||
|
|
||||||
const searchJobs = JSON.parse(LocalPreferences.get('search_jobs', '[]'));
|
const searchJobs = JSON.parse(LocalPreferences.get("search_jobs", "[]"));
|
||||||
searchJobs.push({ id: searchId, pattern: pattern });
|
searchJobs.push({ id: searchId, pattern: pattern });
|
||||||
LocalPreferences.set('search_jobs', JSON.stringify(searchJobs));
|
LocalPreferences.set("search_jobs", JSON.stringify(searchJobs));
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const stopSearch = function(searchId) {
|
const stopSearch = function(searchId) {
|
||||||
const url = new URI('api/v2/search/stop');
|
const url = new URI("api/v2/search/stop");
|
||||||
new Request({
|
new Request({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
id: searchId
|
id: searchId
|
||||||
},
|
},
|
||||||
onSuccess: function(response) {
|
onSuccess: function(response) {
|
||||||
resetSearchState(searchId);
|
resetSearchState(searchId);
|
||||||
// not strictly necessary to do this when the tab is being closed, but there's no harm in it
|
// not strictly necessary to do this when the tab is being closed, but there's no harm in it
|
||||||
updateStatusIconElement(searchId, 'QBT_TR(Search aborted)QBT_TR[CONTEXT=SearchJobWidget]', 'images/task-reject.svg');
|
updateStatusIconElement(searchId, "QBT_TR(Search aborted)QBT_TR[CONTEXT=SearchJobWidget]", "images/task-reject.svg");
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSelectedSearchId = function() {
|
const getSelectedSearchId = function() {
|
||||||
const selectedTab = $('searchTabs').getElement('li.selected');
|
const selectedTab = $("searchTabs").getElement("li.selected");
|
||||||
return selectedTab ? getSearchIdFromTab(selectedTab) : null;
|
return selectedTab ? getSearchIdFromTab(selectedTab) : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -434,9 +434,9 @@ window.qBittorrent.Search = (function() {
|
||||||
const state = searchState.get(currentSearchId);
|
const state = searchState.get(currentSearchId);
|
||||||
const isSearchRunning = state && state.running;
|
const isSearchRunning = state && state.running;
|
||||||
if (!isSearchRunning || searchPatternChanged) {
|
if (!isSearchRunning || searchPatternChanged) {
|
||||||
const pattern = $('searchPattern').getProperty('value').trim();
|
const pattern = $("searchPattern").getProperty("value").trim();
|
||||||
let category = $('categorySelect').getProperty('value');
|
let category = $("categorySelect").getProperty("value");
|
||||||
const plugins = $('pluginsSelect').getProperty('value');
|
const plugins = $("pluginsSelect").getProperty("value");
|
||||||
|
|
||||||
if (!pattern || !category || !plugins)
|
if (!pattern || !category || !plugins)
|
||||||
return;
|
return;
|
||||||
|
@ -493,13 +493,13 @@ window.qBittorrent.Search = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const manageSearchPlugins = function() {
|
const manageSearchPlugins = function() {
|
||||||
const id = 'searchPlugins';
|
const id = "searchPlugins";
|
||||||
if (!$(id))
|
if (!$(id))
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: id,
|
id: id,
|
||||||
title: "QBT_TR(Search plugins)QBT_TR[CONTEXT=PluginSelectDlg]",
|
title: "QBT_TR(Search plugins)QBT_TR[CONTEXT=PluginSelectDlg]",
|
||||||
loadMethod: 'xhr',
|
loadMethod: "xhr",
|
||||||
contentURL: 'views/searchplugins.html',
|
contentURL: "views/searchplugins.html",
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
paddingVertical: 0,
|
paddingVertical: 0,
|
||||||
|
@ -526,15 +526,15 @@ window.qBittorrent.Search = (function() {
|
||||||
const onSearchPatternChanged = function() {
|
const onSearchPatternChanged = function() {
|
||||||
const currentSearchId = getSelectedSearchId();
|
const currentSearchId = getSelectedSearchId();
|
||||||
const state = searchState.get(currentSearchId);
|
const state = searchState.get(currentSearchId);
|
||||||
const currentSearchPattern = $('searchPattern').getProperty('value').trim();
|
const currentSearchPattern = $("searchPattern").getProperty("value").trim();
|
||||||
// start a new search if pattern has changed, otherwise allow the search to be stopped
|
// start a new search if pattern has changed, otherwise allow the search to be stopped
|
||||||
if (state && (state.searchPattern === currentSearchPattern)) {
|
if (state && (state.searchPattern === currentSearchPattern)) {
|
||||||
searchPatternChanged = false;
|
searchPatternChanged = false;
|
||||||
$('startSearchButton').set('text', 'QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]');
|
$("startSearchButton").set("text", "QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
searchPatternChanged = true;
|
searchPatternChanged = true;
|
||||||
$('startSearchButton').set('text', 'QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]');
|
$("startSearchButton").set("text", "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -568,7 +568,7 @@ window.qBittorrent.Search = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetSearchState = function(searchId) {
|
const resetSearchState = function(searchId) {
|
||||||
$('startSearchButton').set('text', 'QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]');
|
$("startSearchButton").set("text", "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]");
|
||||||
const state = searchState.get(searchId);
|
const state = searchState.get(searchId);
|
||||||
if (state) {
|
if (state) {
|
||||||
state.running = false;
|
state.running = false;
|
||||||
|
@ -595,10 +595,10 @@ window.qBittorrent.Search = (function() {
|
||||||
categoryHtml.splice(1, 0, option.outerHTML);
|
categoryHtml.splice(1, 0, option.outerHTML);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('categorySelect').set('html', categoryHtml.join(""));
|
$("categorySelect").set("html", categoryHtml.join(""));
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectedPlugin = $('pluginsSelect').get("value");
|
const selectedPlugin = $("pluginsSelect").get("value");
|
||||||
|
|
||||||
if ((selectedPlugin === "all") || (selectedPlugin === "enabled")) {
|
if ((selectedPlugin === "all") || (selectedPlugin === "enabled")) {
|
||||||
const uniqueCategories = {};
|
const uniqueCategories = {};
|
||||||
|
@ -626,8 +626,8 @@ window.qBittorrent.Search = (function() {
|
||||||
|
|
||||||
const 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"),
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onSuccess: function(response) {
|
onSuccess: function(response) {
|
||||||
if (response !== prevSearchPluginsResponse) {
|
if (response !== prevSearchPluginsResponse) {
|
||||||
|
@ -643,9 +643,9 @@ window.qBittorrent.Search = (function() {
|
||||||
|
|
||||||
const searchPluginsEmpty = (searchPlugins.length === 0);
|
const searchPluginsEmpty = (searchPlugins.length === 0);
|
||||||
if (!searchPluginsEmpty) {
|
if (!searchPluginsEmpty) {
|
||||||
$('searchResultsNoPlugins').style.display = "none";
|
$("searchResultsNoPlugins").style.display = "none";
|
||||||
if (numSearchTabs() === 0) {
|
if (numSearchTabs() === 0) {
|
||||||
$('searchResultsNoSearches').style.display = "block";
|
$("searchResultsNoSearches").style.display = "block";
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort plugins alphabetically
|
// sort plugins alphabetically
|
||||||
|
@ -664,12 +664,12 @@ window.qBittorrent.Search = (function() {
|
||||||
pluginsHtml.splice(2, 0, "<option disabled>──────────</option>");
|
pluginsHtml.splice(2, 0, "<option disabled>──────────</option>");
|
||||||
}
|
}
|
||||||
|
|
||||||
$('pluginsSelect').set('html', pluginsHtml.join(""));
|
$("pluginsSelect").set("html", pluginsHtml.join(""));
|
||||||
|
|
||||||
$('searchPattern').setProperty('disabled', searchPluginsEmpty);
|
$("searchPattern").setProperty("disabled", searchPluginsEmpty);
|
||||||
$('categorySelect').setProperty('disabled', searchPluginsEmpty);
|
$("categorySelect").setProperty("disabled", searchPluginsEmpty);
|
||||||
$('pluginsSelect').setProperty('disabled', searchPluginsEmpty);
|
$("pluginsSelect").setProperty("disabled", searchPluginsEmpty);
|
||||||
$('startSearchButton').setProperty('disabled', searchPluginsEmpty);
|
$("startSearchButton").setProperty("disabled", searchPluginsEmpty);
|
||||||
|
|
||||||
if (window.qBittorrent.SearchPlugins !== undefined)
|
if (window.qBittorrent.SearchPlugins !== undefined)
|
||||||
window.qBittorrent.SearchPlugins.updateTable();
|
window.qBittorrent.SearchPlugins.updateTable();
|
||||||
|
@ -689,67 +689,67 @@ window.qBittorrent.Search = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetFilters = function() {
|
const resetFilters = function() {
|
||||||
searchText.filterPattern = '';
|
searchText.filterPattern = "";
|
||||||
$('searchInNameFilter').set('value', '');
|
$("searchInNameFilter").set("value", "");
|
||||||
|
|
||||||
searchSeedsFilter.min = 0;
|
searchSeedsFilter.min = 0;
|
||||||
searchSeedsFilter.max = 0;
|
searchSeedsFilter.max = 0;
|
||||||
$('searchMinSeedsFilter').set('value', searchSeedsFilter.min);
|
$("searchMinSeedsFilter").set("value", searchSeedsFilter.min);
|
||||||
$('searchMaxSeedsFilter').set('value', searchSeedsFilter.max);
|
$("searchMaxSeedsFilter").set("value", searchSeedsFilter.max);
|
||||||
|
|
||||||
searchSizeFilter.min = 0.00;
|
searchSizeFilter.min = 0.00;
|
||||||
searchSizeFilter.minUnit = 2; // B = 0, KiB = 1, MiB = 2, GiB = 3, TiB = 4, PiB = 5, EiB = 6
|
searchSizeFilter.minUnit = 2; // B = 0, KiB = 1, MiB = 2, GiB = 3, TiB = 4, PiB = 5, EiB = 6
|
||||||
searchSizeFilter.max = 0.00;
|
searchSizeFilter.max = 0.00;
|
||||||
searchSizeFilter.maxUnit = 3;
|
searchSizeFilter.maxUnit = 3;
|
||||||
$('searchMinSizeFilter').set('value', searchSizeFilter.min);
|
$("searchMinSizeFilter").set("value", searchSizeFilter.min);
|
||||||
$('searchMinSizePrefix').set('value', searchSizeFilter.minUnit);
|
$("searchMinSizePrefix").set("value", searchSizeFilter.minUnit);
|
||||||
$('searchMaxSizeFilter').set('value', searchSizeFilter.max);
|
$("searchMaxSizeFilter").set("value", searchSizeFilter.max);
|
||||||
$('searchMaxSizePrefix').set('value', searchSizeFilter.maxUnit);
|
$("searchMaxSizePrefix").set("value", searchSizeFilter.maxUnit);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSearchInTorrentName = function() {
|
const getSearchInTorrentName = function() {
|
||||||
return $('searchInTorrentName').get('value') === "names" ? "names" : "everywhere";
|
return $("searchInTorrentName").get("value") === "names" ? "names" : "everywhere";
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchInTorrentName = function() {
|
const searchInTorrentName = function() {
|
||||||
LocalPreferences.set('search_in_filter', getSearchInTorrentName());
|
LocalPreferences.set("search_in_filter", getSearchInTorrentName());
|
||||||
searchFilterChanged();
|
searchFilterChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
const 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();
|
||||||
};
|
};
|
||||||
|
|
||||||
const 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");
|
||||||
searchSizeFilter.maxUnit = $('searchMaxSizePrefix').get('value');
|
searchSizeFilter.maxUnit = $("searchMaxSizePrefix").get("value");
|
||||||
|
|
||||||
searchFilterChanged();
|
searchFilterChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchSizeFilterPrefixChanged = function() {
|
const searchSizeFilterPrefixChanged = function() {
|
||||||
if ((Number($('searchMinSizeFilter').get('value')) !== 0) || (Number($('searchMaxSizeFilter').get('value')) !== 0))
|
if ((Number($("searchMinSizeFilter").get("value")) !== 0) || (Number($("searchMaxSizeFilter").get("value")) !== 0))
|
||||||
searchSizeFilterChanged();
|
searchSizeFilterChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchFilterChanged = function() {
|
const searchFilterChanged = function() {
|
||||||
searchResultsTable.updateTable();
|
searchResultsTable.updateTable();
|
||||||
$('numSearchResultsVisible').set('html', searchResultsTable.getFilteredAndSortedRows().length);
|
$("numSearchResultsVisible").set("html", searchResultsTable.getFilteredAndSortedRows().length);
|
||||||
};
|
};
|
||||||
|
|
||||||
const 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);
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
$$(".searchTableRow").each(function(target) {
|
$$(".searchTableRow").each(function(target) {
|
||||||
target.removeEventListener('dblclick', downloadSearchTorrent, false);
|
target.removeEventListener("dblclick", downloadSearchTorrent, false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -757,10 +757,10 @@ window.qBittorrent.Search = (function() {
|
||||||
const state = searchState.get(searchId);
|
const state = searchState.get(searchId);
|
||||||
|
|
||||||
const maxResults = 500;
|
const maxResults = 500;
|
||||||
const 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,
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
data: {
|
data: {
|
||||||
id: searchId,
|
id: searchId,
|
||||||
|
@ -771,7 +771,7 @@ window.qBittorrent.Search = (function() {
|
||||||
if ((response.status === 400) || (response.status === 404)) {
|
if ((response.status === 400) || (response.status === 404)) {
|
||||||
// bad params. search id is invalid
|
// bad params. search id is invalid
|
||||||
resetSearchState(searchId);
|
resetSearchState(searchId);
|
||||||
updateStatusIconElement(searchId, 'QBT_TR(An error occurred during search...)QBT_TR[CONTEXT=SearchJobWidget]', 'images/error.svg');
|
updateStatusIconElement(searchId, "QBT_TR(An error occurred during search...)QBT_TR[CONTEXT=SearchJobWidget]", "images/error.svg");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
clearTimeout(state.loadResultsTimer);
|
clearTimeout(state.loadResultsTimer);
|
||||||
|
@ -779,13 +779,13 @@ window.qBittorrent.Search = (function() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSuccess: function(response) {
|
onSuccess: function(response) {
|
||||||
$('error_div').set('html', '');
|
$("error_div").set("html", "");
|
||||||
|
|
||||||
const state = searchState.get(searchId);
|
const state = searchState.get(searchId);
|
||||||
// check if user stopped the search prior to receiving the response
|
// check if user stopped the search prior to receiving the response
|
||||||
if (!state.running) {
|
if (!state.running) {
|
||||||
clearTimeout(state.loadResultsTimer);
|
clearTimeout(state.loadResultsTimer);
|
||||||
updateStatusIconElement(searchId, 'QBT_TR(Search aborted)QBT_TR[CONTEXT=SearchJobWidget]', 'images/task-reject.svg');
|
updateStatusIconElement(searchId, "QBT_TR(Search aborted)QBT_TR[CONTEXT=SearchJobWidget]", "images/task-reject.svg");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,8 +823,8 @@ window.qBittorrent.Search = (function() {
|
||||||
searchResultsTable.updateRowData(row);
|
searchResultsTable.updateRowData(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('numSearchResultsVisible').set('html', searchResultsTable.getFilteredAndSortedRows().length);
|
$("numSearchResultsVisible").set("html", searchResultsTable.getFilteredAndSortedRows().length);
|
||||||
$('numSearchResultsTotal').set('html', searchResultsTable.getRowIds().length);
|
$("numSearchResultsTotal").set("html", searchResultsTable.getRowIds().length);
|
||||||
|
|
||||||
searchResultsTable.updateTable();
|
searchResultsTable.updateTable();
|
||||||
searchResultsTable.altRow();
|
searchResultsTable.altRow();
|
||||||
|
@ -834,7 +834,7 @@ window.qBittorrent.Search = (function() {
|
||||||
|
|
||||||
if ((response.status === "Stopped") && (state.rowId >= response.total)) {
|
if ((response.status === "Stopped") && (state.rowId >= response.total)) {
|
||||||
resetSearchState(searchId);
|
resetSearchState(searchId);
|
||||||
updateStatusIconElement(searchId, 'QBT_TR(Search has finished)QBT_TR[CONTEXT=SearchJobWidget]', 'images/task-complete.svg');
|
updateStatusIconElement(searchId, "QBT_TR(Search has finished)QBT_TR[CONTEXT=SearchJobWidget]", "images/task-complete.svg");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -851,7 +851,7 @@ window.qBittorrent.Search = (function() {
|
||||||
state.loadResultsTimer = loadSearchResultsData.delay(500, this, searchId);
|
state.loadResultsTimer = loadSearchResultsData.delay(500, this, searchId);
|
||||||
};
|
};
|
||||||
|
|
||||||
new ClipboardJS('.copySearchDataToClipboard', {
|
new ClipboardJS(".copySearchDataToClipboard", {
|
||||||
text: function(trigger) {
|
text: function(trigger) {
|
||||||
switch (trigger.id) {
|
switch (trigger.id) {
|
||||||
case "copySearchTorrentName":
|
case "copySearchTorrentName":
|
||||||
|
|
|
@ -26,16 +26,16 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
MochaUI.extend({
|
MochaUI.extend({
|
||||||
addUpLimitSlider: function(hashes) {
|
addUpLimitSlider: function(hashes) {
|
||||||
if ($('uplimitSliderarea')) {
|
if ($("uplimitSliderarea")) {
|
||||||
// Get global upload limit
|
// Get global upload limit
|
||||||
let maximum = 500;
|
let maximum = 500;
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/transfer/uploadLimit',
|
url: "api/v2/transfer/uploadLimit",
|
||||||
method: 'get',
|
method: "get",
|
||||||
data: {},
|
data: {},
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -52,42 +52,42 @@ MochaUI.extend({
|
||||||
}
|
}
|
||||||
// Get torrents upload limit
|
// Get torrents upload limit
|
||||||
// And create slider
|
// And create slider
|
||||||
if (hashes[0] === 'global') {
|
if (hashes[0] === "global") {
|
||||||
let up_limit = maximum;
|
let up_limit = maximum;
|
||||||
if (up_limit < 0)
|
if (up_limit < 0)
|
||||||
up_limit = 0;
|
up_limit = 0;
|
||||||
maximum = 10000;
|
maximum = 10000;
|
||||||
new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
|
new Slider($("uplimitSliderarea"), $("uplimitSliderknob"), {
|
||||||
steps: maximum,
|
steps: maximum,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
initialStep: up_limit.round(),
|
initialStep: up_limit.round(),
|
||||||
onChange: function(pos) {
|
onChange: function(pos) {
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
$('uplimitUpdatevalue').value = pos;
|
$("uplimitUpdatevalue").value = pos;
|
||||||
$('upLimitUnit').style.visibility = "visible";
|
$("upLimitUnit").style.visibility = "visible";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('uplimitUpdatevalue').value = '∞';
|
$("uplimitUpdatevalue").value = "∞";
|
||||||
$('upLimitUnit').style.visibility = "hidden";
|
$("upLimitUnit").style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
});
|
});
|
||||||
// Set default value
|
// Set default value
|
||||||
if (up_limit === 0) {
|
if (up_limit === 0) {
|
||||||
$('uplimitUpdatevalue').value = '∞';
|
$("uplimitUpdatevalue").value = "∞";
|
||||||
$('upLimitUnit').style.visibility = "hidden";
|
$("upLimitUnit").style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('uplimitUpdatevalue').value = up_limit.round();
|
$("uplimitUpdatevalue").value = up_limit.round();
|
||||||
$('upLimitUnit').style.visibility = "visible";
|
$("upLimitUnit").style.visibility = "visible";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: 'api/v2/torrents/uploadLimit',
|
url: "api/v2/torrents/uploadLimit",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join('|')
|
hashes: hashes.join("|")
|
||||||
},
|
},
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -99,29 +99,29 @@ MochaUI.extend({
|
||||||
}
|
}
|
||||||
if (up_limit < 0)
|
if (up_limit < 0)
|
||||||
up_limit = 0;
|
up_limit = 0;
|
||||||
new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
|
new Slider($("uplimitSliderarea"), $("uplimitSliderknob"), {
|
||||||
steps: maximum,
|
steps: maximum,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
initialStep: (up_limit / 1024.0).round(),
|
initialStep: (up_limit / 1024.0).round(),
|
||||||
onChange: function(pos) {
|
onChange: function(pos) {
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
$('uplimitUpdatevalue').value = pos;
|
$("uplimitUpdatevalue").value = pos;
|
||||||
$('upLimitUnit').style.visibility = "visible";
|
$("upLimitUnit").style.visibility = "visible";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('uplimitUpdatevalue').value = '∞';
|
$("uplimitUpdatevalue").value = "∞";
|
||||||
$('upLimitUnit').style.visibility = "hidden";
|
$("upLimitUnit").style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
});
|
});
|
||||||
// Set default value
|
// Set default value
|
||||||
if (up_limit === 0) {
|
if (up_limit === 0) {
|
||||||
$('uplimitUpdatevalue').value = '∞';
|
$("uplimitUpdatevalue").value = "∞";
|
||||||
$('upLimitUnit').style.visibility = "hidden";
|
$("upLimitUnit").style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('uplimitUpdatevalue').value = (up_limit / 1024.0).round();
|
$("uplimitUpdatevalue").value = (up_limit / 1024.0).round();
|
||||||
$('upLimitUnit').style.visibility = "visible";
|
$("upLimitUnit").style.visibility = "visible";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,12 +133,12 @@ MochaUI.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
addDlLimitSlider: function(hashes) {
|
addDlLimitSlider: function(hashes) {
|
||||||
if ($('dllimitSliderarea')) {
|
if ($("dllimitSliderarea")) {
|
||||||
// Get global upload limit
|
// Get global upload limit
|
||||||
let maximum = 500;
|
let maximum = 500;
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/transfer/downloadLimit',
|
url: "api/v2/transfer/downloadLimit",
|
||||||
method: 'get',
|
method: "get",
|
||||||
data: {},
|
data: {},
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -155,42 +155,42 @@ MochaUI.extend({
|
||||||
}
|
}
|
||||||
// Get torrents download limit
|
// Get torrents download limit
|
||||||
// And create slider
|
// And create slider
|
||||||
if (hashes[0] === 'global') {
|
if (hashes[0] === "global") {
|
||||||
let dl_limit = maximum;
|
let dl_limit = maximum;
|
||||||
if (dl_limit < 0)
|
if (dl_limit < 0)
|
||||||
dl_limit = 0;
|
dl_limit = 0;
|
||||||
maximum = 10000;
|
maximum = 10000;
|
||||||
new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
|
new Slider($("dllimitSliderarea"), $("dllimitSliderknob"), {
|
||||||
steps: maximum,
|
steps: maximum,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
initialStep: dl_limit.round(),
|
initialStep: dl_limit.round(),
|
||||||
onChange: function(pos) {
|
onChange: function(pos) {
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
$('dllimitUpdatevalue').value = pos;
|
$("dllimitUpdatevalue").value = pos;
|
||||||
$('dlLimitUnit').style.visibility = "visible";
|
$("dlLimitUnit").style.visibility = "visible";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('dllimitUpdatevalue').value = '∞';
|
$("dllimitUpdatevalue").value = "∞";
|
||||||
$('dlLimitUnit').style.visibility = "hidden";
|
$("dlLimitUnit").style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
});
|
});
|
||||||
// Set default value
|
// Set default value
|
||||||
if (dl_limit === 0) {
|
if (dl_limit === 0) {
|
||||||
$('dllimitUpdatevalue').value = '∞';
|
$("dllimitUpdatevalue").value = "∞";
|
||||||
$('dlLimitUnit').style.visibility = "hidden";
|
$("dlLimitUnit").style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('dllimitUpdatevalue').value = dl_limit.round();
|
$("dllimitUpdatevalue").value = dl_limit.round();
|
||||||
$('dlLimitUnit').style.visibility = "visible";
|
$("dlLimitUnit").style.visibility = "visible";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: 'api/v2/torrents/downloadLimit',
|
url: "api/v2/torrents/downloadLimit",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashes.join('|')
|
hashes: hashes.join("|")
|
||||||
},
|
},
|
||||||
onSuccess: function(data) {
|
onSuccess: function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -202,29 +202,29 @@ MochaUI.extend({
|
||||||
}
|
}
|
||||||
if (dl_limit < 0)
|
if (dl_limit < 0)
|
||||||
dl_limit = 0;
|
dl_limit = 0;
|
||||||
new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
|
new Slider($("dllimitSliderarea"), $("dllimitSliderknob"), {
|
||||||
steps: maximum,
|
steps: maximum,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
initialStep: (dl_limit / 1024.0).round(),
|
initialStep: (dl_limit / 1024.0).round(),
|
||||||
onChange: function(pos) {
|
onChange: function(pos) {
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
$('dllimitUpdatevalue').value = pos;
|
$("dllimitUpdatevalue").value = pos;
|
||||||
$('dlLimitUnit').style.visibility = "visible";
|
$("dlLimitUnit").style.visibility = "visible";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('dllimitUpdatevalue').value = '∞';
|
$("dllimitUpdatevalue").value = "∞";
|
||||||
$('dlLimitUnit').style.visibility = "hidden";
|
$("dlLimitUnit").style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
});
|
});
|
||||||
// Set default value
|
// Set default value
|
||||||
if (dl_limit === 0) {
|
if (dl_limit === 0) {
|
||||||
$('dllimitUpdatevalue').value = '∞';
|
$("dllimitUpdatevalue").value = "∞";
|
||||||
$('dlLimitUnit').style.visibility = "hidden";
|
$("dlLimitUnit").style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('dllimitUpdatevalue').value = (dl_limit / 1024.0).round();
|
$("dllimitUpdatevalue").value = (dl_limit / 1024.0).round();
|
||||||
$('dlLimitUnit').style.visibility = "visible";
|
$("dlLimitUnit").style.visibility = "visible";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,47 +9,47 @@
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': function(event) {
|
"Enter": function(event) {
|
||||||
$('setLocationButton').click();
|
$("setLocationButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': function(event) {
|
"Escape": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': function(event) {
|
"Esc": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent("domready", function() {
|
||||||
const 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 = decodeURIComponent(path);
|
$("setLocation").value = decodeURIComponent(path);
|
||||||
|
|
||||||
$('setLocation').focus();
|
$("setLocation").focus();
|
||||||
$('setLocationButton').addEvent('click', function(e) {
|
$("setLocationButton").addEvent("click", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
// check field
|
// check field
|
||||||
const 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
const 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",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashesList,
|
hashes: hashesList,
|
||||||
location: location
|
location: location
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
},
|
},
|
||||||
onFailure: function(xhr) {
|
onFailure: function(xhr) {
|
||||||
$('error_div').set('text', xhr.response);
|
$("error_div").set("text", xhr.response);
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,32 +9,32 @@
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
const UseGlobalLimit = -2;
|
const UseGlobalLimit = -2;
|
||||||
const NoLimit = -1;
|
const NoLimit = -1;
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': function(event) {
|
"Enter": function(event) {
|
||||||
$('save').click();
|
$("save").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': function(event) {
|
"Escape": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': function(event) {
|
"Esc": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
window.addEvent('domready', function() {
|
window.addEvent("domready", function() {
|
||||||
const hashesList = new URI().getData('hashes').split('|');
|
const hashesList = new URI().getData("hashes").split("|");
|
||||||
const origValues = new URI().getData('orig').split('|');
|
const origValues = new URI().getData("orig").split("|");
|
||||||
|
|
||||||
const values = {
|
const values = {
|
||||||
ratioLimit: window.qBittorrent.Misc.friendlyFloat(origValues[0], 2),
|
ratioLimit: window.qBittorrent.Misc.friendlyFloat(origValues[0], 2),
|
||||||
|
@ -51,63 +51,63 @@
|
||||||
&& (values.seedingTimeLimit === UseGlobalLimit)
|
&& (values.seedingTimeLimit === UseGlobalLimit)
|
||||||
&& (values.inactiveSeedingTimeLimit === UseGlobalLimit))) {
|
&& (values.inactiveSeedingTimeLimit === UseGlobalLimit))) {
|
||||||
// use default option
|
// use default option
|
||||||
setSelectedRadioValue('shareLimit', 'default');
|
setSelectedRadioValue("shareLimit", "default");
|
||||||
}
|
}
|
||||||
else if ((values.maxRatio === NoLimit) && (values.maxSeedingTime === NoLimit) && (values.maxInactiveSeedingTime === NoLimit)) {
|
else if ((values.maxRatio === NoLimit) && (values.maxSeedingTime === NoLimit) && (values.maxInactiveSeedingTime === NoLimit)) {
|
||||||
setSelectedRadioValue('shareLimit', 'none');
|
setSelectedRadioValue("shareLimit", "none");
|
||||||
// TODO set input boxes to *global* max ratio and seeding time
|
// TODO set input boxes to *global* max ratio and seeding time
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setSelectedRadioValue('shareLimit', 'custom');
|
setSelectedRadioValue("shareLimit", "custom");
|
||||||
if (values.ratioLimit >= 0) {
|
if (values.ratioLimit >= 0) {
|
||||||
$('setRatio').set('checked', true);
|
$("setRatio").set("checked", true);
|
||||||
$('ratio').set('value', values.ratioLimit);
|
$("ratio").set("value", values.ratioLimit);
|
||||||
}
|
}
|
||||||
if (values.seedingTimeLimit >= 0) {
|
if (values.seedingTimeLimit >= 0) {
|
||||||
$('setTotalMinutes').set('checked', true);
|
$("setTotalMinutes").set("checked", true);
|
||||||
$('totalMinutes').set('value', values.seedingTimeLimit);
|
$("totalMinutes").set("value", values.seedingTimeLimit);
|
||||||
}
|
}
|
||||||
if (values.inactiveSeedingTimeLimit >= 0) {
|
if (values.inactiveSeedingTimeLimit >= 0) {
|
||||||
$('setInactiveMinutes').set('checked', true);
|
$("setInactiveMinutes").set("checked", true);
|
||||||
$('inactiveMinutes').set('value', values.inactiveSeedingTimeLimit);
|
$("inactiveMinutes").set("value", values.inactiveSeedingTimeLimit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shareLimitChanged();
|
shareLimitChanged();
|
||||||
|
|
||||||
$('default').focus();
|
$("default").focus();
|
||||||
$('save').addEvent('click', function(e) {
|
$("save").addEvent("click", function(e) {
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
if (!isFormValid()) {
|
if (!isFormValid()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const shareLimit = getSelectedRadioValue('shareLimit');
|
const shareLimit = getSelectedRadioValue("shareLimit");
|
||||||
let ratioLimitValue = 0.00;
|
let ratioLimitValue = 0.00;
|
||||||
let seedingTimeLimitValue = 0;
|
let seedingTimeLimitValue = 0;
|
||||||
let inactiveSeedingTimeLimitValue = 0;
|
let inactiveSeedingTimeLimitValue = 0;
|
||||||
|
|
||||||
if (shareLimit === 'default') {
|
if (shareLimit === "default") {
|
||||||
ratioLimitValue = seedingTimeLimitValue = inactiveSeedingTimeLimitValue = UseGlobalLimit;
|
ratioLimitValue = seedingTimeLimitValue = inactiveSeedingTimeLimitValue = UseGlobalLimit;
|
||||||
}
|
}
|
||||||
else if (shareLimit === 'none') {
|
else if (shareLimit === "none") {
|
||||||
ratioLimitValue = seedingTimeLimitValue = inactiveSeedingTimeLimitValue = NoLimit;
|
ratioLimitValue = seedingTimeLimitValue = inactiveSeedingTimeLimitValue = NoLimit;
|
||||||
}
|
}
|
||||||
else if (shareLimit === 'custom') {
|
else if (shareLimit === "custom") {
|
||||||
ratioLimitValue = $('setRatio').get('checked') ? $('ratio').get('value') : -1;
|
ratioLimitValue = $("setRatio").get("checked") ? $("ratio").get("value") : -1;
|
||||||
seedingTimeLimitValue = $('setTotalMinutes').get('checked') ? $('totalMinutes').get('value') : -1;
|
seedingTimeLimitValue = $("setTotalMinutes").get("checked") ? $("totalMinutes").get("value") : -1;
|
||||||
inactiveSeedingTimeLimitValue = $('setInactiveMinutes').get('checked') ? $('inactiveMinutes').get('value') : -1;
|
inactiveSeedingTimeLimitValue = $("setInactiveMinutes").get("checked") ? $("inactiveMinutes").get("value") : -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/setShareLimits',
|
url: "api/v2/torrents/setShareLimits",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
hashes: hashesList.join('|'),
|
hashes: hashesList.join("|"),
|
||||||
ratioLimit: ratioLimitValue,
|
ratioLimit: ratioLimitValue,
|
||||||
seedingTimeLimit: seedingTimeLimitValue,
|
seedingTimeLimit: seedingTimeLimitValue,
|
||||||
inactiveSeedingTimeLimit: inactiveSeedingTimeLimitValue
|
inactiveSeedingTimeLimit: inactiveSeedingTimeLimitValue
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
for (let i = 0; i < radios.length; ++i) {
|
for (let i = 0; i < radios.length; ++i) {
|
||||||
const radio = radios[i];
|
const radio = radios[i];
|
||||||
if (radio.checked) {
|
if (radio.checked) {
|
||||||
return (radio).get('value');
|
return (radio).get("value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,27 +141,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function shareLimitChanged() {
|
function shareLimitChanged() {
|
||||||
const customShareLimit = getSelectedRadioValue('shareLimit') === 'custom';
|
const customShareLimit = getSelectedRadioValue("shareLimit") === "custom";
|
||||||
$('setRatio').set('disabled', !customShareLimit);
|
$("setRatio").set("disabled", !customShareLimit);
|
||||||
$('setTotalMinutes').set('disabled', !customShareLimit);
|
$("setTotalMinutes").set("disabled", !customShareLimit);
|
||||||
$('setInactiveMinutes').set('disabled', !customShareLimit);
|
$("setInactiveMinutes").set("disabled", !customShareLimit);
|
||||||
|
|
||||||
enableInputBoxes();
|
enableInputBoxes();
|
||||||
|
|
||||||
$('save').set('disabled', !isFormValid());
|
$("save").set("disabled", !isFormValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableInputBoxes() {
|
function enableInputBoxes() {
|
||||||
$('ratio').set('disabled', ($('setRatio').get('disabled') || !$('setRatio').get('checked')));
|
$("ratio").set("disabled", ($("setRatio").get("disabled") || !$("setRatio").get("checked")));
|
||||||
$('totalMinutes').set('disabled', ($('setTotalMinutes').get('disabled') || !$('setTotalMinutes').get('checked')));
|
$("totalMinutes").set("disabled", ($("setTotalMinutes").get("disabled") || !$("setTotalMinutes").get("checked")));
|
||||||
$('inactiveMinutes').set('disabled', ($('setInactiveMinutes').get('disabled') || !$('setInactiveMinutes').get('checked')));
|
$("inactiveMinutes").set("disabled", ($("setInactiveMinutes").get("disabled") || !$("setInactiveMinutes").get("checked")));
|
||||||
|
|
||||||
$('save').set('disabled', !isFormValid());
|
$("save").set("disabled", !isFormValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
function isFormValid() {
|
function isFormValid() {
|
||||||
return !((getSelectedRadioValue('shareLimit') === 'custom') && !$('setRatio').get('checked')
|
return !((getSelectedRadioValue("shareLimit") === "custom") && !$("setRatio").get("checked")
|
||||||
&& !$('setTotalMinutes').get('checked') && !$('setInactiveMinutes').get('checked'));
|
&& !$("setTotalMinutes").get("checked") && !$("setInactiveMinutes").get("checked"));
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -150,27 +150,27 @@
|
||||||
<div id="upload_spinner" class="mochaSpinner"></div>
|
<div id="upload_spinner" class="mochaSpinner"></div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
let 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";
|
||||||
|
|
||||||
$('dlLimitHidden').value = $('dlLimitText').value.toInt() * 1024;
|
$("dlLimitHidden").value = $("dlLimitText").value.toInt() * 1024;
|
||||||
$('upLimitHidden').value = $('upLimitText').value.toInt() * 1024;
|
$("upLimitHidden").value = $("upLimitText").value.toInt() * 1024;
|
||||||
|
|
||||||
$('upload_spinner').style.display = "block";
|
$("upload_spinner").style.display = "block";
|
||||||
submitted = true;
|
submitted = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('upload_frame').addEventListener("load", function() {
|
$("upload_frame").addEventListener("load", function() {
|
||||||
if (submitted)
|
if (submitted)
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
});
|
});
|
||||||
|
|
||||||
if ((Browser.platform === 'ios') || ((Browser.platform === 'mac') && (navigator.maxTouchPoints > 1))) {
|
if ((Browser.platform === "ios") || ((Browser.platform === "mac") && (navigator.maxTouchPoints > 1))) {
|
||||||
$('fileselect').accept = ".torrent";
|
$("fileselect").accept = ".torrent";
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -25,17 +25,17 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
const hashes = new URI().getData('hashes').split('|');
|
const hashes = new URI().getData("hashes").split("|");
|
||||||
const setUpLimit = function() {
|
const setUpLimit = function() {
|
||||||
const 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",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
'limit': limit
|
"limit": limit
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
window.parent.updateMainData();
|
window.parent.updateMainData();
|
||||||
|
@ -45,11 +45,11 @@
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/torrents/setUploadLimit',
|
url: "api/v2/torrents/setUploadLimit",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
'hashes': hashes.join('|'),
|
"hashes": hashes.join("|"),
|
||||||
'limit': limit
|
"limit": limit
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
|
@ -59,24 +59,24 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': function(event) {
|
"Enter": function(event) {
|
||||||
$('applyButton').click();
|
$("applyButton").click();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Escape': function(event) {
|
"Escape": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
'Esc': function(event) {
|
"Esc": function(event) {
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
$('uplimitUpdatevalue').focus();
|
$("uplimitUpdatevalue").focus();
|
||||||
|
|
||||||
MochaUI.addUpLimitSlider(hashes);
|
MochaUI.addUpLimitSlider(hashes);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -841,18 +841,18 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
const qbtVersion = window.parent.qBittorrent.Cache.qbtVersion.get();
|
const qbtVersion = window.parent.qBittorrent.Cache.qbtVersion.get();
|
||||||
const buildInfo = window.parent.qBittorrent.Cache.buildInfo.get();
|
const buildInfo = window.parent.qBittorrent.Cache.buildInfo.get();
|
||||||
|
|
||||||
$('qbittorrentVersion').innerText = `qBittorrent ${qbtVersion} QBT_TR(WebUI)QBT_TR[CONTEXT=OptionsDialog]`;
|
$("qbittorrentVersion").innerText = `qBittorrent ${qbtVersion} QBT_TR(WebUI)QBT_TR[CONTEXT=OptionsDialog]`;
|
||||||
$('qtVersion').textContent = buildInfo.qt;
|
$("qtVersion").textContent = buildInfo.qt;
|
||||||
$('libtorrentVersion').textContent = buildInfo.libtorrent;
|
$("libtorrentVersion").textContent = buildInfo.libtorrent;
|
||||||
$('boostVersion').textContent = buildInfo.boost;
|
$("boostVersion").textContent = buildInfo.boost;
|
||||||
$('opensslVersion').textContent = buildInfo.openssl;
|
$("opensslVersion").textContent = buildInfo.openssl;
|
||||||
$('zlibVersion').textContent = buildInfo.zlib;
|
$("zlibVersion").textContent = buildInfo.zlib;
|
||||||
$('qbittorrentVersion').textContent += ` (${buildInfo.bitness}-bit)`;
|
$("qbittorrentVersion").textContent += ` (${buildInfo.bitness}-bit)`;
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -11,39 +11,39 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
MochaUI.initializeTabs('aboutTabs');
|
MochaUI.initializeTabs("aboutTabs");
|
||||||
|
|
||||||
$('aboutAboutLink').addEvent('click', function() {
|
$("aboutAboutLink").addEvent("click", function() {
|
||||||
$$('.aboutTabContent').addClass('invisible');
|
$$(".aboutTabContent").addClass("invisible");
|
||||||
$('aboutAboutContent').removeClass('invisible');
|
$("aboutAboutContent").removeClass("invisible");
|
||||||
});
|
});
|
||||||
|
|
||||||
$('aboutAuthorLink').addEvent('click', function() {
|
$("aboutAuthorLink").addEvent("click", function() {
|
||||||
$$('.aboutTabContent').addClass('invisible');
|
$$(".aboutTabContent").addClass("invisible");
|
||||||
$('aboutAuthorContent').removeClass('invisible');
|
$("aboutAuthorContent").removeClass("invisible");
|
||||||
});
|
});
|
||||||
|
|
||||||
$('aboutSpecialThanksLink').addEvent('click', function() {
|
$("aboutSpecialThanksLink").addEvent("click", function() {
|
||||||
$$('.aboutTabContent').addClass('invisible');
|
$$(".aboutTabContent").addClass("invisible");
|
||||||
$('aboutSpecialThanksContent').removeClass('invisible');
|
$("aboutSpecialThanksContent").removeClass("invisible");
|
||||||
});
|
});
|
||||||
|
|
||||||
$('aboutTranslatorsLink').addEvent('click', function() {
|
$("aboutTranslatorsLink").addEvent("click", function() {
|
||||||
$$('.aboutTabContent').addClass('invisible');
|
$$(".aboutTabContent").addClass("invisible");
|
||||||
$('aboutTranslatorsContent').removeClass('invisible');
|
$("aboutTranslatorsContent").removeClass("invisible");
|
||||||
});
|
});
|
||||||
|
|
||||||
$('aboutLicenseLink').addEvent('click', function() {
|
$("aboutLicenseLink").addEvent("click", function() {
|
||||||
$$('.aboutTabContent').addClass('invisible');
|
$$(".aboutTabContent").addClass("invisible");
|
||||||
$('aboutLicenseContent').removeClass('invisible');
|
$("aboutLicenseContent").removeClass("invisible");
|
||||||
});
|
});
|
||||||
|
|
||||||
$('aboutSoftwareUsedLink').addEvent('click', function() {
|
$("aboutSoftwareUsedLink").addEvent("click", function() {
|
||||||
$$('.aboutTabContent').addClass('invisible');
|
$$(".aboutTabContent").addClass("invisible");
|
||||||
$('aboutSoftwareUsedContent').removeClass('invisible');
|
$("aboutSoftwareUsedContent").removeClass("invisible");
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -58,8 +58,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const categoriesFilterContextMenu = new window.qBittorrent.ContextMenu.CategoriesFilterContextMenu({
|
const categoriesFilterContextMenu = new window.qBittorrent.ContextMenu.CategoriesFilterContextMenu({
|
||||||
targets: '.categoriesFilterContextMenuTarget',
|
targets: ".categoriesFilterContextMenuTarget",
|
||||||
menu: 'categoriesFilterMenu',
|
menu: "categoriesFilterMenu",
|
||||||
actions: {
|
actions: {
|
||||||
createCategory: function(element, ref) {
|
createCategory: function(element, ref) {
|
||||||
createCategoryFN();
|
createCategoryFN();
|
||||||
|
@ -96,8 +96,8 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
const tagsFilterContextMenu = new window.qBittorrent.ContextMenu.TagsFilterContextMenu({
|
const tagsFilterContextMenu = new window.qBittorrent.ContextMenu.TagsFilterContextMenu({
|
||||||
targets: '.tagsFilterContextMenuTarget',
|
targets: ".tagsFilterContextMenuTarget",
|
||||||
menu: 'tagsFilterMenu',
|
menu: "tagsFilterMenu",
|
||||||
actions: {
|
actions: {
|
||||||
createTag: function(element, ref) {
|
createTag: function(element, ref) {
|
||||||
createTagFN();
|
createTagFN();
|
||||||
|
@ -128,8 +128,8 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
const trackersFilterContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
const trackersFilterContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
||||||
targets: '.trackersFilterContextMenuTarget',
|
targets: ".trackersFilterContextMenuTarget",
|
||||||
menu: 'trackersFilterMenu',
|
menu: "trackersFilterMenu",
|
||||||
actions: {
|
actions: {
|
||||||
startTorrentsByTracker: function(element, ref) {
|
startTorrentsByTracker: function(element, ref) {
|
||||||
startTorrentsByTrackerFN(element.id);
|
startTorrentsByTrackerFN(element.id);
|
||||||
|
@ -150,17 +150,17 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (LocalPreferences.get('filter_status_collapsed') === "true")
|
if (LocalPreferences.get("filter_status_collapsed") === "true")
|
||||||
toggleFilterDisplay('status');
|
toggleFilterDisplay("status");
|
||||||
|
|
||||||
if (LocalPreferences.get('filter_category_collapsed') === "true")
|
if (LocalPreferences.get("filter_category_collapsed") === "true")
|
||||||
toggleFilterDisplay('category');
|
toggleFilterDisplay("category");
|
||||||
|
|
||||||
if (LocalPreferences.get('filter_tag_collapsed') === "true")
|
if (LocalPreferences.get("filter_tag_collapsed") === "true")
|
||||||
toggleFilterDisplay('tag');
|
toggleFilterDisplay("tag");
|
||||||
|
|
||||||
if (LocalPreferences.get('filter_tracker_collapsed') === "true")
|
if (LocalPreferences.get("filter_tracker_collapsed") === "true")
|
||||||
toggleFilterDisplay('tracker');
|
toggleFilterDisplay("tracker");
|
||||||
|
|
||||||
return exports();
|
return exports();
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -42,9 +42,9 @@
|
||||||
|
|
||||||
const init = function() {
|
const init = function() {
|
||||||
new Keyboard({
|
new Keyboard({
|
||||||
defaultEventType: 'keydown',
|
defaultEventType: "keydown",
|
||||||
events: {
|
events: {
|
||||||
'Enter': function(e) {
|
"Enter": function(e) {
|
||||||
// accept enter key as a click
|
// accept enter key as a click
|
||||||
new Event(e).stop();
|
new Event(e).stop();
|
||||||
|
|
||||||
|
@ -52,25 +52,25 @@
|
||||||
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")
|
||||||
window.qBittorrent.SearchPlugins.closeSearchWindow('installSearchPlugin');
|
window.qBittorrent.SearchPlugins.closeSearchWindow("installSearchPlugin");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
$('newPluginPath').select();
|
$("newPluginPath").select();
|
||||||
};
|
};
|
||||||
|
|
||||||
const newPluginOk = function() {
|
const newPluginOk = function() {
|
||||||
const 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",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
sources: path,
|
sources: path,
|
||||||
},
|
},
|
||||||
onRequest: function() {
|
onRequest: function() {
|
||||||
window.qBittorrent.SearchPlugins.closeSearchWindow('installSearchPlugin');
|
window.qBittorrent.SearchPlugins.closeSearchWindow("installSearchPlugin");
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
|
@ -146,7 +146,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -166,7 +166,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
let currentSelectedTab = 'main';
|
let currentSelectedTab = "main";
|
||||||
let tableInfo = {
|
let tableInfo = {
|
||||||
main: {
|
main: {
|
||||||
instance: new window.qBittorrent.DynamicTable.LogMessageTable(),
|
instance: new window.qBittorrent.DynamicTable.LogMessageTable(),
|
||||||
|
@ -186,10 +186,10 @@
|
||||||
let logFilterTimer = -1;
|
let logFilterTimer = -1;
|
||||||
let inputtedFilterText = "";
|
let inputtedFilterText = "";
|
||||||
let selectBox;
|
let selectBox;
|
||||||
let selectedLogLevels = JSON.parse(LocalPreferences.get('qbt_selected_log_levels')) || ['1', '2', '4', '8'];
|
let selectedLogLevels = JSON.parse(LocalPreferences.get("qbt_selected_log_levels")) || ["1", "2", "4", "8"];
|
||||||
|
|
||||||
const init = () => {
|
const init = () => {
|
||||||
$('logLevelSelect').getElements('option').each((x) => {
|
$("logLevelSelect").getElements("option").each((x) => {
|
||||||
if (selectedLogLevels.indexOf(x.value.toString()) !== -1) {
|
if (selectedLogLevels.indexOf(x.value.toString()) !== -1) {
|
||||||
x.selected = true;
|
x.selected = true;
|
||||||
}
|
}
|
||||||
|
@ -198,23 +198,23 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
selectBox = new vanillaSelectBox('#logLevelSelect', {
|
selectBox = new vanillaSelectBox("#logLevelSelect", {
|
||||||
maxHeight: 200,
|
maxHeight: 200,
|
||||||
search: false,
|
search: false,
|
||||||
translations: {
|
translations: {
|
||||||
all: 'QBT_TR(All)QBT_TR[CONTEXT=ExecutionLogWidget]',
|
all: "QBT_TR(All)QBT_TR[CONTEXT=ExecutionLogWidget]",
|
||||||
item: 'QBT_TR(item)QBT_TR[CONTEXT=ExecutionLogWidget]',
|
item: "QBT_TR(item)QBT_TR[CONTEXT=ExecutionLogWidget]",
|
||||||
items: 'QBT_TR(items)QBT_TR[CONTEXT=ExecutionLogWidget]',
|
items: "QBT_TR(items)QBT_TR[CONTEXT=ExecutionLogWidget]",
|
||||||
selectAll: 'QBT_TR(Select All)QBT_TR[CONTEXT=ExecutionLogWidget]',
|
selectAll: "QBT_TR(Select All)QBT_TR[CONTEXT=ExecutionLogWidget]",
|
||||||
clearAll: 'QBT_TR(Clear All)QBT_TR[CONTEXT=ExecutionLogWidget]',
|
clearAll: "QBT_TR(Clear All)QBT_TR[CONTEXT=ExecutionLogWidget]",
|
||||||
},
|
},
|
||||||
placeHolder: "QBT_TR(Choose a log level...)QBT_TR[CONTEXT=ExecutionLogWidget]",
|
placeHolder: "QBT_TR(Choose a log level...)QBT_TR[CONTEXT=ExecutionLogWidget]",
|
||||||
keepInlineStyles: false
|
keepInlineStyles: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const logTableContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
const logTableContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
||||||
targets: '.logTableRow',
|
targets: ".logTableRow",
|
||||||
menu: 'logTableMenu',
|
menu: "logTableMenu",
|
||||||
actions: {
|
actions: {
|
||||||
Clear: () => {
|
Clear: () => {
|
||||||
tableInfo[currentSelectedTab].instance.selectedRowsIds().forEach(function(rowId) {
|
tableInfo[currentSelectedTab].instance.selectedRowsIds().forEach(function(rowId) {
|
||||||
|
@ -230,11 +230,11 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tableInfo['main'].instance.setup('logMessageTableDiv', 'logMessageTableFixedHeaderDiv', logTableContextMenu);
|
tableInfo["main"].instance.setup("logMessageTableDiv", "logMessageTableFixedHeaderDiv", logTableContextMenu);
|
||||||
tableInfo['peer'].instance.setup('logPeerTableDiv', 'logPeerTableFixedHeaderDiv', logTableContextMenu);
|
tableInfo["peer"].instance.setup("logPeerTableDiv", "logPeerTableFixedHeaderDiv", logTableContextMenu);
|
||||||
|
|
||||||
MUI.Panels.instances.LogPanel.contentEl.setStyle('height', '100%');
|
MUI.Panels.instances.LogPanel.contentEl.setStyle("height", "100%");
|
||||||
$('logView').setStyle('height', 'inherit');
|
$("logView").setStyle("height", "inherit");
|
||||||
|
|
||||||
load();
|
load();
|
||||||
};
|
};
|
||||||
|
@ -282,13 +282,13 @@
|
||||||
if (selectedLogLevels !== value) {
|
if (selectedLogLevels !== value) {
|
||||||
tableInfo[currentSelectedTab].last_id = -1;
|
tableInfo[currentSelectedTab].last_id = -1;
|
||||||
selectedLogLevels = value;
|
selectedLogLevels = value;
|
||||||
LocalPreferences.set('qbt_selected_log_levels', JSON.stringify(selectedLogLevels));
|
LocalPreferences.set("qbt_selected_log_levels", JSON.stringify(selectedLogLevels));
|
||||||
logFilterChanged();
|
logFilterChanged();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const filterTextChanged = () => {
|
const filterTextChanged = () => {
|
||||||
const value = $('filterTextInput').get('value').trim();
|
const value = $("filterTextInput").get("value").trim();
|
||||||
if (inputtedFilterText !== value) {
|
if (inputtedFilterText !== value) {
|
||||||
inputtedFilterText = value;
|
inputtedFilterText = value;
|
||||||
logFilterChanged();
|
logFilterChanged();
|
||||||
|
@ -310,17 +310,17 @@
|
||||||
return;
|
return;
|
||||||
|
|
||||||
currentSelectedTab = tab;
|
currentSelectedTab = tab;
|
||||||
if (currentSelectedTab === 'main') {
|
if (currentSelectedTab === "main") {
|
||||||
selectBox.enable();
|
selectBox.enable();
|
||||||
$('logMessageView').removeClass('invisible');
|
$("logMessageView").removeClass("invisible");
|
||||||
$('logPeerView').addClass('invisible');
|
$("logPeerView").addClass("invisible");
|
||||||
resetTableTimer('peer');
|
resetTableTimer("peer");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
selectBox.disable();
|
selectBox.disable();
|
||||||
$('logMessageView').addClass('invisible');
|
$("logMessageView").addClass("invisible");
|
||||||
$('logPeerView').removeClass('invisible');
|
$("logPeerView").removeClass("invisible");
|
||||||
resetTableTimer('main');
|
resetTableTimer("main");
|
||||||
}
|
}
|
||||||
|
|
||||||
clearTimeout(logFilterTimer);
|
clearTimeout(logFilterTimer);
|
||||||
|
@ -337,8 +337,8 @@
|
||||||
if (curTab === undefined)
|
if (curTab === undefined)
|
||||||
curTab = currentSelectedTab;
|
curTab = currentSelectedTab;
|
||||||
|
|
||||||
$('numFilteredLogs').set('text', tableInfo[curTab].instance.filteredLength());
|
$("numFilteredLogs").set("text", tableInfo[curTab].instance.filteredLength());
|
||||||
$('numTotalLogs').set('text', tableInfo[curTab].instance.getRowIds().length);
|
$("numTotalLogs").set("text", tableInfo[curTab].instance.getRowIds().length);
|
||||||
};
|
};
|
||||||
|
|
||||||
const syncLogData = (curTab) => {
|
const syncLogData = (curTab) => {
|
||||||
|
@ -346,37 +346,37 @@
|
||||||
curTab = currentSelectedTab;
|
curTab = currentSelectedTab;
|
||||||
|
|
||||||
let url;
|
let url;
|
||||||
if (curTab === 'main') {
|
if (curTab === "main") {
|
||||||
url = new URI('api/v2/log/main');
|
url = new URI("api/v2/log/main");
|
||||||
url.setData({
|
url.setData({
|
||||||
normal: selectedLogLevels.indexOf('1') !== -1,
|
normal: selectedLogLevels.indexOf("1") !== -1,
|
||||||
info: selectedLogLevels.indexOf('2') !== -1,
|
info: selectedLogLevels.indexOf("2") !== -1,
|
||||||
warning: selectedLogLevels.indexOf('4') !== -1,
|
warning: selectedLogLevels.indexOf("4") !== -1,
|
||||||
critical: selectedLogLevels.indexOf('8') !== -1
|
critical: selectedLogLevels.indexOf("8") !== -1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
url = new URI('api/v2/log/peers');
|
url = new URI("api/v2/log/peers");
|
||||||
}
|
}
|
||||||
|
|
||||||
url.setData('last_known_id', tableInfo[curTab].last_id);
|
url.setData("last_known_id", tableInfo[curTab].last_id);
|
||||||
tableInfo[curTab].progress = true;
|
tableInfo[curTab].progress = true;
|
||||||
|
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onFailure: function(response) {
|
onFailure: function(response) {
|
||||||
const errorDiv = $('error_div');
|
const errorDiv = $("error_div");
|
||||||
if (errorDiv)
|
if (errorDiv)
|
||||||
errorDiv.set('text', 'QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]');
|
errorDiv.set("text", "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]");
|
||||||
tableInfo[curTab].progress = false;
|
tableInfo[curTab].progress = false;
|
||||||
syncLogWithInterval(10000);
|
syncLogWithInterval(10000);
|
||||||
},
|
},
|
||||||
onSuccess: function(response) {
|
onSuccess: function(response) {
|
||||||
$('error_div').set('text', '');
|
$("error_div").set("text", "");
|
||||||
|
|
||||||
if ($('logTabColumn').hasClass('invisible'))
|
if ($("logTabColumn").hasClass("invisible"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (response.length > 0) {
|
if (response.length > 0) {
|
||||||
|
@ -385,7 +385,7 @@
|
||||||
|
|
||||||
for (let i = 0; i < response.length; ++i) {
|
for (let i = 0; i < response.length; ++i) {
|
||||||
let row;
|
let row;
|
||||||
if (curTab === 'main') {
|
if (curTab === "main") {
|
||||||
row = {
|
row = {
|
||||||
rowId: response[i].id,
|
rowId: response[i].id,
|
||||||
message: response[i].message,
|
message: response[i].message,
|
||||||
|
@ -417,14 +417,14 @@
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
new ClipboardJS('.copyLogDataToClipboard', {
|
new ClipboardJS(".copyLogDataToClipboard", {
|
||||||
text: function() {
|
text: function() {
|
||||||
let msg = [];
|
let msg = [];
|
||||||
tableInfo[currentSelectedTab].instance.selectedRowsIds().each(function(rowId) {
|
tableInfo[currentSelectedTab].instance.selectedRowsIds().each(function(rowId) {
|
||||||
msg.push(tableInfo[currentSelectedTab].instance.rows.get(rowId).full_data[(currentSelectedTab === 'main') ? 'message' : 'ip']);
|
msg.push(tableInfo[currentSelectedTab].instance.rows.get(rowId).full_data[(currentSelectedTab === "main") ? "message" : "ip"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
return msg.join('\n');
|
return msg.join("\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,43 +14,43 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
// Tabs
|
// Tabs
|
||||||
MochaUI.initializeTabs('preferencesTabs');
|
MochaUI.initializeTabs("preferencesTabs");
|
||||||
|
|
||||||
$('PrefBehaviorLink').addEvent('click', function(e) {
|
$("PrefBehaviorLink").addEvent("click", function(e) {
|
||||||
$$('.PrefTab').addClass('invisible');
|
$$(".PrefTab").addClass("invisible");
|
||||||
$('BehaviorTab').removeClass('invisible');
|
$("BehaviorTab").removeClass("invisible");
|
||||||
});
|
});
|
||||||
$('PrefDownloadsLink').addEvent('click', function(e) {
|
$("PrefDownloadsLink").addEvent("click", function(e) {
|
||||||
$$('.PrefTab').addClass('invisible');
|
$$(".PrefTab").addClass("invisible");
|
||||||
$('DownloadsTab').removeClass('invisible');
|
$("DownloadsTab").removeClass("invisible");
|
||||||
});
|
});
|
||||||
$('PrefConnectionLink').addEvent('click', function(e) {
|
$("PrefConnectionLink").addEvent("click", function(e) {
|
||||||
$$('.PrefTab').addClass('invisible');
|
$$(".PrefTab").addClass("invisible");
|
||||||
$('ConnectionTab').removeClass('invisible');
|
$("ConnectionTab").removeClass("invisible");
|
||||||
});
|
});
|
||||||
$('PrefSpeedLink').addEvent('click', function(e) {
|
$("PrefSpeedLink").addEvent("click", function(e) {
|
||||||
$$('.PrefTab').addClass('invisible');
|
$$(".PrefTab").addClass("invisible");
|
||||||
$('SpeedTab').removeClass('invisible');
|
$("SpeedTab").removeClass("invisible");
|
||||||
});
|
});
|
||||||
$('PrefBittorrentLink').addEvent('click', function(e) {
|
$("PrefBittorrentLink").addEvent("click", function(e) {
|
||||||
$$('.PrefTab').addClass('invisible');
|
$$(".PrefTab").addClass("invisible");
|
||||||
$('BittorrentTab').removeClass('invisible');
|
$("BittorrentTab").removeClass("invisible");
|
||||||
});
|
});
|
||||||
$('PrefRSSLink').addEvent('click', function(e) {
|
$("PrefRSSLink").addEvent("click", function(e) {
|
||||||
$$('.PrefTab').addClass('invisible');
|
$$(".PrefTab").addClass("invisible");
|
||||||
$('RSSTab').removeClass('invisible');
|
$("RSSTab").removeClass("invisible");
|
||||||
});
|
});
|
||||||
$('PrefWebUILink').addEvent('click', function(e) {
|
$("PrefWebUILink").addEvent("click", function(e) {
|
||||||
$$('.PrefTab').addClass('invisible');
|
$$(".PrefTab").addClass("invisible");
|
||||||
$('WebUITab').removeClass('invisible');
|
$("WebUITab").removeClass("invisible");
|
||||||
});
|
});
|
||||||
$('PrefAdvancedLink').addEvent('click', function(e) {
|
$("PrefAdvancedLink").addEvent("click", function(e) {
|
||||||
$$('.PrefTab').addClass('invisible');
|
$$(".PrefTab").addClass("invisible");
|
||||||
$('AdvancedTab').removeClass('invisible');
|
$("AdvancedTab").removeClass("invisible");
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -168,10 +168,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
const selectedTab = $(LocalPreferences.get('selected_tab', 'PropGeneralLink'));
|
const selectedTab = $(LocalPreferences.get("selected_tab", "PropGeneralLink"));
|
||||||
if (selectedTab)
|
if (selectedTab)
|
||||||
selectedTab.click();
|
selectedTab.click();
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -156,7 +156,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -192,30 +192,30 @@
|
||||||
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
||||||
|
|
||||||
if (!pref.rss_processing_enabled)
|
if (!pref.rss_processing_enabled)
|
||||||
$('rssFetchingDisabled').removeClass('invisible');
|
$("rssFetchingDisabled").removeClass("invisible");
|
||||||
|
|
||||||
// recalculate heights
|
// recalculate heights
|
||||||
const nonPageHeight = $('rssTopBar').getBoundingClientRect().height
|
const nonPageHeight = $("rssTopBar").getBoundingClientRect().height
|
||||||
+ $('desktopHeader').getBoundingClientRect().height
|
+ $("desktopHeader").getBoundingClientRect().height
|
||||||
+ $('desktopFooterWrapper').getBoundingClientRect().height + 20;
|
+ $("desktopFooterWrapper").getBoundingClientRect().height + 20;
|
||||||
$('rssDetailsView').style.height = 'calc(100vh - ' + nonPageHeight + 'px)';
|
$("rssDetailsView").style.height = "calc(100vh - " + nonPageHeight + "px)";
|
||||||
|
|
||||||
const nonTableHeight = nonPageHeight + $('rssFeedFixedHeaderDiv').getBoundingClientRect().height;
|
const nonTableHeight = nonPageHeight + $("rssFeedFixedHeaderDiv").getBoundingClientRect().height;
|
||||||
$('rssFeedTableDiv').style.height = 'calc(100vh - ' + nonTableHeight + 'px)';
|
$("rssFeedTableDiv").style.height = "calc(100vh - " + nonTableHeight + "px)";
|
||||||
$('rssArticleTableDiv').style.height = 'calc(100vh - ' + nonTableHeight + 'px)';
|
$("rssArticleTableDiv").style.height = "calc(100vh - " + nonTableHeight + "px)";
|
||||||
|
|
||||||
$('rssContentView').style.height = 'calc(100% - ' + $('rssTopBar').getBoundingClientRect().height + 'px)';
|
$("rssContentView").style.height = "calc(100% - " + $("rssTopBar").getBoundingClientRect().height + "px)";
|
||||||
|
|
||||||
const rssFeedContextMenu = new window.qBittorrent.ContextMenu.RssFeedContextMenu({
|
const rssFeedContextMenu = new window.qBittorrent.ContextMenu.RssFeedContextMenu({
|
||||||
targets: '.rssFeedContextMenuTarget',
|
targets: ".rssFeedContextMenuTarget",
|
||||||
menu: 'rssFeedMenu',
|
menu: "rssFeedMenu",
|
||||||
actions: {
|
actions: {
|
||||||
update: (el) => {
|
update: (el) => {
|
||||||
let feedsToUpdate = new Set();
|
let feedsToUpdate = new Set();
|
||||||
rssFeedTable.selectedRows.each((rowId) => {
|
rssFeedTable.selectedRows.each((rowId) => {
|
||||||
let selectedPath = rssFeedTable.rows[rowId].full_data.dataPath;
|
let selectedPath = rssFeedTable.rows[rowId].full_data.dataPath;
|
||||||
rssFeedTable.rows.filter((row) => row.full_data.dataPath.slice(0, selectedPath.length) === selectedPath)
|
rssFeedTable.rows.filter((row) => row.full_data.dataPath.slice(0, selectedPath.length) === selectedPath)
|
||||||
.filter((row) => row.full_data.dataUid !== '')
|
.filter((row) => row.full_data.dataUid !== "")
|
||||||
.each((row) => feedsToUpdate.add(row));
|
.each((row) => feedsToUpdate.add(row));
|
||||||
});
|
});
|
||||||
feedsToUpdate.forEach((feed) => refreshFeed(feed.full_data.dataUid));
|
feedsToUpdate.forEach((feed) => refreshFeed(feed.full_data.dataUid));
|
||||||
|
@ -244,39 +244,39 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
rssFeedContextMenu.addTarget($('rssFeedTableDiv'));
|
rssFeedContextMenu.addTarget($("rssFeedTableDiv"));
|
||||||
// deselect feed when clicking on empty part of table
|
// deselect feed when clicking on empty part of table
|
||||||
$('rssFeedTableDiv').addEventListener('click', (e) => {
|
$("rssFeedTableDiv").addEventListener("click", (e) => {
|
||||||
rssFeedTable.deselectAll();
|
rssFeedTable.deselectAll();
|
||||||
rssFeedTable.deselectRow();
|
rssFeedTable.deselectRow();
|
||||||
});
|
});
|
||||||
$('rssFeedTableDiv').addEventListener('contextmenu', (e) => {
|
$("rssFeedTableDiv").addEventListener("contextmenu", (e) => {
|
||||||
if (e.toElement.nodeName === 'DIV') {
|
if (e.toElement.nodeName === "DIV") {
|
||||||
rssFeedTable.deselectAll();
|
rssFeedTable.deselectAll();
|
||||||
rssFeedTable.deselectRow();
|
rssFeedTable.deselectRow();
|
||||||
rssFeedContextMenu.updateMenuItems();
|
rssFeedContextMenu.updateMenuItems();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
new ClipboardJS('#CopyFeedURL', {
|
new ClipboardJS("#CopyFeedURL", {
|
||||||
text: () => {
|
text: () => {
|
||||||
let joined = '';
|
let joined = "";
|
||||||
rssFeedTable.selectedRows
|
rssFeedTable.selectedRows
|
||||||
.filter((row) => rssFeedTable.rows[row].full_data.dataUid !== '')
|
.filter((row) => rssFeedTable.rows[row].full_data.dataUid !== "")
|
||||||
.each((row) => joined += rssFeedTable.rows[row].full_data.dataUrl + '\n');
|
.each((row) => joined += rssFeedTable.rows[row].full_data.dataUrl + "\n");
|
||||||
return joined.slice(0, -1);
|
return joined.slice(0, -1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
rssFeedTable.setup('rssFeedTableDiv', 'rssFeedFixedHeaderDiv', rssFeedContextMenu);
|
rssFeedTable.setup("rssFeedTableDiv", "rssFeedFixedHeaderDiv", rssFeedContextMenu);
|
||||||
|
|
||||||
const rssArticleContextMenu = new window.qBittorrent.ContextMenu.RssArticleContextMenu({
|
const rssArticleContextMenu = new window.qBittorrent.ContextMenu.RssArticleContextMenu({
|
||||||
targets: '.rssArticleElement',
|
targets: ".rssArticleElement",
|
||||||
menu: 'rssArticleMenu',
|
menu: "rssArticleMenu",
|
||||||
actions: {
|
actions: {
|
||||||
Download: (el) => {
|
Download: (el) => {
|
||||||
let dlString = '';
|
let dlString = "";
|
||||||
rssArticleTable.selectedRows.each((row) => {
|
rssArticleTable.selectedRows.each((row) => {
|
||||||
dlString += rssArticleTable.rows[row].full_data.torrentURL + '\n';
|
dlString += rssArticleTable.rows[row].full_data.torrentURL + "\n";
|
||||||
});
|
});
|
||||||
showDownloadPage([dlString]);
|
showDownloadPage([dlString]);
|
||||||
},
|
},
|
||||||
|
@ -291,7 +291,7 @@
|
||||||
y: -57
|
y: -57
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
rssArticleTable.setup('rssArticleTableDiv', 'rssArticleFixedHeaderDiv', rssArticleContextMenu);
|
rssArticleTable.setup("rssArticleTableDiv", "rssArticleFixedHeaderDiv", rssArticleContextMenu);
|
||||||
updateRssFeedList();
|
updateRssFeedList();
|
||||||
load();
|
load();
|
||||||
};
|
};
|
||||||
|
@ -305,24 +305,24 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRSSFeed = () => {
|
const addRSSFeed = () => {
|
||||||
let path = '';
|
let path = "";
|
||||||
if (rssFeedTable.selectedRows.length !== 0) {
|
if (rssFeedTable.selectedRows.length !== 0) {
|
||||||
let row = rssFeedTable.rows[rssFeedTable.selectedRows[0]];
|
let row = rssFeedTable.rows[rssFeedTable.selectedRows[0]];
|
||||||
if (row.full_data.dataUid === '') {
|
if (row.full_data.dataUid === "") {
|
||||||
path = row.full_data.dataPath;
|
path = row.full_data.dataPath;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let lastIndex = row.full_data.dataPath.lastIndexOf('\\');
|
let lastIndex = row.full_data.dataPath.lastIndexOf("\\");
|
||||||
if (lastIndex !== -1)
|
if (lastIndex !== -1)
|
||||||
path = row.full_data.dataPath.slice(0, lastIndex);
|
path = row.full_data.dataPath.slice(0, lastIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'newFeed',
|
id: "newFeed",
|
||||||
title: 'QBT_TR(Please type a RSS feed URL)QBT_TR[CONTEXT=RSSWidget]',
|
title: "QBT_TR(Please type a RSS feed URL)QBT_TR[CONTEXT=RSSWidget]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: 'newfeed.html?path=' + encodeURIComponent(path),
|
contentURL: "newfeed.html?path=" + encodeURIComponent(path),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -332,24 +332,24 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const addFolder = () => {
|
const addFolder = () => {
|
||||||
let path = '';
|
let path = "";
|
||||||
if (rssFeedTable.selectedRows.length !== 0) {
|
if (rssFeedTable.selectedRows.length !== 0) {
|
||||||
let row = rssFeedTable.rows[rssFeedTable.selectedRows[0]];
|
let row = rssFeedTable.rows[rssFeedTable.selectedRows[0]];
|
||||||
if (row.full_data.dataUid === '') {
|
if (row.full_data.dataUid === "") {
|
||||||
path = row.full_data.dataPath;
|
path = row.full_data.dataPath;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let lastIndex = row.full_data.dataPath.lastIndexOf('\\');
|
let lastIndex = row.full_data.dataPath.lastIndexOf("\\");
|
||||||
if (lastIndex !== -1)
|
if (lastIndex !== -1)
|
||||||
path = row.full_data.dataPath.slice(0, lastIndex);
|
path = row.full_data.dataPath.slice(0, lastIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'newFolder',
|
id: "newFolder",
|
||||||
title: 'QBT_TR(Please choose a folder name)QBT_TR[CONTEXT=RSSWidget]',
|
title: "QBT_TR(Please choose a folder name)QBT_TR[CONTEXT=RSSWidget]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: 'newfolder.html?path=' + encodeURIComponent(path),
|
contentURL: "newfolder.html?path=" + encodeURIComponent(path),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -364,7 +364,7 @@
|
||||||
|
|
||||||
let childFeeds = new Set();
|
let childFeeds = new Set();
|
||||||
rssFeedTable.rows.filter((row) => row.full_data.dataPath.slice(0, path.length) === path)
|
rssFeedTable.rows.filter((row) => row.full_data.dataPath.slice(0, path.length) === path)
|
||||||
.filter((row) => row.full_data.dataUid !== '')
|
.filter((row) => row.full_data.dataUid !== "")
|
||||||
.each((row) => childFeeds.add(row.full_data.dataUid));
|
.each((row) => childFeeds.add(row.full_data.dataUid));
|
||||||
|
|
||||||
let visibleArticles = [];
|
let visibleArticles = [];
|
||||||
|
@ -377,7 +377,7 @@
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
//filter read articles if "Unread" feed is selected
|
//filter read articles if "Unread" feed is selected
|
||||||
if (path === '')
|
if (path === "")
|
||||||
visibleArticles = visibleArticles.filter((a) => !a.isRead);
|
visibleArticles = visibleArticles.filter((a) => !a.isRead);
|
||||||
|
|
||||||
visibleArticles.sort((e1, e2) => new Date(e2.date) - new Date(e1.date))
|
visibleArticles.sort((e1, e2) => new Date(e2.date) - new Date(e1.date))
|
||||||
|
@ -393,30 +393,30 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('rssDetailsView').getChildren().each(c => c.destroy());
|
$("rssDetailsView").getChildren().each(c => c.destroy());
|
||||||
rssArticleTable.updateTable(false);
|
rssArticleTable.updateTable(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const showDetails = (feedUid, articleID) => {
|
const showDetails = (feedUid, articleID) => {
|
||||||
markArticleAsRead(pathByFeedId.get(feedUid), articleID);
|
markArticleAsRead(pathByFeedId.get(feedUid), articleID);
|
||||||
$('rssDetailsView').getChildren().each(c => c.destroy());
|
$("rssDetailsView").getChildren().each(c => c.destroy());
|
||||||
let article = feedData[feedUid].filter((article) => article.id === articleID)[0];
|
let article = feedData[feedUid].filter((article) => article.id === articleID)[0];
|
||||||
if (article) {
|
if (article) {
|
||||||
$('rssDetailsView').append((() => {
|
$("rssDetailsView").append((() => {
|
||||||
let torrentName = document.createElement('p');
|
let torrentName = document.createElement("p");
|
||||||
torrentName.innerText = article.title;
|
torrentName.innerText = article.title;
|
||||||
torrentName.setAttribute('id', 'rssTorrentDetailsName');
|
torrentName.setAttribute("id", "rssTorrentDetailsName");
|
||||||
return torrentName;
|
return torrentName;
|
||||||
})());
|
})());
|
||||||
$('rssDetailsView').append((() => {
|
$("rssDetailsView").append((() => {
|
||||||
let torrentDate = document.createElement('div');
|
let torrentDate = document.createElement("div");
|
||||||
torrentDate.setAttribute('id', 'rssTorrentDetailsDate');
|
torrentDate.setAttribute("id", "rssTorrentDetailsDate");
|
||||||
|
|
||||||
let torrentDateDesc = document.createElement('b');
|
let torrentDateDesc = document.createElement("b");
|
||||||
torrentDateDesc.innerText = 'QBT_TR(Date: )QBT_TR[CONTEXT=RSSWidget]';
|
torrentDateDesc.innerText = "QBT_TR(Date: )QBT_TR[CONTEXT=RSSWidget]";
|
||||||
torrentDate.append(torrentDateDesc);
|
torrentDate.append(torrentDateDesc);
|
||||||
|
|
||||||
let torrentDateData = document.createElement('span');
|
let torrentDateData = document.createElement("span");
|
||||||
torrentDateData.innerText = new Date(article.date).toLocaleString();
|
torrentDateData.innerText = new Date(article.date).toLocaleString();
|
||||||
torrentDate.append(torrentDateData);
|
torrentDate.append(torrentDateData);
|
||||||
|
|
||||||
|
@ -424,20 +424,20 @@
|
||||||
})());
|
})());
|
||||||
// Place in iframe with sandbox attribute to prevent js execution
|
// Place in iframe with sandbox attribute to prevent js execution
|
||||||
let torrentDescription = document.createRange().createContextualFragment('<iframe sandbox id="rssDescription"></iframe>');
|
let torrentDescription = document.createRange().createContextualFragment('<iframe sandbox id="rssDescription"></iframe>');
|
||||||
$('rssDetailsView').append(torrentDescription);
|
$("rssDetailsView").append(torrentDescription);
|
||||||
document.getElementById('rssDescription').srcdoc = '<html><head><link rel="stylesheet" type="text/css" href="css/style.css" /></head><body>' + article.description + "</body></html>";
|
document.getElementById("rssDescription").srcdoc = '<html><head><link rel="stylesheet" type="text/css" href="css/style.css" /></head><body>' + article.description + "</body></html>";
|
||||||
|
|
||||||
//calculate height to fill screen
|
//calculate height to fill screen
|
||||||
document.getElementById('rssDescription').style.height =
|
document.getElementById("rssDescription").style.height =
|
||||||
"calc(100% - " + document.getElementById('rssTorrentDetailsName').offsetHeight + "px - "
|
"calc(100% - " + document.getElementById("rssTorrentDetailsName").offsetHeight + "px - "
|
||||||
+ document.getElementById('rssTorrentDetailsDate').offsetHeight + "px - 5px)";
|
+ document.getElementById("rssTorrentDetailsDate").offsetHeight + "px - 5px)";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateRssFeedList = () => {
|
const updateRssFeedList = () => {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: 'api/v2/rss/items',
|
url: "api/v2/rss/items",
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
data: {
|
data: {
|
||||||
withData: true
|
withData: true
|
||||||
|
@ -445,9 +445,9 @@
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
// flatten folder structure
|
// flatten folder structure
|
||||||
let flattenedResp = [];
|
let flattenedResp = [];
|
||||||
let recFlatten = (current, name = '', depth = 0, fullName = '') => {
|
let recFlatten = (current, name = "", depth = 0, fullName = "") => {
|
||||||
for (let child in current) {
|
for (let child in current) {
|
||||||
let currentFullName = fullName ? (fullName + '\\' + child) : child;
|
let currentFullName = fullName ? (fullName + "\\" + child) : child;
|
||||||
if (current[child].uid !== undefined) {
|
if (current[child].uid !== undefined) {
|
||||||
current[child].name = child;
|
current[child].name = child;
|
||||||
current[child].isFolder = false;
|
current[child].isFolder = false;
|
||||||
|
@ -473,7 +473,7 @@
|
||||||
if ((rssFeedTable.rows.getLength() - 1) === flattenedResp.length) {
|
if ((rssFeedTable.rows.getLength() - 1) === flattenedResp.length) {
|
||||||
match = true;
|
match = true;
|
||||||
for (let i = 0; i < flattenedResp.length; ++i) {
|
for (let i = 0; i < flattenedResp.length; ++i) {
|
||||||
if (((flattenedResp[i].uid ? flattenedResp[i].uid : '') !== rssFeedTable.rows[i + 1].full_data.dataUid)
|
if (((flattenedResp[i].uid ? flattenedResp[i].uid : "") !== rssFeedTable.rows[i + 1].full_data.dataUid)
|
||||||
|| (flattenedResp[i].fullName !== rssFeedTable.rows[i + 1].full_data.dataPath)) {
|
|| (flattenedResp[i].fullName !== rssFeedTable.rows[i + 1].full_data.dataPath)) {
|
||||||
match = false;
|
match = false;
|
||||||
break;
|
break;
|
||||||
|
@ -487,13 +487,13 @@
|
||||||
let statusDiffers = false;
|
let statusDiffers = false;
|
||||||
for (let i = 0; i < flattenedResp.length; ++i) {
|
for (let i = 0; i < flattenedResp.length; ++i) {
|
||||||
let oldStatus = rssFeedTable.rows[i + 1].full_data.status;
|
let oldStatus = rssFeedTable.rows[i + 1].full_data.status;
|
||||||
let status = 'default';
|
let status = "default";
|
||||||
if (flattenedResp[i].hasError)
|
if (flattenedResp[i].hasError)
|
||||||
status = 'hasError';
|
status = "hasError";
|
||||||
if (flattenedResp[i].isLoading)
|
if (flattenedResp[i].isLoading)
|
||||||
status = 'isLoading';
|
status = "isLoading";
|
||||||
if (flattenedResp[i].isFolder)
|
if (flattenedResp[i].isFolder)
|
||||||
status = 'isFolder';
|
status = "isFolder";
|
||||||
|
|
||||||
if (oldStatus !== status) {
|
if (oldStatus !== status) {
|
||||||
statusDiffers = true;
|
statusDiffers = true;
|
||||||
|
@ -590,13 +590,13 @@
|
||||||
// Unread entry at top
|
// Unread entry at top
|
||||||
rssFeedTable.updateRowData({
|
rssFeedTable.updateRowData({
|
||||||
rowId: 0,
|
rowId: 0,
|
||||||
name: 'QBT_TR(Unread)QBT_TR[CONTEXT=FeedListWidget]',
|
name: "QBT_TR(Unread)QBT_TR[CONTEXT=FeedListWidget]",
|
||||||
unread: 0,
|
unread: 0,
|
||||||
status: 'unread',
|
status: "unread",
|
||||||
indentation: 0,
|
indentation: 0,
|
||||||
dataUid: '',
|
dataUid: "",
|
||||||
dataUrl: '',
|
dataUrl: "",
|
||||||
dataPath: ''
|
dataPath: ""
|
||||||
});
|
});
|
||||||
|
|
||||||
let rowCount = 1;
|
let rowCount = 1;
|
||||||
|
@ -606,19 +606,19 @@
|
||||||
rowId: rowCount,
|
rowId: rowCount,
|
||||||
name: dataEntry.name,
|
name: dataEntry.name,
|
||||||
unread: 0,
|
unread: 0,
|
||||||
status: 'isFolder',
|
status: "isFolder",
|
||||||
indentation: dataEntry.depth,
|
indentation: dataEntry.depth,
|
||||||
dataUid: '',
|
dataUid: "",
|
||||||
dataUrl: '',
|
dataUrl: "",
|
||||||
dataPath: dataEntry.fullName
|
dataPath: dataEntry.fullName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let status = 'default';
|
let status = "default";
|
||||||
if (dataEntry.hasError)
|
if (dataEntry.hasError)
|
||||||
status = 'hasError';
|
status = "hasError";
|
||||||
if (dataEntry.isLoading)
|
if (dataEntry.isLoading)
|
||||||
status = 'isLoading';
|
status = "isLoading";
|
||||||
|
|
||||||
rssFeedTable.updateRowData({
|
rssFeedTable.updateRowData({
|
||||||
rowId: rowCount,
|
rowId: rowCount,
|
||||||
|
@ -653,13 +653,13 @@
|
||||||
// set icon to loading
|
// set icon to loading
|
||||||
rssFeedTable.rows.forEach((row) => {
|
rssFeedTable.rows.forEach((row) => {
|
||||||
if (row.full_data.dataUid === feedUid)
|
if (row.full_data.dataUid === feedUid)
|
||||||
row.full_data.status = 'isLoading';
|
row.full_data.status = "isLoading";
|
||||||
});
|
});
|
||||||
rssFeedTable.updateIcons();
|
rssFeedTable.updateIcons();
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/rss/refreshItem',
|
url: "api/v2/rss/refreshItem",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
itemPath: pathByFeedId.get(feedUid)
|
itemPath: pathByFeedId.get(feedUid)
|
||||||
},
|
},
|
||||||
|
@ -677,10 +677,10 @@
|
||||||
|
|
||||||
const moveItem = (oldPath) => {
|
const moveItem = (oldPath) => {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'renamePage',
|
id: "renamePage",
|
||||||
title: 'QBT_TR(Please choose a new name for this RSS feed)QBT_TR[CONTEXT=RSSWidget]',
|
title: "QBT_TR(Please choose a new name for this RSS feed)QBT_TR[CONTEXT=RSSWidget]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: 'rename_feed.html?oldPath=' + encodeURIComponent(oldPath),
|
contentURL: "rename_feed.html?oldPath=" + encodeURIComponent(oldPath),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -692,10 +692,10 @@
|
||||||
const removeItem = (paths) => {
|
const removeItem = (paths) => {
|
||||||
const encodedPaths = paths.map((path) => encodeURIComponent(path));
|
const encodedPaths = paths.map((path) => encodeURIComponent(path));
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'confirmFeedDeletionPage',
|
id: "confirmFeedDeletionPage",
|
||||||
title: 'QBT_TR(Deletion confirmation)QBT_TR[CONTEXT=RSSWidget]',
|
title: "QBT_TR(Deletion confirmation)QBT_TR[CONTEXT=RSSWidget]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: 'confirmfeeddeletion.html?paths=' + encodeURIComponent(encodedPaths.join('|')),
|
contentURL: "confirmfeeddeletion.html?paths=" + encodeURIComponent(encodedPaths.join("|")),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -735,8 +735,8 @@
|
||||||
|
|
||||||
// send request
|
// send request
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/rss/markAsRead',
|
url: "api/v2/rss/markAsRead",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
itemPath: path
|
itemPath: path
|
||||||
},
|
},
|
||||||
|
@ -775,8 +775,8 @@
|
||||||
rssFeedTable.updateTable(true);
|
rssFeedTable.updateTable(true);
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/rss/markAsRead',
|
url: "api/v2/rss/markAsRead",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
itemPath: path,
|
itemPath: path,
|
||||||
articleId: id
|
articleId: id
|
||||||
|
@ -800,12 +800,12 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const openRssDownloader = () => {
|
const openRssDownloader = () => {
|
||||||
const id = 'rssdownloaderpage';
|
const id = "rssdownloaderpage";
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: id,
|
id: id,
|
||||||
title: 'QBT_TR(Rss Downloader)QBT_TR[CONTEXT=AutomatedRssDownloader]',
|
title: "QBT_TR(Rss Downloader)QBT_TR[CONTEXT=AutomatedRssDownloader]",
|
||||||
loadMethod: 'xhr',
|
loadMethod: "xhr",
|
||||||
contentURL: 'views/rssDownloader.html',
|
contentURL: "views/rssDownloader.html",
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
width: loadWindowWidth(id, 800),
|
width: loadWindowWidth(id, 800),
|
||||||
height: loadWindowHeight(id, 650),
|
height: loadWindowHeight(id, 650),
|
||||||
|
@ -813,8 +813,8 @@
|
||||||
saveWindowSize(id);
|
saveWindowSize(id);
|
||||||
},
|
},
|
||||||
resizeLimit: {
|
resizeLimit: {
|
||||||
'x': [800, 2500],
|
"x": [800, 2500],
|
||||||
'y': [500, 2000]
|
"y": [500, 2000]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -328,7 +328,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -361,35 +361,35 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
||||||
|
|
||||||
if (!pref.rss_auto_downloading_enabled)
|
if (!pref.rss_auto_downloading_enabled)
|
||||||
$('rssDownloaderDisabled').removeClass('invisible');
|
$("rssDownloaderDisabled").removeClass("invisible");
|
||||||
|
|
||||||
// recalculate height
|
// recalculate height
|
||||||
const warningHeight = $('rssDownloaderDisabled').getBoundingClientRect().height;
|
const warningHeight = $("rssDownloaderDisabled").getBoundingClientRect().height;
|
||||||
|
|
||||||
$('leftRssDownloaderColumn').style.height = 'calc(100% - ' + warningHeight + 'px)';
|
$("leftRssDownloaderColumn").style.height = "calc(100% - " + warningHeight + "px)";
|
||||||
$('centerRssDownloaderColumn').style.height = 'calc(100% - ' + warningHeight + 'px)';
|
$("centerRssDownloaderColumn").style.height = "calc(100% - " + warningHeight + "px)";
|
||||||
$('rightRssDownloaderColumn').style.height = 'calc(100% - ' + warningHeight + 'px)';
|
$("rightRssDownloaderColumn").style.height = "calc(100% - " + warningHeight + "px)";
|
||||||
|
|
||||||
$('rulesTable').style.height = 'calc(100% - ' + $('rulesTableDesc').getBoundingClientRect().height + 'px)';
|
$("rulesTable").style.height = "calc(100% - " + $("rulesTableDesc").getBoundingClientRect().height + "px)";
|
||||||
$('rssDownloaderArticlesTable').style.height = 'calc(100% - ' + $('articleTableDesc').getBoundingClientRect().height + 'px)';
|
$("rssDownloaderArticlesTable").style.height = "calc(100% - " + $("articleTableDesc").getBoundingClientRect().height + "px)";
|
||||||
|
|
||||||
const centerRowNotTableHeight = $('saveButton').getBoundingClientRect().height
|
const centerRowNotTableHeight = $("saveButton").getBoundingClientRect().height
|
||||||
+ $('ruleSettings').getBoundingClientRect().height + 15;
|
+ $("ruleSettings").getBoundingClientRect().height + 15;
|
||||||
|
|
||||||
$('rssDownloaderFeeds').style.height = 'calc(100% - ' + centerRowNotTableHeight + 'px)';
|
$("rssDownloaderFeeds").style.height = "calc(100% - " + centerRowNotTableHeight + "px)";
|
||||||
|
|
||||||
// firefox calculates the height of the table inside fieldset differently and thus doesn't need the offset
|
// firefox calculates the height of the table inside fieldset differently and thus doesn't need the offset
|
||||||
if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
|
if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) {
|
||||||
$('rssDownloaderFeedsTable').style.height = '100%';
|
$("rssDownloaderFeedsTable").style.height = "100%";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let outsideTableHeight = ($('rssDownloaderFeedsTable').getBoundingClientRect().top - $('rssDownloaderFeeds').getBoundingClientRect().top) - 10;
|
let outsideTableHeight = ($("rssDownloaderFeedsTable").getBoundingClientRect().top - $("rssDownloaderFeeds").getBoundingClientRect().top) - 10;
|
||||||
$('rssDownloaderFeedsTable').style.height = 'calc(100% - ' + outsideTableHeight + 'px)';
|
$("rssDownloaderFeedsTable").style.height = "calc(100% - " + outsideTableHeight + "px)";
|
||||||
}
|
}
|
||||||
|
|
||||||
const rssDownloaderRuleContextMenu = new window.qBittorrent.ContextMenu.RssDownloaderRuleContextMenu({
|
const rssDownloaderRuleContextMenu = new window.qBittorrent.ContextMenu.RssDownloaderRuleContextMenu({
|
||||||
targets: '',
|
targets: "",
|
||||||
menu: 'rssDownloaderRuleMenu',
|
menu: "rssDownloaderRuleMenu",
|
||||||
actions: {
|
actions: {
|
||||||
addRule: addRule,
|
addRule: addRule,
|
||||||
deleteRule: removeSelectedRule,
|
deleteRule: removeSelectedRule,
|
||||||
|
@ -406,34 +406,34 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
y: -4
|
y: -4
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
rssDownloaderRulesTable.setup('rssDownloaderRuleTableDiv', 'rssDownloaderRuleFixedHeaderDiv', rssDownloaderRuleContextMenu);
|
rssDownloaderRulesTable.setup("rssDownloaderRuleTableDiv", "rssDownloaderRuleFixedHeaderDiv", rssDownloaderRuleContextMenu);
|
||||||
rssDownloaderFeedSelectionTable.setup('rssDownloaderFeedSelectionTableDiv', 'rssDownloaderFeedSelectionFixedHeaderDiv');
|
rssDownloaderFeedSelectionTable.setup("rssDownloaderFeedSelectionTableDiv", "rssDownloaderFeedSelectionFixedHeaderDiv");
|
||||||
rssDownloaderArticlesTable.setup('rssDownloaderArticlesTableDiv', 'rssDownloaderArticlesFixedHeaderDiv');
|
rssDownloaderArticlesTable.setup("rssDownloaderArticlesTableDiv", "rssDownloaderArticlesFixedHeaderDiv");
|
||||||
|
|
||||||
rssDownloaderRuleContextMenu.addTarget($('rulesTable'));
|
rssDownloaderRuleContextMenu.addTarget($("rulesTable"));
|
||||||
// deselect feed when clicking on empty part of table
|
// deselect feed when clicking on empty part of table
|
||||||
$('rulesTable').addEventListener('click', (e) => {
|
$("rulesTable").addEventListener("click", (e) => {
|
||||||
rssDownloaderRulesTable.deselectAll();
|
rssDownloaderRulesTable.deselectAll();
|
||||||
rssDownloaderRulesTable.deselectRow();
|
rssDownloaderRulesTable.deselectRow();
|
||||||
showRule('');
|
showRule("");
|
||||||
});
|
});
|
||||||
$('rulesTable').addEventListener('contextmenu', (e) => {
|
$("rulesTable").addEventListener("contextmenu", (e) => {
|
||||||
if (e.toElement.nodeName === 'DIV') {
|
if (e.toElement.nodeName === "DIV") {
|
||||||
rssDownloaderRulesTable.deselectAll();
|
rssDownloaderRulesTable.deselectAll();
|
||||||
rssDownloaderRulesTable.deselectRow();
|
rssDownloaderRulesTable.deselectRow();
|
||||||
rssDownloaderRuleContextMenu.updateMenuItems();
|
rssDownloaderRuleContextMenu.updateMenuItems();
|
||||||
showRule('');
|
showRule("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// get all categories and add to combobox
|
// get all categories and add to combobox
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: 'api/v2/torrents/categories',
|
url: "api/v2/torrents/categories",
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
let combobox = $('assignCategoryCombobox');
|
let combobox = $("assignCategoryCombobox");
|
||||||
for (let cat in response) {
|
for (let cat in response) {
|
||||||
let option = document.createElement('option');
|
let option = document.createElement("option");
|
||||||
option.text = option.value = cat;
|
option.text = option.value = cat;
|
||||||
combobox.add(option);
|
combobox.add(option);
|
||||||
}
|
}
|
||||||
|
@ -441,8 +441,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
}).send();
|
}).send();
|
||||||
// get all rss feed
|
// get all rss feed
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: 'api/v2/rss/items',
|
url: "api/v2/rss/items",
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
data: {
|
data: {
|
||||||
withData: false
|
withData: false
|
||||||
|
@ -460,8 +460,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
flatten(response);
|
flatten(response);
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
$('savetoDifferentDir').addEvent('click', () => {
|
$("savetoDifferentDir").addEvent("click", () => {
|
||||||
$('saveToText').disabled = !$('savetoDifferentDir').checked;
|
$("saveToText").disabled = !$("savetoDifferentDir").checked;
|
||||||
});
|
});
|
||||||
updateRulesList();
|
updateRulesList();
|
||||||
};
|
};
|
||||||
|
@ -469,8 +469,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
const updateRulesList = () => {
|
const updateRulesList = () => {
|
||||||
// get all rules
|
// get all rules
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: 'api/v2/rss/rules',
|
url: "api/v2/rss/rules",
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
rssDownloaderRulesTable.clear();
|
rssDownloaderRulesTable.clear();
|
||||||
|
@ -491,8 +491,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
const modifyRuleState = (rule, setting, newState, callback = () => {}) => {
|
const modifyRuleState = (rule, setting, newState, callback = () => {}) => {
|
||||||
rulesList[rule][setting] = newState;
|
rulesList[rule][setting] = newState;
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/rss/setRule',
|
url: "api/v2/rss/setRule",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
ruleName: rule,
|
ruleName: rule,
|
||||||
ruleDef: JSON.stringify(rulesList[rule])
|
ruleDef: JSON.stringify(rulesList[rule])
|
||||||
|
@ -505,10 +505,10 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
|
|
||||||
const addRule = () => {
|
const addRule = () => {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'newRulePage',
|
id: "newRulePage",
|
||||||
title: 'QBT_TR(New rule name)QBT_TR[CONTEXT=AutomatedRssDownloader]',
|
title: "QBT_TR(New rule name)QBT_TR[CONTEXT=AutomatedRssDownloader]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: 'newrule.html',
|
contentURL: "newrule.html",
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -519,10 +519,10 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
|
|
||||||
const renameRule = (rule) => {
|
const renameRule = (rule) => {
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'renameRulePage',
|
id: "renameRulePage",
|
||||||
title: 'QBT_TR(Rule renaming)QBT_TR[CONTEXT=AutomatedRssDownloader]',
|
title: "QBT_TR(Rule renaming)QBT_TR[CONTEXT=AutomatedRssDownloader]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: 'rename_rule.html?rule=' + encodeURIComponent(rule),
|
contentURL: "rename_rule.html?rule=" + encodeURIComponent(rule),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -541,10 +541,10 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
const removeRules = (rules) => {
|
const removeRules = (rules) => {
|
||||||
const encodedRules = rules.map((rule) => encodeURIComponent(rule));
|
const encodedRules = rules.map((rule) => encodeURIComponent(rule));
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'removeRulePage',
|
id: "removeRulePage",
|
||||||
title: 'QBT_TR(Rule deletion confirmation)QBT_TR[CONTEXT=AutomatedRssDownloader]',
|
title: "QBT_TR(Rule deletion confirmation)QBT_TR[CONTEXT=AutomatedRssDownloader]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: 'confirmruledeletion.html?rules=' + encodeURIComponent(encodedRules.join('|')),
|
contentURL: "confirmruledeletion.html?rules=" + encodeURIComponent(encodedRules.join("|")),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -556,10 +556,10 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
const clearDownloadedEpisodes = (rules) => {
|
const clearDownloadedEpisodes = (rules) => {
|
||||||
const encodedRules = rules.map((rule) => encodeURIComponent(rule));
|
const encodedRules = rules.map((rule) => encodeURIComponent(rule));
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: 'clearRulesPage',
|
id: "clearRulesPage",
|
||||||
title: 'QBT_TR(New rule name)QBT_TR[CONTEXT=AutomatedRssDownloader]',
|
title: "QBT_TR(New rule name)QBT_TR[CONTEXT=AutomatedRssDownloader]",
|
||||||
loadMethod: 'iframe',
|
loadMethod: "iframe",
|
||||||
contentURL: 'confirmruleclear.html?rules=' + encodeURIComponent(encodedRules.join('|')),
|
contentURL: "confirmruleclear.html?rules=" + encodeURIComponent(encodedRules.join("|")),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -572,53 +572,53 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
let lastSelectedRow = rssDownloaderRulesTable.selectedRows[rssDownloaderRulesTable.selectedRows.length - 1];
|
let lastSelectedRow = rssDownloaderRulesTable.selectedRows[rssDownloaderRulesTable.selectedRows.length - 1];
|
||||||
let rule = rssDownloaderRulesTable.rows[lastSelectedRow].full_data.name;
|
let rule = rssDownloaderRulesTable.rows[lastSelectedRow].full_data.name;
|
||||||
|
|
||||||
rulesList[rule].useRegex = $('useRegEx').checked;
|
rulesList[rule].useRegex = $("useRegEx").checked;
|
||||||
rulesList[rule].mustContain = $('mustContainText').value;
|
rulesList[rule].mustContain = $("mustContainText").value;
|
||||||
rulesList[rule].mustNotContain = $('mustNotContainText').value;
|
rulesList[rule].mustNotContain = $("mustNotContainText").value;
|
||||||
rulesList[rule].episodeFilter = $('episodeFilterText').value;
|
rulesList[rule].episodeFilter = $("episodeFilterText").value;
|
||||||
rulesList[rule].smartFilter = $('useSmartFilter').checked;
|
rulesList[rule].smartFilter = $("useSmartFilter").checked;
|
||||||
rulesList[rule].ignoreDays = parseInt($('ignoreDaysValue').value);
|
rulesList[rule].ignoreDays = parseInt($("ignoreDaysValue").value);
|
||||||
rulesList[rule].affectedFeeds = rssDownloaderFeedSelectionTable.rows.filter((row) => row.full_data.checked)
|
rulesList[rule].affectedFeeds = rssDownloaderFeedSelectionTable.rows.filter((row) => row.full_data.checked)
|
||||||
.map((row) => row.full_data.url)
|
.map((row) => row.full_data.url)
|
||||||
.getValues();
|
.getValues();
|
||||||
|
|
||||||
rulesList[rule].torrentParams.category = $('assignCategoryCombobox').value;
|
rulesList[rule].torrentParams.category = $("assignCategoryCombobox").value;
|
||||||
rulesList[rule].torrentParams.tags = $('ruleAddTags').value.split(',');
|
rulesList[rule].torrentParams.tags = $("ruleAddTags").value.split(",");
|
||||||
if ($('savetoDifferentDir').checked) {
|
if ($("savetoDifferentDir").checked) {
|
||||||
rulesList[rule].torrentParams.save_path = $('saveToText').value;
|
rulesList[rule].torrentParams.save_path = $("saveToText").value;
|
||||||
rulesList[rule].torrentParams.use_auto_tmm = false;
|
rulesList[rule].torrentParams.use_auto_tmm = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($('addStoppedCombobox').value) {
|
switch ($("addStoppedCombobox").value) {
|
||||||
case 'default':
|
case "default":
|
||||||
rulesList[rule].torrentParams.stopped = null;
|
rulesList[rule].torrentParams.stopped = null;
|
||||||
break;
|
break;
|
||||||
case 'always':
|
case "always":
|
||||||
rulesList[rule].torrentParams.stopped = true;
|
rulesList[rule].torrentParams.stopped = true;
|
||||||
break;
|
break;
|
||||||
case 'never':
|
case "never":
|
||||||
rulesList[rule].torrentParams.stopped = false;
|
rulesList[rule].torrentParams.stopped = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($('contentLayoutCombobox').value) {
|
switch ($("contentLayoutCombobox").value) {
|
||||||
case 'Default':
|
case "Default":
|
||||||
rulesList[rule].torrentParams.content_layout = null;
|
rulesList[rule].torrentParams.content_layout = null;
|
||||||
break;
|
break;
|
||||||
case 'Original':
|
case "Original":
|
||||||
rulesList[rule].torrentParams.content_layout = 'Original';
|
rulesList[rule].torrentParams.content_layout = "Original";
|
||||||
break;
|
break;
|
||||||
case 'Subfolder':
|
case "Subfolder":
|
||||||
rulesList[rule].torrentParams.content_layout = 'Subfolder';
|
rulesList[rule].torrentParams.content_layout = "Subfolder";
|
||||||
break;
|
break;
|
||||||
case 'NoSubfolder':
|
case "NoSubfolder":
|
||||||
rulesList[rule].torrentParams.content_layout = 'NoSubfolder';
|
rulesList[rule].torrentParams.content_layout = "NoSubfolder";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/rss/setRule',
|
url: "api/v2/rss/setRule",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
ruleName: rule,
|
ruleName: rule,
|
||||||
ruleDef: JSON.stringify(rulesList[rule])
|
ruleDef: JSON.stringify(rulesList[rule])
|
||||||
|
@ -631,8 +631,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
|
|
||||||
const updateMatchingArticles = (ruleName) => {
|
const updateMatchingArticles = (ruleName) => {
|
||||||
new Request.JSON({
|
new Request.JSON({
|
||||||
url: 'api/v2/rss/matchingArticles',
|
url: "api/v2/rss/matchingArticles",
|
||||||
method: 'get',
|
method: "get",
|
||||||
noCache: true,
|
noCache: true,
|
||||||
data: {
|
data: {
|
||||||
ruleName: ruleName
|
ruleName: ruleName
|
||||||
|
@ -660,91 +660,91 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
};
|
};
|
||||||
|
|
||||||
const showRule = (ruleName) => {
|
const showRule = (ruleName) => {
|
||||||
if (ruleName === '') {
|
if (ruleName === "") {
|
||||||
// disable all
|
// disable all
|
||||||
$('saveButton').disabled = true;
|
$("saveButton").disabled = true;
|
||||||
$('useRegEx').disabled = true;
|
$("useRegEx").disabled = true;
|
||||||
$('mustContainText').disabled = true;
|
$("mustContainText").disabled = true;
|
||||||
$('mustNotContainText').disabled = true;
|
$("mustNotContainText").disabled = true;
|
||||||
$('episodeFilterText').disabled = true;
|
$("episodeFilterText").disabled = true;
|
||||||
$('useSmartFilter').disabled = true;
|
$("useSmartFilter").disabled = true;
|
||||||
$('assignCategoryCombobox').disabled = true;
|
$("assignCategoryCombobox").disabled = true;
|
||||||
$('ruleAddTags').disabled = true;
|
$("ruleAddTags").disabled = true;
|
||||||
$('savetoDifferentDir').disabled = true;
|
$("savetoDifferentDir").disabled = true;
|
||||||
$('saveToText').disabled = true;
|
$("saveToText").disabled = true;
|
||||||
$('ignoreDaysValue').disabled = true;
|
$("ignoreDaysValue").disabled = true;
|
||||||
$('addStoppedCombobox').disabled = true;
|
$("addStoppedCombobox").disabled = true;
|
||||||
$('contentLayoutCombobox').disabled = true;
|
$("contentLayoutCombobox").disabled = true;
|
||||||
|
|
||||||
// reset all boxes
|
// reset all boxes
|
||||||
$('useRegEx').checked = false;
|
$("useRegEx").checked = false;
|
||||||
$('mustContainText').value = '';
|
$("mustContainText").value = "";
|
||||||
$('mustNotContainText').value = '';
|
$("mustNotContainText").value = "";
|
||||||
$('episodeFilterText').value = '';
|
$("episodeFilterText").value = "";
|
||||||
$('useSmartFilter').checked = false;
|
$("useSmartFilter").checked = false;
|
||||||
$('assignCategoryCombobox').value = 'default';
|
$("assignCategoryCombobox").value = "default";
|
||||||
$('ruleAddTags').value = '';
|
$("ruleAddTags").value = "";
|
||||||
$('savetoDifferentDir').checked = false;
|
$("savetoDifferentDir").checked = false;
|
||||||
$('saveToText').value = '';
|
$("saveToText").value = "";
|
||||||
$('ignoreDaysValue').value = 0;
|
$("ignoreDaysValue").value = 0;
|
||||||
$('lastMatchText').textContent = 'QBT_TR(Last Match: Unknown)QBT_TR[CONTEXT=AutomatedRssDownloader]';
|
$("lastMatchText").textContent = "QBT_TR(Last Match: Unknown)QBT_TR[CONTEXT=AutomatedRssDownloader]";
|
||||||
$('addStoppedCombobox').value = 'default';
|
$("addStoppedCombobox").value = "default";
|
||||||
$('contentLayoutCombobox').value = 'Default';
|
$("contentLayoutCombobox").value = "Default";
|
||||||
rssDownloaderFeedSelectionTable.clear();
|
rssDownloaderFeedSelectionTable.clear();
|
||||||
rssDownloaderArticlesTable.clear();
|
rssDownloaderArticlesTable.clear();
|
||||||
|
|
||||||
$('mustContainText').title = '';
|
$("mustContainText").title = "";
|
||||||
$('mustNotContainText').title = '';
|
$("mustNotContainText").title = "";
|
||||||
$('episodeFilterText').title = '';
|
$("episodeFilterText").title = "";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// enable all
|
// enable all
|
||||||
$('saveButton').disabled = false;
|
$("saveButton").disabled = false;
|
||||||
$('useRegEx').disabled = false;
|
$("useRegEx").disabled = false;
|
||||||
$('mustContainText').disabled = false;
|
$("mustContainText").disabled = false;
|
||||||
$('mustNotContainText').disabled = false;
|
$("mustNotContainText").disabled = false;
|
||||||
$('episodeFilterText').disabled = false;
|
$("episodeFilterText").disabled = false;
|
||||||
$('useSmartFilter').disabled = false;
|
$("useSmartFilter").disabled = false;
|
||||||
$('assignCategoryCombobox').disabled = false;
|
$("assignCategoryCombobox").disabled = false;
|
||||||
$('ruleAddTags').disabled = false;
|
$("ruleAddTags").disabled = false;
|
||||||
$('savetoDifferentDir').disabled = false;
|
$("savetoDifferentDir").disabled = false;
|
||||||
$('ignoreDaysValue').disabled = false;
|
$("ignoreDaysValue").disabled = false;
|
||||||
$('addStoppedCombobox').disabled = false;
|
$("addStoppedCombobox").disabled = false;
|
||||||
$('contentLayoutCombobox').disabled = false;
|
$("contentLayoutCombobox").disabled = false;
|
||||||
|
|
||||||
// load rule settings
|
// load rule settings
|
||||||
$('useRegEx').checked = rulesList[ruleName].useRegex;
|
$("useRegEx").checked = rulesList[ruleName].useRegex;
|
||||||
$('mustContainText').value = rulesList[ruleName].mustContain;
|
$("mustContainText").value = rulesList[ruleName].mustContain;
|
||||||
$('mustNotContainText').value = rulesList[ruleName].mustNotContain;
|
$("mustNotContainText").value = rulesList[ruleName].mustNotContain;
|
||||||
$('episodeFilterText').value = rulesList[ruleName].episodeFilter;
|
$("episodeFilterText").value = rulesList[ruleName].episodeFilter;
|
||||||
$('useSmartFilter').checked = rulesList[ruleName].smartFilter;
|
$("useSmartFilter").checked = rulesList[ruleName].smartFilter;
|
||||||
|
|
||||||
$('assignCategoryCombobox').value = rulesList[ruleName].torrentParams.category ? rulesList[ruleName].torrentParams.category : 'default';
|
$("assignCategoryCombobox").value = rulesList[ruleName].torrentParams.category ? rulesList[ruleName].torrentParams.category : "default";
|
||||||
$('ruleAddTags').value = rulesList[ruleName].torrentParams.tags.join(',');
|
$("ruleAddTags").value = rulesList[ruleName].torrentParams.tags.join(",");
|
||||||
$('savetoDifferentDir').checked = rulesList[ruleName].torrentParams.save_path !== '';
|
$("savetoDifferentDir").checked = rulesList[ruleName].torrentParams.save_path !== "";
|
||||||
$('saveToText').disabled = !$('savetoDifferentDir').checked;
|
$("saveToText").disabled = !$("savetoDifferentDir").checked;
|
||||||
$('saveToText').value = rulesList[ruleName].torrentParams.save_path;
|
$("saveToText").value = rulesList[ruleName].torrentParams.save_path;
|
||||||
$('ignoreDaysValue').value = rulesList[ruleName].ignoreDays;
|
$("ignoreDaysValue").value = rulesList[ruleName].ignoreDays;
|
||||||
|
|
||||||
// calculate days since last match
|
// calculate days since last match
|
||||||
if (rulesList[ruleName].lastMatch !== '') {
|
if (rulesList[ruleName].lastMatch !== "") {
|
||||||
let timeDiffInMs = new Date().getTime() - new Date(rulesList[ruleName].lastMatch).getTime();
|
let timeDiffInMs = new Date().getTime() - new Date(rulesList[ruleName].lastMatch).getTime();
|
||||||
let daysAgo = Math.floor(timeDiffInMs / (1000 * 60 * 60 * 24)).toString();
|
let daysAgo = Math.floor(timeDiffInMs / (1000 * 60 * 60 * 24)).toString();
|
||||||
$('lastMatchText').textContent = ' QBT_TR(Last Match: %1 days ago)QBT_TR[CONTEXT=AutomatedRssDownloader]'.replace('%1', daysAgo);
|
$("lastMatchText").textContent = " QBT_TR(Last Match: %1 days ago)QBT_TR[CONTEXT=AutomatedRssDownloader]".replace("%1", daysAgo);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('lastMatchText').textContent = 'QBT_TR(Last Match: Unknown)QBT_TR[CONTEXT=AutomatedRssDownloader]';
|
$("lastMatchText").textContent = "QBT_TR(Last Match: Unknown)QBT_TR[CONTEXT=AutomatedRssDownloader]";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rulesList[ruleName].torrentParams.stopped === null)
|
if (rulesList[ruleName].torrentParams.stopped === null)
|
||||||
$('addStoppedCombobox').value = 'default';
|
$("addStoppedCombobox").value = "default";
|
||||||
else
|
else
|
||||||
$('addStoppedCombobox').value = rulesList[ruleName].torrentParams.stopped ? 'always' : 'never';
|
$("addStoppedCombobox").value = rulesList[ruleName].torrentParams.stopped ? "always" : "never";
|
||||||
|
|
||||||
if (rulesList[ruleName].torrentParams.content_layout === null)
|
if (rulesList[ruleName].torrentParams.content_layout === null)
|
||||||
$('contentLayoutCombobox').value = 'Default';
|
$("contentLayoutCombobox").value = "Default";
|
||||||
else
|
else
|
||||||
$('contentLayoutCombobox').value = rulesList[ruleName].torrentParams.content_layout;
|
$("contentLayoutCombobox").value = rulesList[ruleName].torrentParams.content_layout;
|
||||||
|
|
||||||
setElementTitles();
|
setElementTitles();
|
||||||
|
|
||||||
|
@ -765,38 +765,38 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
|
|
||||||
const setElementTitles = () => {
|
const setElementTitles = () => {
|
||||||
let mainPart;
|
let mainPart;
|
||||||
if ($('useRegEx').checked) {
|
if ($("useRegEx").checked) {
|
||||||
mainPart = 'QBT_TR(Regex mode: use Perl-compatible regular expressions)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n';
|
mainPart = "QBT_TR(Regex mode: use Perl-compatible regular expressions)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mainPart = 'QBT_TR(Wildcard mode: you can use)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n'
|
mainPart = "QBT_TR(Wildcard mode: you can use)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n"
|
||||||
+ ' ● QBT_TR(? to match any single character)QBT_TR[CONTEXT=AutomatedRssDownloader]\n'
|
+ " ● QBT_TR(? to match any single character)QBT_TR[CONTEXT=AutomatedRssDownloader]\n"
|
||||||
+ ' ● QBT_TR(* to match zero or more of any characters)QBT_TR[CONTEXT=AutomatedRssDownloader]\n'
|
+ " ● QBT_TR(* to match zero or more of any characters)QBT_TR[CONTEXT=AutomatedRssDownloader]\n"
|
||||||
+ ' ● QBT_TR(Whitespaces count as AND operators (all words, any order))QBT_TR[CONTEXT=AutomatedRssDownloader]\n'
|
+ " ● QBT_TR(Whitespaces count as AND operators (all words, any order))QBT_TR[CONTEXT=AutomatedRssDownloader]\n"
|
||||||
+ ' ● QBT_TR(| is used as OR operator)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n'
|
+ " ● QBT_TR(| is used as OR operator)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n"
|
||||||
+ 'QBT_TR(If word order is important use * instead of whitespace.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n';
|
+ "QBT_TR(If word order is important use * instead of whitespace.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n";
|
||||||
}
|
}
|
||||||
let secondPart = 'QBT_TR(An expression with an empty %1 clause (e.g. %2))QBT_TR[CONTEXT=AutomatedRssDownloader]'
|
let secondPart = "QBT_TR(An expression with an empty %1 clause (e.g. %2))QBT_TR[CONTEXT=AutomatedRssDownloader]"
|
||||||
.replace('%1', '|').replace('%2', 'expr|');
|
.replace("%1", "|").replace("%2", "expr|");
|
||||||
|
|
||||||
$('mustContainText').title = mainPart + secondPart + 'QBT_TR( will match all articles.)QBT_TR[CONTEXT=AutomatedRssDownloader]';
|
$("mustContainText").title = mainPart + secondPart + "QBT_TR( will match all articles.)QBT_TR[CONTEXT=AutomatedRssDownloader]";
|
||||||
$('mustNotContainText').title = mainPart + secondPart + 'QBT_TR( will exclude all articles.)QBT_TR[CONTEXT=AutomatedRssDownloader]';
|
$("mustNotContainText").title = mainPart + secondPart + "QBT_TR( will exclude all articles.)QBT_TR[CONTEXT=AutomatedRssDownloader]";
|
||||||
|
|
||||||
let episodeFilterTitle = 'QBT_TR(Matches articles based on episode filter.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n'
|
let episodeFilterTitle = "QBT_TR(Matches articles based on episode filter.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n"
|
||||||
+ 'QBT_TR(Example: )QBT_TR[CONTEXT=AutomatedRssDownloader]'
|
+ "QBT_TR(Example: )QBT_TR[CONTEXT=AutomatedRssDownloader]"
|
||||||
+ '1x2;8-15;5;30-;'
|
+ "1x2;8-15;5;30-;"
|
||||||
+ 'QBT_TR( will match 2, 5, 8 through 15, 30 and onward episodes of season one)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n'
|
+ "QBT_TR( will match 2, 5, 8 through 15, 30 and onward episodes of season one)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n"
|
||||||
+ 'QBT_TR(Episode filter rules: )QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n'
|
+ "QBT_TR(Episode filter rules: )QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n"
|
||||||
+ ' ● QBT_TR(Season number is a mandatory non-zero value)QBT_TR[CONTEXT=AutomatedRssDownloader]\n'
|
+ " ● QBT_TR(Season number is a mandatory non-zero value)QBT_TR[CONTEXT=AutomatedRssDownloader]\n"
|
||||||
+ ' ● QBT_TR(Episode number is a mandatory positive value)QBT_TR[CONTEXT=AutomatedRssDownloader]\n'
|
+ " ● QBT_TR(Episode number is a mandatory positive value)QBT_TR[CONTEXT=AutomatedRssDownloader]\n"
|
||||||
+ ' ● QBT_TR(Filter must end with semicolon)QBT_TR[CONTEXT=AutomatedRssDownloader]\n'
|
+ " ● QBT_TR(Filter must end with semicolon)QBT_TR[CONTEXT=AutomatedRssDownloader]\n"
|
||||||
+ ' ● QBT_TR(Three range types for episodes are supported: )QBT_TR[CONTEXT=AutomatedRssDownloader]\n'
|
+ " ● QBT_TR(Three range types for episodes are supported: )QBT_TR[CONTEXT=AutomatedRssDownloader]\n"
|
||||||
+ ' ● QBT_TR(Single number: <b>1x25;</b> matches episode 25 of season one)QBT_TR[CONTEXT=AutomatedRssDownloader]\n'
|
+ " ● QBT_TR(Single number: <b>1x25;</b> matches episode 25 of season one)QBT_TR[CONTEXT=AutomatedRssDownloader]\n"
|
||||||
+ ' ● QBT_TR(Normal range: <b>1x25-40;</b> matches episodes 25 through 40 of season one)QBT_TR[CONTEXT=AutomatedRssDownloader]\n'
|
+ " ● QBT_TR(Normal range: <b>1x25-40;</b> matches episodes 25 through 40 of season one)QBT_TR[CONTEXT=AutomatedRssDownloader]\n"
|
||||||
+ ' ● QBT_TR(Infinite range: <b>1x25-;</b> matches episodes 25 and upward of season one, and all episodes of later seasons)QBT_TR[CONTEXT=AutomatedRssDownloader]';
|
+ " ● QBT_TR(Infinite range: <b>1x25-;</b> matches episodes 25 and upward of season one, and all episodes of later seasons)QBT_TR[CONTEXT=AutomatedRssDownloader]";
|
||||||
|
|
||||||
episodeFilterTitle = episodeFilterTitle.replace(/<b>/g, '').replace(/<\/b>/g, '');
|
episodeFilterTitle = episodeFilterTitle.replace(/<b>/g, "").replace(/<\/b>/g, "");
|
||||||
$('episodeFilterText').title = episodeFilterTitle;
|
$("episodeFilterText").title = episodeFilterTitle;
|
||||||
};
|
};
|
||||||
|
|
||||||
initRssDownloader();
|
initRssDownloader();
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -101,15 +101,15 @@
|
||||||
const initSearchPlugins = function() {
|
const initSearchPlugins = function() {
|
||||||
searchPluginsTable = new window.qBittorrent.DynamicTable.SearchPluginsTable();
|
searchPluginsTable = new window.qBittorrent.DynamicTable.SearchPluginsTable();
|
||||||
searchPluginsTableContextMenu = new window.qBittorrent.ContextMenu.SearchPluginsTableContextMenu({
|
searchPluginsTableContextMenu = new window.qBittorrent.ContextMenu.SearchPluginsTableContextMenu({
|
||||||
targets: '.searchPluginsTableRow',
|
targets: ".searchPluginsTableRow",
|
||||||
menu: 'searchPluginsTableMenu',
|
menu: "searchPluginsTableMenu",
|
||||||
actions: {
|
actions: {
|
||||||
Enabled: enablePlugin,
|
Enabled: enablePlugin,
|
||||||
Uninstall: uninstallPlugin
|
Uninstall: uninstallPlugin
|
||||||
},
|
},
|
||||||
offsets: calculateContextMenuOffsets()
|
offsets: calculateContextMenuOffsets()
|
||||||
});
|
});
|
||||||
searchPluginsTable.setup('searchPluginsTableDiv', 'searchPluginsTableFixedHeaderDiv', searchPluginsTableContextMenu);
|
searchPluginsTable.setup("searchPluginsTableDiv", "searchPluginsTableFixedHeaderDiv", searchPluginsTableContextMenu);
|
||||||
updateTable();
|
updateTable();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -119,10 +119,10 @@
|
||||||
|
|
||||||
const installPlugin = function(path) {
|
const 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]",
|
||||||
loadMethod: 'xhr',
|
loadMethod: "xhr",
|
||||||
contentURL: 'views/installsearchplugin.html',
|
contentURL: "views/installsearchplugin.html",
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -134,11 +134,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const uninstallPlugin = function() {
|
const uninstallPlugin = function() {
|
||||||
const plugins = searchPluginsTable.selectedRowsIds().join('|');
|
const plugins = searchPluginsTable.selectedRowsIds().join("|");
|
||||||
const url = new URI('api/v2/search/uninstallPlugin');
|
const url = new URI("api/v2/search/uninstallPlugin");
|
||||||
new Request({
|
new Request({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
names: plugins,
|
names: plugins,
|
||||||
}
|
}
|
||||||
|
@ -151,22 +151,22 @@
|
||||||
if (plugins && plugins.length)
|
if (plugins && plugins.length)
|
||||||
enable = !window.qBittorrent.Search.getPlugin(plugins[0]).enabled;
|
enable = !window.qBittorrent.Search.getPlugin(plugins[0]).enabled;
|
||||||
|
|
||||||
const url = new URI('api/v2/search/enablePlugin');
|
const url = new URI("api/v2/search/enablePlugin");
|
||||||
new Request({
|
new Request({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: {
|
data: {
|
||||||
names: plugins.join('|'),
|
names: plugins.join("|"),
|
||||||
enable: enable
|
enable: enable
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkForUpdates = function() {
|
const checkForUpdates = function() {
|
||||||
const url = new URI('api/v2/search/updatePlugins');
|
const url = new URI("api/v2/search/updatePlugins");
|
||||||
new Request({
|
new Request({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'post'
|
method: "post"
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -189,13 +189,13 @@
|
||||||
const setupSearchPluginTableEvents = function(enable) {
|
const 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);
|
||||||
target.addEventListener('contextmenu', updateSearchPluginsTableContextMenuOffset, true);
|
target.addEventListener("contextmenu", updateSearchPluginsTableContextMenuOffset, true);
|
||||||
});
|
});
|
||||||
else
|
else
|
||||||
$$(".searchPluginsTableRow").each(function(target) {
|
$$(".searchPluginsTableRow").each(function(target) {
|
||||||
target.removeEventListener('dblclick', enablePlugin, false);
|
target.removeEventListener("dblclick", enablePlugin, false);
|
||||||
target.removeEventListener('contextmenu', updateSearchPluginsTableContextMenuOffset, true);
|
target.removeEventListener("contextmenu", updateSearchPluginsTableContextMenuOffset, true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
if (window.qBittorrent === undefined) {
|
if (window.qBittorrent === undefined) {
|
||||||
window.qBittorrent = {};
|
window.qBittorrent = {};
|
||||||
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
//create a context menu
|
//create a context menu
|
||||||
const contextMenu = new window.qBittorrent.ContextMenu.TorrentsTableContextMenu({
|
const contextMenu = new window.qBittorrent.ContextMenu.TorrentsTableContextMenu({
|
||||||
targets: '.torrentsTableContextMenuTarget',
|
targets: ".torrentsTableContextMenuTarget",
|
||||||
menu: 'torrentsTableMenu',
|
menu: "torrentsTableMenu",
|
||||||
actions: {
|
actions: {
|
||||||
start: function(element, ref) {
|
start: function(element, ref) {
|
||||||
startFN();
|
startFN();
|
||||||
|
@ -59,16 +59,16 @@
|
||||||
renameFilesFN();
|
renameFilesFN();
|
||||||
},
|
},
|
||||||
queueTop: function(element, ref) {
|
queueTop: function(element, ref) {
|
||||||
setQueuePositionFN('topPrio');
|
setQueuePositionFN("topPrio");
|
||||||
},
|
},
|
||||||
queueUp: function(element, ref) {
|
queueUp: function(element, ref) {
|
||||||
setQueuePositionFN('increasePrio');
|
setQueuePositionFN("increasePrio");
|
||||||
},
|
},
|
||||||
queueDown: function(element, ref) {
|
queueDown: function(element, ref) {
|
||||||
setQueuePositionFN('decreasePrio');
|
setQueuePositionFN("decreasePrio");
|
||||||
},
|
},
|
||||||
queueBottom: function(element, ref) {
|
queueBottom: function(element, ref) {
|
||||||
setQueuePositionFN('bottomPrio');
|
setQueuePositionFN("bottomPrio");
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadLimit: function(element, ref) {
|
downloadLimit: function(element, ref) {
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
superSeeding: function(element, ref) {
|
superSeeding: function(element, ref) {
|
||||||
setSuperSeedingFN(!ref.getItemChecked('superSeeding'));
|
setSuperSeedingFN(!ref.getItemChecked("superSeeding"));
|
||||||
},
|
},
|
||||||
|
|
||||||
exportTorrent: function(element, ref) {
|
exportTorrent: function(element, ref) {
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
torrentsTable.setup('torrentsTableDiv', 'torrentsTableFixedHeaderDiv', contextMenu);
|
torrentsTable.setup("torrentsTableDiv", "torrentsTableFixedHeaderDiv", contextMenu);
|
||||||
|
|
||||||
return exports();
|
return exports();
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -26,31 +26,31 @@
|
||||||
* exception statement from your version.
|
* exception statement from your version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
async function setupI18n() {
|
async function setupI18n() {
|
||||||
const languages = (() => {
|
const languages = (() => {
|
||||||
const langs = new Set();
|
const langs = new Set();
|
||||||
|
|
||||||
// list of available languages: https://github.com/qbittorrent/qBittorrent/tree/master/src/webui/www/public/lang
|
// list of available languages: https://github.com/qbittorrent/qBittorrent/tree/master/src/webui/www/public/lang
|
||||||
const queryLang = new URLSearchParams(window.location.search).get('lang');
|
const queryLang = new URLSearchParams(window.location.search).get("lang");
|
||||||
if (queryLang !== null) {
|
if (queryLang !== null) {
|
||||||
// use the fallback lang if `queryLang` is present but empty
|
// use the fallback lang if `queryLang` is present but empty
|
||||||
// limit the length of the language string to prevent Client-side Request Forgery
|
// limit the length of the language string to prevent Client-side Request Forgery
|
||||||
if ((queryLang.length > 0) && (queryLang.length <= 8))
|
if ((queryLang.length > 0) && (queryLang.length <= 8))
|
||||||
langs.add(queryLang.replace('-', '_'));
|
langs.add(queryLang.replace("-", "_"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (const lang of navigator.languages) {
|
for (const lang of navigator.languages) {
|
||||||
langs.add(lang.replace('-', '_'));
|
langs.add(lang.replace("-", "_"));
|
||||||
|
|
||||||
const idx = lang.indexOf('-');
|
const idx = lang.indexOf("-");
|
||||||
if (idx > 0)
|
if (idx > 0)
|
||||||
langs.add(lang.slice(0, idx));
|
langs.add(lang.slice(0, idx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
langs.add('en'); // fallback
|
langs.add("en"); // fallback
|
||||||
return Array.from(langs);
|
return Array.from(langs);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ async function setupI18n() {
|
||||||
.map((value, idx) => ({ lang: languages[idx], result: value }))
|
.map((value, idx) => ({ lang: languages[idx], result: value }))
|
||||||
.filter(v => (v.result.value.status === 200));
|
.filter(v => (v.result.value.status === 200));
|
||||||
const translation = {
|
const translation = {
|
||||||
lang: (translations.length > 0) ? translations[0].lang.replace('_', '-') : undefined,
|
lang: (translations.length > 0) ? translations[0].lang.replace("_", "-") : undefined,
|
||||||
data: (translations.length > 0) ? (await translations[0].result.value.json()) : {}
|
data: (translations.length > 0) ? (await translations[0].result.value.json()) : {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ async function setupI18n() {
|
||||||
const i18nextOptions = {
|
const i18nextOptions = {
|
||||||
lng: translation.lang,
|
lng: translation.lang,
|
||||||
fallbackLng: false,
|
fallbackLng: false,
|
||||||
load: 'currentOnly',
|
load: "currentOnly",
|
||||||
resources: {
|
resources: {
|
||||||
[translation.lang]: { translation: translation.data }
|
[translation.lang]: { translation: translation.data }
|
||||||
},
|
},
|
||||||
|
@ -80,14 +80,14 @@ async function setupI18n() {
|
||||||
|
|
||||||
function replaceI18nText() {
|
function replaceI18nText() {
|
||||||
const tr = i18next.t; // workaround for warnings from i18next-parser
|
const tr = i18next.t; // workaround for warnings from i18next-parser
|
||||||
for (const element of document.getElementsByClassName('qbt-translatable')) {
|
for (const element of document.getElementsByClassName("qbt-translatable")) {
|
||||||
const translationKey = element.getAttribute('data-i18n');
|
const translationKey = element.getAttribute("data-i18n");
|
||||||
const translatedValue = tr(translationKey);
|
const translatedValue = tr(translationKey);
|
||||||
switch (element.nodeName) {
|
switch (element.nodeName) {
|
||||||
case 'INPUT':
|
case "INPUT":
|
||||||
element.value = translatedValue;
|
element.value = translatedValue;
|
||||||
break;
|
break;
|
||||||
case 'LABEL':
|
case "LABEL":
|
||||||
element.textContent = translatedValue;
|
element.textContent = translatedValue;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -96,43 +96,43 @@ function replaceI18nText() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.documentElement.lang = i18next.language.split('-')[0];
|
document.documentElement.lang = i18next.language.split("-")[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitLoginForm(event) {
|
function submitLoginForm(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const errorMsgElement = document.getElementById('error_msg');
|
const errorMsgElement = document.getElementById("error_msg");
|
||||||
|
|
||||||
const 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', () => {
|
xhr.addEventListener("readystatechange", () => {
|
||||||
if (xhr.readyState === 4) { // DONE state
|
if (xhr.readyState === 4) { // DONE state
|
||||||
if ((xhr.status === 200) && (xhr.responseText === "Ok."))
|
if ((xhr.status === 200) && (xhr.responseText === "Ok."))
|
||||||
location.replace(location);
|
location.replace(location);
|
||||||
else
|
else
|
||||||
errorMsgElement.textContent = i18next.t('Invalid Username or Password.');
|
errorMsgElement.textContent = i18next.t("Invalid Username or Password.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
xhr.addEventListener('error', () => {
|
xhr.addEventListener("error", () => {
|
||||||
errorMsgElement.textContent = (xhr.responseText !== "")
|
errorMsgElement.textContent = (xhr.responseText !== "")
|
||||||
? xhr.responseText
|
? xhr.responseText
|
||||||
: i18next.t('Unable to log in, server is probably unreachable.');
|
: i18next.t("Unable to log in, server is probably unreachable.");
|
||||||
});
|
});
|
||||||
|
|
||||||
const usernameElement = document.getElementById('username');
|
const usernameElement = document.getElementById("username");
|
||||||
const passwordElement = document.getElementById('password');
|
const passwordElement = document.getElementById("password");
|
||||||
const 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
|
||||||
passwordElement.value = '';
|
passwordElement.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
const loginForm = document.getElementById('loginform');
|
const loginForm = document.getElementById("loginform");
|
||||||
loginForm.setAttribute('method', 'POST');
|
loginForm.setAttribute("method", "POST");
|
||||||
loginForm.addEventListener('submit', submitLoginForm);
|
loginForm.addEventListener("submit", submitLoginForm);
|
||||||
|
|
||||||
setupI18n();
|
setupI18n();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue