mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-23 17:59:44 +00:00
WebUI: fix 'rename files' dialog cannot be opened more than once
Some checks failed
CI - File health / Check (push) Has been cancelled
CI - macOS / Build (1.2.19, GUI=OFF, 6.7.0) (push) Has been cancelled
CI - macOS / Build (1.2.19, GUI=ON, 6.7.0) (push) Has been cancelled
CI - macOS / Build (2.0.10, GUI=OFF, 6.7.0) (push) Has been cancelled
CI - macOS / Build (2.0.10, GUI=ON, 6.7.0) (push) Has been cancelled
CI - Python / Check (push) Has been cancelled
CI - Ubuntu / Build (1.2.19, GUI=OFF, 6.5.2) (push) Has been cancelled
CI - Ubuntu / Build (1.2.19, GUI=ON, 6.5.2) (push) Has been cancelled
CI - Ubuntu / Build (2.0.10, GUI=OFF, 6.5.2) (push) Has been cancelled
CI - Ubuntu / Build (2.0.10, GUI=ON, 6.5.2) (push) Has been cancelled
CI - WebUI / Check (push) Has been cancelled
CI - Windows / Build (1.2.19) (push) Has been cancelled
CI - Windows / Build (2.0.10) (push) Has been cancelled
Some checks failed
CI - File health / Check (push) Has been cancelled
CI - macOS / Build (1.2.19, GUI=OFF, 6.7.0) (push) Has been cancelled
CI - macOS / Build (1.2.19, GUI=ON, 6.7.0) (push) Has been cancelled
CI - macOS / Build (2.0.10, GUI=OFF, 6.7.0) (push) Has been cancelled
CI - macOS / Build (2.0.10, GUI=ON, 6.7.0) (push) Has been cancelled
CI - Python / Check (push) Has been cancelled
CI - Ubuntu / Build (1.2.19, GUI=OFF, 6.5.2) (push) Has been cancelled
CI - Ubuntu / Build (1.2.19, GUI=ON, 6.5.2) (push) Has been cancelled
CI - Ubuntu / Build (2.0.10, GUI=OFF, 6.5.2) (push) Has been cancelled
CI - Ubuntu / Build (2.0.10, GUI=ON, 6.5.2) (push) Has been cancelled
CI - WebUI / Check (push) Has been cancelled
CI - Windows / Build (1.2.19) (push) Has been cancelled
CI - Windows / Build (2.0.10) (push) Has been cancelled
Added an IIFE around the whole script to suppress variable redeclaration errors. Closes #21614. Original PR #21620. PR #21621.
This commit is contained in:
parent
84372de675
commit
49f57b1049
@ -14,15 +14,13 @@
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
(() => {
|
||||
if (window.parent.qBittorrent !== undefined)
|
||||
window.qBittorrent = window.parent.qBittorrent;
|
||||
window.qBittorrent = window.parent.qBittorrent;
|
||||
|
||||
const TriState = window.qBittorrent.FileTree.TriState;
|
||||
const data = window.MUI.Windows.instances["multiRenamePage"].options.data;
|
||||
let bulkRenameFilesContextMenu;
|
||||
if (!bulkRenameFilesContextMenu) {
|
||||
bulkRenameFilesContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
||||
const bulkRenameFilesContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
|
||||
targets: "#bulkRenameFilesTableDiv tr",
|
||||
menu: "multiRenameFilesMenu",
|
||||
actions: {
|
||||
@ -40,7 +38,6 @@
|
||||
y: 2
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Setup the dynamic table for bulk renaming
|
||||
const bulkRenameFilesTable = new window.qBittorrent.DynamicTable.BulkRenameTorrentFilesTable();
|
||||
@ -48,11 +45,8 @@
|
||||
|
||||
// Inject checkbox into the first column of the table header
|
||||
const tableHeaders = $$("#bulkRenameFilesTableFixedHeaderDiv .dynamicTableHeader th");
|
||||
let checkboxHeader;
|
||||
if (tableHeaders.length > 0) {
|
||||
if (checkboxHeader)
|
||||
checkboxHeader.remove();
|
||||
checkboxHeader = new Element("input");
|
||||
const checkboxHeader = new Element("input");
|
||||
checkboxHeader.set("type", "checkbox");
|
||||
checkboxHeader.set("id", "rootMultiRename_cb");
|
||||
checkboxHeader.addEvent("click", (e) => {
|
||||
@ -67,9 +61,7 @@
|
||||
|
||||
// Register keyboard events to modal window
|
||||
// https://github.com/qbittorrent/qBittorrent/pull/18687#discussion_r1135045726
|
||||
let keyboard;
|
||||
if (!keyboard) {
|
||||
keyboard = new Keyboard({
|
||||
const keyboard = new Keyboard({
|
||||
defaultEventType: "keydown",
|
||||
events: {
|
||||
"Escape": function(event) {
|
||||
@ -83,7 +75,6 @@
|
||||
}
|
||||
});
|
||||
keyboard.activate();
|
||||
}
|
||||
|
||||
const fileRenamer = new window.qBittorrent.MultiRename.RenameFiles();
|
||||
fileRenamer.hash = data.hash;
|
||||
@ -403,6 +394,7 @@
|
||||
}).send();
|
||||
};
|
||||
setupTable(data.selectedRows);
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user