diff --git a/src/webui/www/private/rename_files.html b/src/webui/www/private/rename_files.html index e0d433738..54fcd4205 100644 --- a/src/webui/www/private/rename_files.html +++ b/src/webui/www/private/rename_files.html @@ -15,11 +15,11 @@ "use strict"; (() => { - if (window.parent.qBittorrent !== undefined) - window.qBittorrent = window.parent.qBittorrent; - window.qBittorrent = window.parent.qBittorrent; + const { + options: { data }, + windowEl + } = window.MUI.Windows.instances["multiRenamePage"]; - const data = window.MUI.Windows.instances["multiRenamePage"].options.data; const bulkRenameFilesContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({ targets: "#bulkRenameFilesTableDiv tr", menu: "multiRenameFilesMenu", @@ -65,11 +65,11 @@ defaultEventType: "keydown", events: { "Escape": function(event) { - window.parent.qBittorrent.Client.closeFrameWindow(window); + window.qBittorrent.Client.closeWindow(windowEl); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeFrameWindow(window); + window.qBittorrent.Client.closeWindow(windowEl); event.preventDefault(); } } @@ -284,9 +284,9 @@ LocalPreferences.set("multirename_replaceAll", fileRenamer.replaceAll); $("renameButton").value = replaceOperation; }); - $("closeButton").addEventListener("click", () => { - window.parent.qBittorrent.Client.closeFrameWindow(window); + $("closeButton").addEventListener("click", (event) => { event.preventDefault(); + window.qBittorrent.Client.closeWindow(windowEl); }); // synchronize header scrolling to table body $("bulkRenameFilesTableDiv").onscroll = function() { diff --git a/src/webui/www/private/views/confirmAutoTMM.html b/src/webui/www/private/views/confirmAutoTMM.html index 14ae0a87e..787a3d3b8 100644 --- a/src/webui/www/private/views/confirmAutoTMM.html +++ b/src/webui/www/private/views/confirmAutoTMM.html @@ -18,13 +18,13 @@ const confirmText = document.getElementById("confirmAutoTmmMessage"); const { - options: { data: { hashes, enable }, id }, + options: { data: { hashes, enable } }, windowEl } = window.MUI.Windows.instances["confirmAutoTMMDialog"]; confirmText.textContent = "QBT_TR(Are you sure you want to enable Automatic Torrent Management for the selected torrent(s)? They may be relocated.)QBT_TR[CONTEXT=confirmAutoTMMDialog]"; - cancelButton.addEventListener("click", (e) => { window.qBittorrent.Client.closeWindow(id); }); + cancelButton.addEventListener("click", (e) => { window.qBittorrent.Client.closeWindow(windowEl); }); confirmButton.addEventListener("click", (e) => { new Request({ url: "api/v2/torrents/setAutoManagement", @@ -35,7 +35,7 @@ }, onSuccess: () => { updateMainData(); - window.qBittorrent.Client.closeWindow(id); + window.qBittorrent.Client.closeWindow(windowEl); }, onFailure: () => { alert("QBT_TR(Unable to set Auto Torrent Management for the selected torrents.)QBT_TR[CONTEXT=HttpServer]"); @@ -52,7 +52,7 @@ confirmButton.click(); break; case "Escape": - window.qBittorrent.Client.closeWindow(id); + window.qBittorrent.Client.closeWindow(windowEl); break; } }); diff --git a/src/webui/www/private/views/confirmdeletion.html b/src/webui/www/private/views/confirmdeletion.html index abd27b4b9..feabbd9fb 100644 --- a/src/webui/www/private/views/confirmdeletion.html +++ b/src/webui/www/private/views/confirmdeletion.html @@ -69,7 +69,7 @@ }); cancelButton.focus(); - cancelButton.addEventListener("click", (e) => { window.qBittorrent.Client.closeWindow("confirmDeletionPage"); }); + cancelButton.addEventListener("click", (e) => { window.qBittorrent.Client.closeWindow(document.getElementById("confirmDeletionPage")); }); confirmButton.addEventListener("click", (e) => { // Some torrents might be removed when waiting for user input, so refetch the torrent list @@ -88,7 +88,7 @@ torrentsTable.deselectAll(); updateMainData(); updatePropertiesPanel(); - window.qBittorrent.Client.closeWindow("confirmDeletionPage"); + window.qBittorrent.Client.closeWindow(document.getElementById("confirmDeletionPage")); }, onFailure: () => { alert("QBT_TR(Unable to delete torrents.)QBT_TR[CONTEXT=HttpServer]"); diff --git a/src/webui/www/private/views/installsearchplugin.html b/src/webui/www/private/views/installsearchplugin.html index 7f35f308e..39b1ccaef 100644 --- a/src/webui/www/private/views/installsearchplugin.html +++ b/src/webui/www/private/views/installsearchplugin.html @@ -19,7 +19,7 @@
- +
@@ -50,7 +50,7 @@ if ((elem.id === "newPluginPath") || (elem.id === "newPluginOk")) newPluginOk(); else if (elem.id === "newPluginCancel") - window.qBittorrent.SearchPlugins.closeSearchWindow("installSearchPlugin"); + window.qBittorrent.Client.closeWindow(document.getElementById("installSearchPlugin")); } } }).activate(); @@ -68,7 +68,7 @@ sources: path, }, onRequest: () => { - window.qBittorrent.SearchPlugins.closeSearchWindow("installSearchPlugin"); + window.qBittorrent.Client.closeWindow(document.getElementById("installSearchPlugin")); } }).send(); } diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index 7c21a7675..f79575777 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -3043,12 +3043,12 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD data: settings, onFailure: () => { alert("QBT_TR(Unable to save program preferences, qBittorrent is probably unreachable.)QBT_TR[CONTEXT=HttpServer]"); - window.parent.qBittorrent.Client.closeWindow("preferencesPage"); + window.parent.qBittorrent.Client.closeWindow(document.getElementById("preferencesPage")); }, onSuccess: () => { // Close window window.parent.location.reload(); - window.parent.qBittorrent.Client.closeWindow("preferencesPage"); + window.parent.qBittorrent.Client.closeWindow(document.getElementById("preferencesPage")); } }); }; diff --git a/src/webui/www/private/views/searchplugins.html b/src/webui/www/private/views/searchplugins.html index af9e445f0..50bb2837d 100644 --- a/src/webui/www/private/views/searchplugins.html +++ b/src/webui/www/private/views/searchplugins.html @@ -63,7 +63,7 @@
- +
@@ -79,7 +79,6 @@ window.qBittorrent.SearchPlugins ??= (() => { const exports = () => { return { - closeSearchWindow: closeSearchWindow, setup: setup, installPlugin: installPlugin, checkForUpdates: checkForUpdates, @@ -113,10 +112,6 @@ updateTable(); }; - const closeSearchWindow = (id) => { - window.parent.qBittorrent.Client.closeWindow(window.parent.$(id)); - }; - const installPlugin = (path) => { new MochaUI.Window({ id: "installSearchPlugin",