WebUI: enforce string quotes coding style

This commit is contained in:
Chocobo1 2024-05-27 22:50:17 +08:00
parent 6d073771ca
commit cb90b6769c
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
58 changed files with 3522 additions and 3514 deletions

View file

@ -21,7 +21,7 @@
* THE SOFTWARE.
*/
'use strict';
"use strict";
if (window.qBittorrent === undefined) {
window.qBittorrent = {};
@ -40,8 +40,8 @@ window.qBittorrent.Download = (function() {
const getCategories = function() {
new Request.JSON({
url: 'api/v2/torrents/categories',
method: 'get',
url: "api/v2/torrents/categories",
method: "get",
noCache: true,
onSuccess: function(data) {
if (data) {
@ -49,9 +49,9 @@ window.qBittorrent.Download = (function() {
for (const i in data) {
const category = data[i];
const option = new Element("option");
option.set('value', category.name);
option.set('html', category.name);
$('categorySelect').appendChild(option);
option.set("value", category.name);
option.set("html", category.name);
$("categorySelect").appendChild(option);
}
}
}
@ -62,36 +62,36 @@ window.qBittorrent.Download = (function() {
const pref = window.parent.qBittorrent.Cache.preferences.get();
defaultSavePath = pref.save_path;
$('savepath').setProperty('value', defaultSavePath);
$('startTorrent').checked = !pref.add_stopped_enabled;
$('addToTopOfQueue').checked = pref.add_to_top_of_queue;
$("savepath").setProperty("value", defaultSavePath);
$("startTorrent").checked = !pref.add_stopped_enabled;
$("addToTopOfQueue").checked = pref.add_to_top_of_queue;
if (pref.auto_tmm_enabled === 1) {
$('autoTMM').selectedIndex = 1;
$('savepath').disabled = true;
$("autoTMM").selectedIndex = 1;
$("savepath").disabled = true;
}
else {
$('autoTMM').selectedIndex = 0;
$("autoTMM").selectedIndex = 0;
}
if (pref.torrent_stop_condition === "MetadataReceived") {
$('stopCondition').selectedIndex = 1;
$("stopCondition").selectedIndex = 1;
}
else if (pref.torrent_stop_condition === "FilesChecked") {
$('stopCondition').selectedIndex = 2;
$("stopCondition").selectedIndex = 2;
}
else {
$('stopCondition').selectedIndex = 0;
$("stopCondition").selectedIndex = 0;
}
if (pref.torrent_content_layout === "Subfolder") {
$('contentLayout').selectedIndex = 1;
$("contentLayout").selectedIndex = 1;
}
else if (pref.torrent_content_layout === "NoSubfolder") {
$('contentLayout').selectedIndex = 2;
$("contentLayout").selectedIndex = 2;
}
else {
$('contentLayout').selectedIndex = 0;
$("contentLayout").selectedIndex = 0;
}
};
@ -101,37 +101,37 @@ window.qBittorrent.Download = (function() {
item.nextElementSibling.value = "";
item.nextElementSibling.select();
if ($('autoTMM').selectedIndex === 1)
$('savepath').value = defaultSavePath;
if ($("autoTMM").selectedIndex === 1)
$("savepath").value = defaultSavePath;
}
else {
item.nextElementSibling.hidden = true;
const text = item.options[item.selectedIndex].textContent;
item.nextElementSibling.value = text;
if ($('autoTMM').selectedIndex === 1) {
if ($("autoTMM").selectedIndex === 1) {
const categoryName = item.value;
const category = categories[categoryName];
let savePath = defaultSavePath;
if (category !== undefined)
savePath = (category['savePath'] !== "") ? category['savePath'] : `${defaultSavePath}/${categoryName}`;
$('savepath').value = savePath;
savePath = (category["savePath"] !== "") ? category["savePath"] : `${defaultSavePath}/${categoryName}`;
$("savepath").value = savePath;
}
}
};
const changeTMM = function(item) {
if (item.selectedIndex === 1) {
$('savepath').disabled = true;
$("savepath").disabled = true;
const categorySelect = $('categorySelect');
const categorySelect = $("categorySelect");
const categoryName = categorySelect.options[categorySelect.selectedIndex].value;
const category = categories[categoryName];
$('savepath').value = (category === undefined) ? "" : category['savePath'];
$("savepath").value = (category === undefined) ? "" : category["savePath"];
}
else {
$('savepath').disabled = false;
$('savepath').value = defaultSavePath;
$("savepath").disabled = false;
$("savepath").value = defaultSavePath;
}
};