mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-05 14:47:25 +03:00
WebUI: fix window can not close regression
Fix up1cd3c586c1
. Fix upe1bd1038c0
. PR #21919.
This commit is contained in:
parent
90aecfea02
commit
e8d8de8f19
6 changed files with 20 additions and 25 deletions
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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]");
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div>
|
||||
<input type="text" id="newPluginPath" placeholder="QBT_TR(URL or local directory)QBT_TR[CONTEXT=PluginSourceDlg]" autocorrect="off" autocapitalize="none">
|
||||
<div style="margin-top: 10px; text-align: center;">
|
||||
<button type="button" id="newPluginCancel" onclick="qBittorrent.SearchPlugins.closeSearchWindow('installSearchPlugin');">QBT_TR(Cancel)QBT_TR[CONTEXT=PluginSourceDlg]</button>
|
||||
<button type="button" id="newPluginCancel" onclick="window.qBittorrent.Client.closeWindow(document.getElementById('installSearchPlugin'));">QBT_TR(Cancel)QBT_TR[CONTEXT=PluginSourceDlg]</button>
|
||||
<button type="button" id="newPluginOk" onclick="qBittorrent.InstallSearchPlugin.newPluginOk();">QBT_TR(Ok)QBT_TR[CONTEXT=PluginSourceDlg]</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
<div style="width: 100%; margin-top: 10px;">
|
||||
<button type="button" style="width: 33%; line-height: 1.4em;" onclick="qBittorrent.SearchPlugins.installPlugin();">QBT_TR(Install new plugin)QBT_TR[CONTEXT=PluginSelectDlg]</button>
|
||||
<button type="button" style="width: 33%; line-height: 1.4em;" onclick="qBittorrent.SearchPlugins.checkForUpdates();">QBT_TR(Check for updates)QBT_TR[CONTEXT=PluginSelectDlg]</button>
|
||||
<button type="button" style="width: 32%; line-height: 1.4em;" onclick="qBittorrent.SearchPlugins.closeSearchWindow('searchPlugins');">QBT_TR(Close)QBT_TR[CONTEXT=PluginSelectDlg]</button>
|
||||
<button type="button" style="width: 32%; line-height: 1.4em;" onclick="window.qBittorrent.Client.closeWindow(document.getElementById('searchPlugins'));">QBT_TR(Close)QBT_TR[CONTEXT=PluginSelectDlg]</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue