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 @@