mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-10 01:22:31 -06:00
WebUI: use template literals instead of string concatenation
PR #22177.
This commit is contained in:
@@ -1824,42 +1824,42 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
|
||||
const addWatchFolder = (folder = "", sel = "default_folder", other = "") => {
|
||||
const pos = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
|
||||
const myinput = "<input id='text_watch_" + pos + "' type='text' value='" + folder + "'>";
|
||||
const myinput = `<input id='text_watch_${pos}' type='text' value='${folder}'>`;
|
||||
const disableInput = (sel !== "other");
|
||||
const mycb = "<div class='select-watched-folder-editable'>"
|
||||
+ "<select id ='cb_watch_" + pos + "' onchange='qBittorrent.Preferences.changeWatchFolderSelect(this)'>"
|
||||
+ "<option value='watch_folder'>QBT_TR(Monitored folder)QBT_TR[CONTEXT=ScanFoldersModel]</option>"
|
||||
+ "<option value='default_folder'>QBT_TR(Default save location)QBT_TR[CONTEXT=ScanFoldersModel]</option>"
|
||||
+ "<option value='other'>QBT_TR(Other...)QBT_TR[CONTEXT=ScanFoldersModel]</option>"
|
||||
+ "</select>"
|
||||
+ "<input id='cb_watch_txt_" + pos + "' type='text' " + (disableInput ? "hidden " : "") + "/>"
|
||||
+ "<img src='images/list-add.svg' id='addFolderImg_" + pos + "' alt='Add' style='padding-left:170px;width:16px;cursor:pointer;' onclick='qBittorrent.Preferences.addWatchFolder();'>"
|
||||
+ "</div>";
|
||||
const mycb = `<div class='select-watched-folder-editable'>`
|
||||
+ `<select id ='cb_watch_${pos}' onchange='qBittorrent.Preferences.changeWatchFolderSelect(this);'>`
|
||||
+ `<option value='watch_folder'>QBT_TR(Monitored folder)QBT_TR[CONTEXT=ScanFoldersModel]</option>`
|
||||
+ `<option value='default_folder'>QBT_TR(Default save location)QBT_TR[CONTEXT=ScanFoldersModel]</option>`
|
||||
+ `<option value='other'>QBT_TR(Other...)QBT_TR[CONTEXT=ScanFoldersModel]</option>`
|
||||
+ `</select>`
|
||||
+ `<input id='cb_watch_txt_${pos}' type='text' ${disableInput ? "hidden " : ""}/>`
|
||||
+ `<img src='images/list-add.svg' id='addFolderImg_${pos}' alt='Add' style='padding-left:170px;width:16px;cursor:pointer;' onclick='qBittorrent.Preferences.addWatchFolder();'>`
|
||||
+ `</div>`;
|
||||
|
||||
watchedFoldersTable.push([myinput, mycb]);
|
||||
$("cb_watch_" + pos).value = sel;
|
||||
$(`cb_watch_${pos}`).value = sel;
|
||||
if (disableInput) {
|
||||
const elt = $("cb_watch_" + pos);
|
||||
const elt = $(`cb_watch_${pos}`);
|
||||
other = elt.options[elt.selectedIndex].textContent;
|
||||
}
|
||||
$("cb_watch_txt_" + pos).value = other;
|
||||
$(`cb_watch_txt_${pos}`).value = other;
|
||||
|
||||
// hide previous img
|
||||
if (pos > 0)
|
||||
$("addFolderImg_" + (pos - 1)).style.display = "none";
|
||||
$(`addFolderImg_${pos - 1}`).style.display = "none";
|
||||
};
|
||||
|
||||
const getWatchedFolders = () => {
|
||||
const nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
|
||||
const folders = new Hash();
|
||||
for (let i = 0; i < nb_folders; ++i) {
|
||||
const fpath = $("text_watch_" + i).value.trim();
|
||||
const fpath = $(`text_watch_${i}`).value.trim();
|
||||
if (fpath.length > 0) {
|
||||
const sel = $("cb_watch_" + i).value.trim();
|
||||
const sel = $(`cb_watch_${i}`).value.trim();
|
||||
|
||||
let other;
|
||||
if (sel === "other")
|
||||
other = $("cb_watch_txt_" + i).value.trim();
|
||||
other = $(`cb_watch_txt_${i}`).value.trim();
|
||||
else
|
||||
other = (sel === "watch_folder") ? 0 : 1;
|
||||
|
||||
@@ -2096,7 +2096,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
const time_padding = (val) => {
|
||||
let ret = val.toString();
|
||||
if (ret.length === 1)
|
||||
ret = "0" + ret;
|
||||
ret = `0${ret}`;
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@
|
||||
icon: "images/qbittorrent-tray.svg",
|
||||
title: "QBT_TR(Please type a RSS feed URL)QBT_TR[CONTEXT=RSSWidget]",
|
||||
loadMethod: "iframe",
|
||||
contentURL: "newfeed.html?path=" + encodeURIComponent(path),
|
||||
contentURL: `newfeed.html?path=${encodeURIComponent(path)}`,
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
@@ -371,7 +371,7 @@
|
||||
icon: "images/qbittorrent-tray.svg",
|
||||
title: "QBT_TR(Please choose a folder name)QBT_TR[CONTEXT=RSSWidget]",
|
||||
loadMethod: "iframe",
|
||||
contentURL: "newfolder.html?path=" + encodeURIComponent(path),
|
||||
contentURL: `newfolder.html?path=${encodeURIComponent(path)}`,
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
@@ -449,7 +449,7 @@
|
||||
// Place in iframe with sandbox attribute to prevent js execution
|
||||
const torrentDescription = document.createRange().createContextualFragment('<iframe sandbox id="rssDescription"></iframe>');
|
||||
$("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>`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -475,7 +475,7 @@
|
||||
if (!Object.hasOwn(current, child))
|
||||
continue;
|
||||
|
||||
const currentFullName = fullName ? (fullName + "\\" + child) : child;
|
||||
const currentFullName = fullName ? `${fullName}\\${child}` : child;
|
||||
if (current[child].uid !== undefined) {
|
||||
current[child].name = child;
|
||||
current[child].isFolder = false;
|
||||
@@ -733,7 +733,7 @@
|
||||
icon: "images/qbittorrent-tray.svg",
|
||||
title: "QBT_TR(Please choose a new name for this RSS feed)QBT_TR[CONTEXT=RSSWidget]",
|
||||
loadMethod: "iframe",
|
||||
contentURL: "rename_feed.html?oldPath=" + encodeURIComponent(oldPath),
|
||||
contentURL: `rename_feed.html?oldPath=${encodeURIComponent(oldPath)}`,
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
@@ -769,7 +769,7 @@
|
||||
icon: "images/qbittorrent-tray.svg",
|
||||
title: "QBT_TR(Deletion confirmation)QBT_TR[CONTEXT=RSSWidget]",
|
||||
loadMethod: "iframe",
|
||||
contentURL: "confirmfeeddeletion.html?paths=" + encodeURIComponent(encodedPaths.join("|")),
|
||||
contentURL: `confirmfeeddeletion.html?paths=${encodeURIComponent(encodedPaths.join("|"))}`,
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
|
||||
@@ -375,17 +375,17 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||
// recalculate height
|
||||
const warningHeight = $("rssDownloaderDisabled").getBoundingClientRect().height;
|
||||
|
||||
$("leftRssDownloaderColumn").style.height = "calc(100% - " + warningHeight + "px)";
|
||||
$("centerRssDownloaderColumn").style.height = "calc(100% - " + warningHeight + "px)";
|
||||
$("rightRssDownloaderColumn").style.height = "calc(100% - " + warningHeight + "px)";
|
||||
$("leftRssDownloaderColumn").style.height = `calc(100% - ${warningHeight}px)`;
|
||||
$("centerRssDownloaderColumn").style.height = `calc(100% - ${warningHeight}px)`;
|
||||
$("rightRssDownloaderColumn").style.height = `calc(100% - ${warningHeight}px)`;
|
||||
|
||||
$("rulesTable").style.height = "calc(100% - " + $("rulesTableDesc").getBoundingClientRect().height + "px)";
|
||||
$("rssDownloaderArticlesTable").style.height = "calc(100% - " + $("articleTableDesc").getBoundingClientRect().height + "px)";
|
||||
$("rulesTable").style.height = `calc(100% - ${$("rulesTableDesc").getBoundingClientRect().height}px)`;
|
||||
$("rssDownloaderArticlesTable").style.height = `calc(100% - ${$("articleTableDesc").getBoundingClientRect().height}px)`;
|
||||
|
||||
const centerRowNotTableHeight = $("saveButton").getBoundingClientRect().height
|
||||
+ $("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
|
||||
if (navigator.userAgent.toLowerCase().includes("firefox")) {
|
||||
@@ -393,7 +393,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||
}
|
||||
else {
|
||||
const 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({
|
||||
@@ -547,7 +547,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||
icon: "images/qbittorrent-tray.svg",
|
||||
title: "QBT_TR(Rule renaming)QBT_TR[CONTEXT=AutomatedRssDownloader]",
|
||||
loadMethod: "iframe",
|
||||
contentURL: "rename_rule.html?rule=" + encodeURIComponent(rule),
|
||||
contentURL: `rename_rule.html?rule=${encodeURIComponent(rule)}`,
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
@@ -570,7 +570,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||
icon: "images/qbittorrent-tray.svg",
|
||||
title: "QBT_TR(Rule deletion confirmation)QBT_TR[CONTEXT=AutomatedRssDownloader]",
|
||||
loadMethod: "iframe",
|
||||
contentURL: "confirmruledeletion.html?rules=" + encodeURIComponent(encodedRules.join("|")),
|
||||
contentURL: `confirmruledeletion.html?rules=${encodeURIComponent(encodedRules.join("|"))}`,
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
@@ -586,7 +586,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||
icon: "images/qbittorrent-tray.svg",
|
||||
title: "QBT_TR(New rule name)QBT_TR[CONTEXT=AutomatedRssDownloader]",
|
||||
loadMethod: "iframe",
|
||||
contentURL: "confirmruleclear.html?rules=" + encodeURIComponent(encodedRules.join("|")),
|
||||
contentURL: `confirmruleclear.html?rules=${encodeURIComponent(encodedRules.join("|"))}`,
|
||||
scrollbars: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
@@ -818,8 +818,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||
const secondPart = "QBT_TR(An expression with an empty %1 clause (e.g. %2))QBT_TR[CONTEXT=AutomatedRssDownloader]"
|
||||
.replace("%1", "|").replace("%2", "expr|");
|
||||
|
||||
$("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]";
|
||||
$("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]`;
|
||||
|
||||
let episodeFilterTitle = "QBT_TR(Matches articles based on episode filter.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n"
|
||||
+ "QBT_TR(Example: )QBT_TR[CONTEXT=AutomatedRssDownloader]"
|
||||
|
||||
Reference in New Issue
Block a user