diff --git a/src/webui/www/private/addpeers.html b/src/webui/www/private/addpeers.html index c7b558c60..84b42417a 100644 --- a/src/webui/www/private/addpeers.html +++ b/src/webui/www/private/addpeers.html @@ -16,11 +16,11 @@ defaultEventType: "keydown", events: { "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -52,7 +52,7 @@ alert("QBT_TR(Unable to add peers. Please ensure you are adhering to the IP:port format.)QBT_TR[CONTEXT=HttpServer]"); }, onSuccess: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); }); @@ -65,7 +65,7 @@
- +
diff --git a/src/webui/www/private/addtrackers.html b/src/webui/www/private/addtrackers.html index 0473cf959..4ba0938b4 100644 --- a/src/webui/www/private/addtrackers.html +++ b/src/webui/www/private/addtrackers.html @@ -17,11 +17,11 @@ defaultEventType: "keydown", events: { "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -41,7 +41,7 @@ urls: $("trackersUrls").value }, onComplete: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); }); diff --git a/src/webui/www/private/addwebseeds.html b/src/webui/www/private/addwebseeds.html index f941b0f7f..1a15b890d 100644 --- a/src/webui/www/private/addwebseeds.html +++ b/src/webui/www/private/addwebseeds.html @@ -17,11 +17,11 @@ defaultEventType: "keydown", events: { "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -39,7 +39,7 @@ urls: $("urls").value.split("\n").map(w => encodeURIComponent(w.trim())).filter(w => (w.length > 0)).join("|") }, onComplete: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); }); diff --git a/src/webui/www/private/confirmfeeddeletion.html b/src/webui/www/private/confirmfeeddeletion.html index a9f92977d..52bda6c48 100644 --- a/src/webui/www/private/confirmfeeddeletion.html +++ b/src/webui/www/private/confirmfeeddeletion.html @@ -18,7 +18,7 @@ $("cancelBtn").addEventListener("click", (e) => { e.preventDefault(); e.stopPropagation(); - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); }); $("confirmBtn").addEventListener("click", (e) => { e.preventDefault(); @@ -36,7 +36,7 @@ ++completionCount; if (completionCount === paths.length) { window.parent.qBittorrent.Rss.updateRssFeedList(); - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } } }).send(); diff --git a/src/webui/www/private/confirmtrackerdeletion.html b/src/webui/www/private/confirmtrackerdeletion.html index 8b6a2906d..3d153d1bb 100644 --- a/src/webui/www/private/confirmtrackerdeletion.html +++ b/src/webui/www/private/confirmtrackerdeletion.html @@ -20,7 +20,7 @@ $("cancelBtn").focus(); $("cancelBtn").addEvent("click", (e) => { e.stopPropagation(); - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); }); $("confirmBtn").addEvent("click", (e) => { e.stopPropagation(); @@ -33,7 +33,7 @@ urls: urls, }, onComplete: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); }); diff --git a/src/webui/www/private/download.html b/src/webui/www/private/download.html index 11cfa887c..78b57409b 100644 --- a/src/webui/www/private/download.html +++ b/src/webui/www/private/download.html @@ -187,7 +187,7 @@ $("download_frame").addEventListener("load", () => { if (submitted) - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); }); window.qBittorrent.pathAutofill.attachPathAutofill(); diff --git a/src/webui/www/private/downloadlimit.html b/src/webui/www/private/downloadlimit.html index d12b41974..d34d27375 100644 --- a/src/webui/www/private/downloadlimit.html +++ b/src/webui/www/private/downloadlimit.html @@ -45,7 +45,7 @@ }, onComplete: () => { window.parent.updateMainData(); - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); } @@ -58,7 +58,7 @@ "limit": limit }, onComplete: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); } @@ -72,11 +72,11 @@ event.preventDefault(); }, "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } diff --git a/src/webui/www/private/edittracker.html b/src/webui/www/private/edittracker.html index f4d8b9e35..fb31233e2 100644 --- a/src/webui/www/private/edittracker.html +++ b/src/webui/www/private/edittracker.html @@ -21,11 +21,11 @@ event.preventDefault(); }, "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -52,7 +52,7 @@ newUrl: $("trackerUrl").value }, onComplete: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); }); diff --git a/src/webui/www/private/editwebseed.html b/src/webui/www/private/editwebseed.html index 10a4a496c..e4e05d002 100644 --- a/src/webui/www/private/editwebseed.html +++ b/src/webui/www/private/editwebseed.html @@ -21,11 +21,11 @@ event.preventDefault(); }, "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -47,7 +47,7 @@ newUrl: encodeURIComponent($("url").value.trim()), }, onComplete: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); }); diff --git a/src/webui/www/private/newcategory.html b/src/webui/www/private/newcategory.html index e561926ce..7d9cfd27d 100644 --- a/src/webui/www/private/newcategory.html +++ b/src/webui/www/private/newcategory.html @@ -22,11 +22,11 @@ event.preventDefault(); }, "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -94,7 +94,7 @@ }, onSuccess: () => { window.parent.updateMainData(); - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); }, onFailure: () => { alert("QBT_TR(Unable to set category)QBT_TR[CONTEXT=Category]"); @@ -120,7 +120,7 @@ }, onSuccess: () => { window.parent.updateMainData(); - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); }, onFailure: () => { alert("QBT_TR(Unable to create category)QBT_TR[CONTEXT=Category]"); @@ -137,7 +137,7 @@ }, onSuccess: () => { window.parent.updateMainData(); - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); }, onFailure: () => { alert("QBT_TR(Unable to edit category)QBT_TR[CONTEXT=Category]"); diff --git a/src/webui/www/private/newfeed.html b/src/webui/www/private/newfeed.html index 696a3a479..3c7529188 100644 --- a/src/webui/www/private/newfeed.html +++ b/src/webui/www/private/newfeed.html @@ -21,11 +21,11 @@ event.preventDefault(); }, "Escape": (event) => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": (event) => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -55,7 +55,7 @@ }, onSuccess: (response) => { window.parent.qBittorrent.Rss.updateRssFeedList(); - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); }, onFailure: (response) => { if (response.status === 409) diff --git a/src/webui/www/private/newfolder.html b/src/webui/www/private/newfolder.html index 754f05610..92d71404f 100644 --- a/src/webui/www/private/newfolder.html +++ b/src/webui/www/private/newfolder.html @@ -22,11 +22,11 @@ event.preventDefault(); }, "Escape": (event) => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": (event) => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -55,7 +55,7 @@ }, onSuccess: (response) => { window.parent.qBittorrent.Rss.updateRssFeedList(); - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); }, onFailure: (response) => { if (response.status === 409) diff --git a/src/webui/www/private/newtag.html b/src/webui/www/private/newtag.html index 3c473a35a..4af66b583 100644 --- a/src/webui/www/private/newtag.html +++ b/src/webui/www/private/newtag.html @@ -21,11 +21,11 @@ event.preventDefault(); }, "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -69,7 +69,7 @@ tags: tagName, }, onComplete: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); break; @@ -85,7 +85,7 @@ tags: tagName, }, onComplete: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); break; diff --git a/src/webui/www/private/rename.html b/src/webui/www/private/rename.html index 9529f1e57..500ea1950 100644 --- a/src/webui/www/private/rename.html +++ b/src/webui/www/private/rename.html @@ -21,11 +21,11 @@ event.preventDefault(); }, "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -57,7 +57,7 @@ name: name }, onComplete: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); } diff --git a/src/webui/www/private/rename_feed.html b/src/webui/www/private/rename_feed.html index d4d8a565d..52fb65aa1 100644 --- a/src/webui/www/private/rename_feed.html +++ b/src/webui/www/private/rename_feed.html @@ -21,11 +21,11 @@ event.preventDefault(); }, "Escape": (event) => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": (event) => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -64,7 +64,7 @@ }, onSuccess: (response) => { window.parent.qBittorrent.Rss.updateRssFeedList(); - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); }, onFailure: (response) => { if (response.status === 409) diff --git a/src/webui/www/private/rename_file.html b/src/webui/www/private/rename_file.html index 3d0cc9e1e..e95795ef8 100644 --- a/src/webui/www/private/rename_file.html +++ b/src/webui/www/private/rename_file.html @@ -22,11 +22,11 @@ event.preventDefault(); }, "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -74,7 +74,7 @@ newPath: newPath }, onSuccess: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); }, onFailure: () => { alert("QBT_TR(Failed to update name)QBT_TR[CONTEXT=HttpServer]"); diff --git a/src/webui/www/private/rename_files.html b/src/webui/www/private/rename_files.html index 0e3de25b1..7000be614 100644 --- a/src/webui/www/private/rename_files.html +++ b/src/webui/www/private/rename_files.html @@ -65,11 +65,11 @@ defaultEventType: "keydown", events: { "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -285,7 +285,7 @@ $("renameButton").value = replaceOperation; }); $("closeButton").addEventListener("click", () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }); // synchronize header scrolling to table body diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index 6373b4793..b344c0332 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -30,7 +30,7 @@ window.qBittorrent.Client ??= (() => { const exports = () => { return { closeWindow: closeWindow, - closeWindows: closeWindows, + closeFrameWindow: closeFrameWindow, getSyncMainDataInterval: getSyncMainDataInterval, isStopped: isStopped, stop: stop, @@ -51,8 +51,8 @@ window.qBittorrent.Client ??= (() => { MochaUI.closeWindow(window); }; - const closeWindows = () => { - MochaUI.closeAll(); + const closeFrameWindow = (window) => { + closeWindow(window.frameElement.closest("div.mocha").id); }; const getSyncMainDataInterval = () => { diff --git a/src/webui/www/private/setlocation.html b/src/webui/www/private/setlocation.html index 7b69825da..9cccd673a 100644 --- a/src/webui/www/private/setlocation.html +++ b/src/webui/www/private/setlocation.html @@ -21,11 +21,11 @@ event.preventDefault(); }, "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -59,7 +59,7 @@ location: location }, onSuccess: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); }, onFailure: (xhr) => { $("error_div").textContent = xhr.response; diff --git a/src/webui/www/private/shareratio.html b/src/webui/www/private/shareratio.html index 58781f2fb..024423ecf 100644 --- a/src/webui/www/private/shareratio.html +++ b/src/webui/www/private/shareratio.html @@ -24,11 +24,11 @@ event.preventDefault(); }, "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } @@ -115,7 +115,7 @@ inactiveSeedingTimeLimit: inactiveSeedingTimeLimitValue }, onComplete: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); }); diff --git a/src/webui/www/private/upload.html b/src/webui/www/private/upload.html index f78596353..bfdf2196d 100644 --- a/src/webui/www/private/upload.html +++ b/src/webui/www/private/upload.html @@ -172,7 +172,7 @@ $("upload_frame").addEventListener("load", () => { if (submitted) - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); }); if ((Browser.platform === "ios") || ((Browser.platform === "mac") && (navigator.maxTouchPoints > 1))) diff --git a/src/webui/www/private/uploadlimit.html b/src/webui/www/private/uploadlimit.html index bc811c1a3..5c20fe915 100644 --- a/src/webui/www/private/uploadlimit.html +++ b/src/webui/www/private/uploadlimit.html @@ -45,7 +45,7 @@ }, onComplete: () => { window.parent.updateMainData(); - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); } @@ -58,7 +58,7 @@ "limit": limit }, onComplete: () => { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); } }).send(); } @@ -72,11 +72,11 @@ event.preventDefault(); }, "Escape": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); }, "Esc": function(event) { - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeFrameWindow(window); event.preventDefault(); } } diff --git a/src/webui/www/private/views/confirmdeletion.html b/src/webui/www/private/views/confirmdeletion.html index da2cebf50..abd27b4b9 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.closeWindows(); }); + cancelButton.addEventListener("click", (e) => { window.qBittorrent.Client.closeWindow("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.closeWindows(); + window.qBittorrent.Client.closeWindow("confirmDeletionPage"); }, onFailure: () => { alert("QBT_TR(Unable to delete torrents.)QBT_TR[CONTEXT=HttpServer]"); diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index 3776e6621..904f7c8a1 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -3042,12 +3042,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.closeWindows(); + window.parent.qBittorrent.Client.closeWindow("preferencesPage"); }, onSuccess: () => { // Close window window.parent.location.reload(); - window.parent.qBittorrent.Client.closeWindows(); + window.parent.qBittorrent.Client.closeWindow("preferencesPage"); } }); };