diff --git a/src/webui/www/private/scripts/cache.js b/src/webui/www/private/scripts/cache.js
index 7886a890f..67d718a1f 100644
--- a/src/webui/www/private/scripts/cache.js
+++ b/src/webui/www/private/scripts/cache.js
@@ -28,10 +28,8 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.Cache = (() => {
+window.qBittorrent ??= {};
+window.qBittorrent.Cache ??= (() => {
const exports = () => {
return {
buildInfo: new BuildInfoCache(),
@@ -170,5 +168,4 @@ window.qBittorrent.Cache = (() => {
return exports();
})();
-
Object.freeze(window.qBittorrent.Cache);
diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js
index ce4566e9a..e578606f6 100644
--- a/src/webui/www/private/scripts/client.js
+++ b/src/webui/www/private/scripts/client.js
@@ -25,10 +25,8 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.Client = (() => {
+window.qBittorrent ??= {};
+window.qBittorrent.Client ??= (() => {
const exports = () => {
return {
closeWindows: closeWindows,
diff --git a/src/webui/www/private/scripts/contextmenu.js b/src/webui/www/private/scripts/contextmenu.js
index 389d443e1..4f49ca3d4 100644
--- a/src/webui/www/private/scripts/contextmenu.js
+++ b/src/webui/www/private/scripts/contextmenu.js
@@ -28,11 +28,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.ContextMenu = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.ContextMenu ??= (() => {
+ const exports = () => {
return {
ContextMenu: ContextMenu,
TorrentsTableContextMenu: TorrentsTableContextMenu,
@@ -680,5 +678,4 @@ window.qBittorrent.ContextMenu = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.ContextMenu);
diff --git a/src/webui/www/private/scripts/download.js b/src/webui/www/private/scripts/download.js
index a64f4f9a0..ea93565d0 100644
--- a/src/webui/www/private/scripts/download.js
+++ b/src/webui/www/private/scripts/download.js
@@ -23,11 +23,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.Download = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.Download ??= (() => {
+ const exports = () => {
return {
changeCategorySelect: changeCategorySelect,
changeTMM: changeTMM
@@ -138,5 +136,4 @@ window.qBittorrent.Download = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.Download);
diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js
index 505113a8d..bc4242095 100644
--- a/src/webui/www/private/scripts/dynamicTable.js
+++ b/src/webui/www/private/scripts/dynamicTable.js
@@ -33,11 +33,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.DynamicTable = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.DynamicTable ??= (() => {
+ const exports = () => {
return {
TorrentsTable: TorrentsTable,
TorrentPeersTable: TorrentPeersTable,
@@ -3279,7 +3277,6 @@ window.qBittorrent.DynamicTable = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.DynamicTable);
/*************************************************************/
diff --git a/src/webui/www/private/scripts/file-tree.js b/src/webui/www/private/scripts/file-tree.js
index 2eaffcbff..7ccc46513 100644
--- a/src/webui/www/private/scripts/file-tree.js
+++ b/src/webui/www/private/scripts/file-tree.js
@@ -28,11 +28,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.FileTree = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.FileTree ??= (() => {
+ const exports = () => {
return {
FilePriority: FilePriority,
TriState: TriState,
@@ -196,5 +194,4 @@ window.qBittorrent.FileTree = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.FileTree);
diff --git a/src/webui/www/private/scripts/filesystem.js b/src/webui/www/private/scripts/filesystem.js
index e167afbef..7dd202f74 100644
--- a/src/webui/www/private/scripts/filesystem.js
+++ b/src/webui/www/private/scripts/filesystem.js
@@ -30,11 +30,9 @@
// This file is the JavaScript implementation of base/utils/fs.cpp
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.Filesystem = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.Filesystem ??= (() => {
+ const exports = () => {
return {
PathSeparator: PathSeparator,
fileExtension: fileExtension,
@@ -71,5 +69,4 @@ window.qBittorrent.Filesystem = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.Filesystem);
diff --git a/src/webui/www/private/scripts/localpreferences.js b/src/webui/www/private/scripts/localpreferences.js
index 95b051bf4..8eba65557 100644
--- a/src/webui/www/private/scripts/localpreferences.js
+++ b/src/webui/www/private/scripts/localpreferences.js
@@ -28,11 +28,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.LocalPreferences = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.LocalPreferences ??= (() => {
+ const exports = () => {
return {
LocalPreferencesClass: LocalPreferencesClass
};
@@ -67,5 +65,4 @@ window.qBittorrent.LocalPreferences = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.LocalPreferences);
diff --git a/src/webui/www/private/scripts/misc.js b/src/webui/www/private/scripts/misc.js
index 8881fc4ca..b148ec006 100644
--- a/src/webui/www/private/scripts/misc.js
+++ b/src/webui/www/private/scripts/misc.js
@@ -28,11 +28,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.Misc = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.Misc ??= (() => {
+ const exports = () => {
return {
friendlyUnit: friendlyUnit,
friendlyDuration: friendlyDuration,
@@ -230,5 +228,4 @@ window.qBittorrent.Misc = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.Misc);
diff --git a/src/webui/www/private/scripts/pathAutofill.js b/src/webui/www/private/scripts/pathAutofill.js
index 3a7021dbf..3a14b8300 100644
--- a/src/webui/www/private/scripts/pathAutofill.js
+++ b/src/webui/www/private/scripts/pathAutofill.js
@@ -31,63 +31,59 @@
/*
File implementing auto-fill for the path input field in the path dialogs.
*/
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-if (window.qBittorrent.pathAutofill === undefined) {
- window.qBittorrent.pathAutofill = (() => {
- const exports = () => {
- return {
- attachPathAutofill: attachPathAutofill
- };
+window.qBittorrent ??= {};
+window.qBittorrent.pathAutofill ??= (() => {
+ const exports = () => {
+ return {
+ attachPathAutofill: attachPathAutofill
};
+ };
- function showInputSuggestions(inputElement, names) {
- const datalist = document.createElement("datalist");
- datalist.id = inputElement.id + "Suggestions";
- for (const name of names) {
- const option = document.createElement("option");
- option.value = name;
- datalist.appendChild(option);
- }
-
- const oldDatalist = document.getElementById(`${inputElement.id}Suggestions`);
- if (oldDatalist !== null) {
- oldDatalist.replaceWith(datalist);
- }
- else {
- inputElement.appendChild(datalist);
- inputElement.setAttribute("list", datalist.id);
- }
+ function showInputSuggestions(inputElement, names) {
+ const datalist = document.createElement("datalist");
+ datalist.id = inputElement.id + "Suggestions";
+ for (const name of names) {
+ const option = document.createElement("option");
+ option.value = name;
+ datalist.appendChild(option);
}
- function showPathSuggestions(element, mode) {
- const partialPath = element.value;
- if (partialPath === "")
- return;
+ const oldDatalist = document.getElementById(`${inputElement.id}Suggestions`);
+ if (oldDatalist !== null) {
+ oldDatalist.replaceWith(datalist);
+ }
+ else {
+ inputElement.appendChild(datalist);
+ inputElement.setAttribute("list", datalist.id);
+ }
+ }
- fetch(`api/v2/app/getDirectoryContent?dirPath=${partialPath}&mode=${mode}`)
- .then(response => response.json())
- .then(filesList => { showInputSuggestions(element, filesList); })
- .catch(error => {});
+ function showPathSuggestions(element, mode) {
+ const partialPath = element.value;
+ if (partialPath === "")
+ return;
+
+ fetch(`api/v2/app/getDirectoryContent?dirPath=${partialPath}&mode=${mode}`)
+ .then(response => response.json())
+ .then(filesList => { showInputSuggestions(element, filesList); })
+ .catch(error => {});
+ }
+
+ function attachPathAutofill() {
+ const directoryInputs = document.querySelectorAll(".pathDirectory:not(.pathAutoFillInitialized)");
+ for (const input of directoryInputs) {
+ input.addEventListener("input", function() { showPathSuggestions(this, "dirs"); });
+ input.classList.add("pathAutoFillInitialized");
}
- function attachPathAutofill() {
- const directoryInputs = document.querySelectorAll(".pathDirectory:not(.pathAutoFillInitialized)");
- for (const input of directoryInputs) {
- input.addEventListener("input", function() { showPathSuggestions(this, "dirs"); });
- input.classList.add("pathAutoFillInitialized");
- }
+ const fileInputs = document.querySelectorAll(".pathFile:not(.pathAutoFillInitialized)");
+ for (const input of fileInputs) {
+ input.addEventListener("input", function() { showPathSuggestions(this, "all"); });
+ input.classList.add("pathAutoFillInitialized");
+ }
+ };
- const fileInputs = document.querySelectorAll(".pathFile:not(.pathAutoFillInitialized)");
- for (const input of fileInputs) {
- input.addEventListener("input", function() { showPathSuggestions(this, "all"); });
- input.classList.add("pathAutoFillInitialized");
- }
- };
-
- return exports();
- })();
-
- Object.freeze(window.qBittorrent.pathAutofill);
-};
+ return exports();
+})();
+Object.freeze(window.qBittorrent.pathAutofill);
diff --git a/src/webui/www/private/scripts/piecesbar.js b/src/webui/www/private/scripts/piecesbar.js
index ebc9ded27..1e4cfbca1 100644
--- a/src/webui/www/private/scripts/piecesbar.js
+++ b/src/webui/www/private/scripts/piecesbar.js
@@ -28,10 +28,8 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.PiecesBar = (() => {
+window.qBittorrent ??= {};
+window.qBittorrent.PiecesBar ??= (() => {
const exports = () => {
return {
PiecesBar: PiecesBar
@@ -267,5 +265,4 @@ window.qBittorrent.PiecesBar = (() => {
return exports();
})();
-
Object.freeze(window.qBittorrent.PiecesBar);
diff --git a/src/webui/www/private/scripts/progressbar.js b/src/webui/www/private/scripts/progressbar.js
index b807923b1..cda2b0090 100644
--- a/src/webui/www/private/scripts/progressbar.js
+++ b/src/webui/www/private/scripts/progressbar.js
@@ -28,11 +28,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.ProgressBar = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.ProgressBar ??= (() => {
+ const exports = () => {
return {
ProgressBar: ProgressBar
};
@@ -157,5 +155,4 @@ window.qBittorrent.ProgressBar = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.ProgressBar);
diff --git a/src/webui/www/private/scripts/prop-files.js b/src/webui/www/private/scripts/prop-files.js
index 7694ac867..2e0d74dec 100644
--- a/src/webui/www/private/scripts/prop-files.js
+++ b/src/webui/www/private/scripts/prop-files.js
@@ -28,11 +28,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.PropFiles = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.PropFiles ??= (() => {
+ const exports = () => {
return {
normalizePriority: normalizePriority,
isDownloadCheckboxExists: isDownloadCheckboxExists,
@@ -769,5 +767,4 @@ window.qBittorrent.PropFiles = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.PropFiles);
diff --git a/src/webui/www/private/scripts/prop-general.js b/src/webui/www/private/scripts/prop-general.js
index c3fc6588a..342e85fa0 100644
--- a/src/webui/www/private/scripts/prop-general.js
+++ b/src/webui/www/private/scripts/prop-general.js
@@ -28,11 +28,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.PropGeneral = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.PropGeneral ??= (() => {
+ const exports = () => {
return {
updateData: updateData
};
@@ -257,5 +255,4 @@ window.qBittorrent.PropGeneral = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.PropGeneral);
diff --git a/src/webui/www/private/scripts/prop-peers.js b/src/webui/www/private/scripts/prop-peers.js
index 7697dca18..bb12d7449 100644
--- a/src/webui/www/private/scripts/prop-peers.js
+++ b/src/webui/www/private/scripts/prop-peers.js
@@ -28,11 +28,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.PropPeers = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.PropPeers ??= (() => {
+ const exports = () => {
return {
updateData: updateData
};
@@ -182,5 +180,4 @@ window.qBittorrent.PropPeers = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.PropPeers);
diff --git a/src/webui/www/private/scripts/prop-trackers.js b/src/webui/www/private/scripts/prop-trackers.js
index f6c746580..e9d04be49 100644
--- a/src/webui/www/private/scripts/prop-trackers.js
+++ b/src/webui/www/private/scripts/prop-trackers.js
@@ -28,11 +28,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.PropTrackers = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.PropTrackers ??= (() => {
+ const exports = () => {
return {
updateData: updateData
};
@@ -237,5 +235,4 @@ window.qBittorrent.PropTrackers = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.PropTrackers);
diff --git a/src/webui/www/private/scripts/prop-webseeds.js b/src/webui/www/private/scripts/prop-webseeds.js
index e6a0cea5e..0bbc90a25 100644
--- a/src/webui/www/private/scripts/prop-webseeds.js
+++ b/src/webui/www/private/scripts/prop-webseeds.js
@@ -28,11 +28,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.PropWebseeds = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.PropWebseeds ??= (() => {
+ const exports = () => {
return {
updateData: updateData
};
@@ -148,5 +146,4 @@ window.qBittorrent.PropWebseeds = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.PropWebseeds);
diff --git a/src/webui/www/private/scripts/rename-files.js b/src/webui/www/private/scripts/rename-files.js
index 4bd37f839..d4c2ad1ca 100644
--- a/src/webui/www/private/scripts/rename-files.js
+++ b/src/webui/www/private/scripts/rename-files.js
@@ -1,10 +1,8 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.MultiRename = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.MultiRename ??= (() => {
+ const exports = () => {
return {
AppliesTo: AppliesTo,
RenameFiles: RenameFiles
@@ -282,5 +280,4 @@ window.qBittorrent.MultiRename = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.MultiRename);
diff --git a/src/webui/www/private/scripts/search.js b/src/webui/www/private/scripts/search.js
index 290dd61a5..133319f0b 100644
--- a/src/webui/www/private/scripts/search.js
+++ b/src/webui/www/private/scripts/search.js
@@ -23,11 +23,9 @@
"use strict";
-if (window.qBittorrent === undefined)
- window.qBittorrent = {};
-
-window.qBittorrent.Search = (function() {
- const exports = function() {
+window.qBittorrent ??= {};
+window.qBittorrent.Search ??= (() => {
+ const exports = () => {
return {
startStopSearch: startStopSearch,
manageSearchPlugins: manageSearchPlugins,
@@ -866,5 +864,4 @@ window.qBittorrent.Search = (function() {
return exports();
})();
-
Object.freeze(window.qBittorrent.Search);
diff --git a/src/webui/www/private/views/filters.html b/src/webui/www/private/views/filters.html
index cf73c2ba3..9b100eee2 100644
--- a/src/webui/www/private/views/filters.html
+++ b/src/webui/www/private/views/filters.html
@@ -44,11 +44,9 @@
diff --git a/src/webui/www/private/views/installsearchplugin.html b/src/webui/www/private/views/installsearchplugin.html
index aea0f48ec..9592888be 100644
--- a/src/webui/www/private/views/installsearchplugin.html
+++ b/src/webui/www/private/views/installsearchplugin.html
@@ -29,17 +29,16 @@
diff --git a/src/webui/www/private/views/log.html b/src/webui/www/private/views/log.html
index 4e3015d43..b3e7d8cd5 100644
--- a/src/webui/www/private/views/log.html
+++ b/src/webui/www/private/views/log.html
@@ -148,10 +148,8 @@
diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html
index 4f19172f4..89ac7fb64 100644
--- a/src/webui/www/private/views/preferences.html
+++ b/src/webui/www/private/views/preferences.html
@@ -1572,12 +1572,11 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
diff --git a/src/webui/www/private/views/rss.html b/src/webui/www/private/views/rss.html
index 805a389a2..ed522d15a 100644
--- a/src/webui/www/private/views/rss.html
+++ b/src/webui/www/private/views/rss.html
@@ -158,12 +158,8 @@
diff --git a/src/webui/www/private/views/rssDownloader.html b/src/webui/www/private/views/rssDownloader.html
index a1888bb15..0ec57a3ff 100644
--- a/src/webui/www/private/views/rssDownloader.html
+++ b/src/webui/www/private/views/rssDownloader.html
@@ -330,12 +330,11 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
diff --git a/src/webui/www/private/views/searchplugins.html b/src/webui/www/private/views/searchplugins.html
index e913ff670..28dabf18c 100644
--- a/src/webui/www/private/views/searchplugins.html
+++ b/src/webui/www/private/views/searchplugins.html
@@ -79,13 +79,12 @@
diff --git a/src/webui/www/private/views/transferlist.html b/src/webui/www/private/views/transferlist.html
index 1cb180b25..97cee9b86 100644
--- a/src/webui/www/private/views/transferlist.html
+++ b/src/webui/www/private/views/transferlist.html
@@ -18,12 +18,11 @@