WebUI: avoid redundant re-initialization

PR #21012.
This commit is contained in:
Chocobo1
2024-07-12 15:00:36 +08:00
committed by GitHub
parent 9c26e5d4d6
commit 9feefc8144
27 changed files with 174 additions and 240 deletions

View File

@@ -29,17 +29,16 @@
<script>
"use strict";
if (window.qBittorrent === undefined)
window.qBittorrent = {};
window.qBittorrent.InstallSearchPlugin = (function() {
const exports = function() {
window.qBittorrent ??= {};
window.qBittorrent.InstallSearchPlugin ??= (() => {
const exports = () => {
return {
setup: setup,
newPluginOk: newPluginOk
};
};
const init = function() {
const setup = function() {
new Keyboard({
defaultEventType: "keydown",
events: {
@@ -75,10 +74,9 @@
}
};
init();
return exports();
})();
Object.freeze(window.qBittorrent.InstallSearchPlugin);
window.qBittorrent.InstallSearchPlugin.setup();
</script>