mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
parent
1ee84033ec
commit
f8c48349a1
7 changed files with 30 additions and 55 deletions
|
@ -44,7 +44,7 @@
|
||||||
bulkRenameFilesTable.setup("bulkRenameFilesTableDiv", "bulkRenameFilesTableFixedHeaderDiv", bulkRenameFilesContextMenu);
|
bulkRenameFilesTable.setup("bulkRenameFilesTableDiv", "bulkRenameFilesTableFixedHeaderDiv", bulkRenameFilesContextMenu);
|
||||||
|
|
||||||
// Inject checkbox into the first column of the table header
|
// Inject checkbox into the first column of the table header
|
||||||
const tableHeaders = $$("#bulkRenameFilesTableFixedHeaderDiv .dynamicTableHeader th");
|
const tableHeaders = document.querySelectorAll("#bulkRenameFilesTableFixedHeaderDiv .dynamicTableHeader th");
|
||||||
if (tableHeaders.length > 0) {
|
if (tableHeaders.length > 0) {
|
||||||
const checkboxHeader = document.createElement("input");
|
const checkboxHeader = document.createElement("input");
|
||||||
checkboxHeader.type = "checkbox";
|
checkboxHeader.type = "checkbox";
|
||||||
|
|
|
@ -67,7 +67,9 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
|
|
||||||
// option diffs menu
|
// option diffs menu
|
||||||
this.menu = $(this.options.menu);
|
this.menu = $(this.options.menu);
|
||||||
this.targets = $$(this.options.targets);
|
this.targets = (this.options.targets.length > 0)
|
||||||
|
? Array.from(document.querySelectorAll(this.options.targets))
|
||||||
|
: [];
|
||||||
|
|
||||||
// fx
|
// fx
|
||||||
this.fx = new Fx.Tween(this.menu, {
|
this.fx = new Fx.Tween(this.menu, {
|
||||||
|
@ -197,9 +199,8 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||||
// get things started
|
// get things started
|
||||||
startListener() {
|
startListener() {
|
||||||
/* all elements */
|
/* all elements */
|
||||||
this.targets.each((el) => {
|
for (const el of this.targets)
|
||||||
this.setupEventListeners(el);
|
this.setupEventListeners(el);
|
||||||
}, this);
|
|
||||||
|
|
||||||
/* menu items */
|
/* menu items */
|
||||||
this.menu.addEventListener("click", (e) => {
|
this.menu.addEventListener("click", (e) => {
|
||||||
|
|
|
@ -666,7 +666,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
|
|
||||||
setSortedColumnIcon: function(newColumn, oldColumn, isReverse) {
|
setSortedColumnIcon: function(newColumn, oldColumn, isReverse) {
|
||||||
const getCol = (headerDivId, colName) => {
|
const getCol = (headerDivId, colName) => {
|
||||||
const colElem = $$(`#${headerDivId} .column_${colName}`);
|
const colElem = document.querySelectorAll(`#${headerDivId} .column_${colName}`);
|
||||||
if (colElem.length === 1)
|
if (colElem.length === 1)
|
||||||
return colElem[0];
|
return colElem[0];
|
||||||
return null;
|
return null;
|
||||||
|
@ -2140,7 +2140,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
*/
|
*/
|
||||||
toggleGlobalCheckbox: function() {
|
toggleGlobalCheckbox: function() {
|
||||||
const checkbox = $("rootMultiRename_cb");
|
const checkbox = $("rootMultiRename_cb");
|
||||||
const checkboxes = $$("input.RenamingCB");
|
const checkboxes = document.querySelectorAll("input.RenamingCB");
|
||||||
|
|
||||||
for (let i = 0; i < checkboxes.length; ++i) {
|
for (let i = 0; i < checkboxes.length; ++i) {
|
||||||
const node = this.getNode(i);
|
const node = this.getNode(i);
|
||||||
|
@ -2180,22 +2180,10 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||||
|
|
||||||
updateGlobalCheckbox: () => {
|
updateGlobalCheckbox: () => {
|
||||||
const checkbox = $("rootMultiRename_cb");
|
const checkbox = $("rootMultiRename_cb");
|
||||||
const checkboxes = $$("input.RenamingCB");
|
const checkboxes = document.querySelectorAll("input.RenamingCB");
|
||||||
const isAllChecked = () => {
|
const isAllChecked = Array.prototype.every.call(checkboxes, (checkbox => checkbox.checked));
|
||||||
for (let i = 0; i < checkboxes.length; ++i) {
|
const isAllUnchecked = (() => Array.prototype.every.call(checkboxes, (checkbox => !checkbox.checked)));
|
||||||
if (!checkboxes[i].checked)
|
if (isAllChecked) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
const isAllUnchecked = () => {
|
|
||||||
for (let i = 0; i < checkboxes.length; ++i) {
|
|
||||||
if (checkboxes[i].checked)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
if (isAllChecked()) {
|
|
||||||
checkbox.state = "checked";
|
checkbox.state = "checked";
|
||||||
checkbox.indeterminate = false;
|
checkbox.indeterminate = false;
|
||||||
checkbox.checked = true;
|
checkbox.checked = true;
|
||||||
|
|
|
@ -1313,10 +1313,10 @@ const initializeWindows = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Deactivate menu header links
|
// Deactivate menu header links
|
||||||
$$("a.returnFalse").each((el) => {
|
for (const el of document.querySelectorAll("a.returnFalse")) {
|
||||||
el.addEventListener("click", (e) => {
|
el.addEventListener("click", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -283,23 +283,9 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
checkbox.indeterminate = true;
|
checkbox.indeterminate = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAllCheckboxesChecked = () => {
|
const isAllCheckboxesChecked = () => Array.prototype.every.call(document.querySelectorAll("input.DownloadedCB"), (checkbox => checkbox.checked));
|
||||||
const checkboxes = $$("input.DownloadedCB");
|
|
||||||
for (let i = 0; i < checkboxes.length; ++i) {
|
|
||||||
if (!checkboxes[i].checked)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const isAllCheckboxesUnchecked = () => {
|
const isAllCheckboxesUnchecked = () => Array.prototype.every.call(document.querySelectorAll("input.DownloadedCB"), (checkbox => !checkbox.checked));
|
||||||
const checkboxes = $$("input.DownloadedCB");
|
|
||||||
for (let i = 0; i < checkboxes.length; ++i) {
|
|
||||||
if (checkboxes[i].checked)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setFilePriority = (ids, fileIds, priority) => {
|
const setFilePriority = (ids, fileIds, priority) => {
|
||||||
if (current_hash === "")
|
if (current_hash === "")
|
||||||
|
@ -630,7 +616,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||||
|
|
||||||
torrentFilesTable.setup("torrentFilesTableDiv", "torrentFilesTableFixedHeaderDiv", torrentFilesContextMenu);
|
torrentFilesTable.setup("torrentFilesTableDiv", "torrentFilesTableFixedHeaderDiv", torrentFilesContextMenu);
|
||||||
// inject checkbox into table header
|
// inject checkbox into table header
|
||||||
const tableHeaders = $$("#torrentFilesTableFixedHeaderDiv .dynamicTableHeader th");
|
const tableHeaders = document.querySelectorAll("#torrentFilesTableFixedHeaderDiv .dynamicTableHeader th");
|
||||||
if (tableHeaders.length > 0) {
|
if (tableHeaders.length > 0) {
|
||||||
const checkbox = document.createElement("input");
|
const checkbox = document.createElement("input");
|
||||||
checkbox.type = "checkbox";
|
checkbox.type = "checkbox";
|
||||||
|
|
|
@ -17,32 +17,32 @@
|
||||||
MochaUI.initializeTabs("aboutTabs");
|
MochaUI.initializeTabs("aboutTabs");
|
||||||
|
|
||||||
$("aboutAboutLink").addEventListener("click", () => {
|
$("aboutAboutLink").addEventListener("click", () => {
|
||||||
$$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".aboutTabContent"), (tab => tab.classList.add("invisible")));
|
||||||
$("aboutAboutContent").classList.remove("invisible");
|
$("aboutAboutContent").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("aboutAuthorLink").addEventListener("click", () => {
|
$("aboutAuthorLink").addEventListener("click", () => {
|
||||||
$$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".aboutTabContent"), (tab => tab.classList.add("invisible")));
|
||||||
$("aboutAuthorContent").classList.remove("invisible");
|
$("aboutAuthorContent").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("aboutSpecialThanksLink").addEventListener("click", () => {
|
$("aboutSpecialThanksLink").addEventListener("click", () => {
|
||||||
$$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".aboutTabContent"), (tab => tab.classList.add("invisible")));
|
||||||
$("aboutSpecialThanksContent").classList.remove("invisible");
|
$("aboutSpecialThanksContent").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("aboutTranslatorsLink").addEventListener("click", () => {
|
$("aboutTranslatorsLink").addEventListener("click", () => {
|
||||||
$$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".aboutTabContent"), (tab => tab.classList.add("invisible")));
|
||||||
$("aboutTranslatorsContent").classList.remove("invisible");
|
$("aboutTranslatorsContent").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("aboutLicenseLink").addEventListener("click", () => {
|
$("aboutLicenseLink").addEventListener("click", () => {
|
||||||
$$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".aboutTabContent"), (tab => tab.classList.add("invisible")));
|
||||||
$("aboutLicenseContent").classList.remove("invisible");
|
$("aboutLicenseContent").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("aboutSoftwareUsedLink").addEventListener("click", () => {
|
$("aboutSoftwareUsedLink").addEventListener("click", () => {
|
||||||
$$(".aboutTabContent").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".aboutTabContent"), (tab => tab.classList.add("invisible")));
|
||||||
$("aboutSoftwareUsedContent").classList.remove("invisible");
|
$("aboutSoftwareUsedContent").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -37,35 +37,35 @@
|
||||||
MochaUI.initializeTabs("preferencesTabs");
|
MochaUI.initializeTabs("preferencesTabs");
|
||||||
|
|
||||||
$("PrefBehaviorLink").addEventListener("click", (e) => {
|
$("PrefBehaviorLink").addEventListener("click", (e) => {
|
||||||
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".PrefTab"), (tab => tab.classList.add("invisible")));
|
||||||
$("BehaviorTab").classList.remove("invisible");
|
$("BehaviorTab").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
$("PrefDownloadsLink").addEventListener("click", (e) => {
|
$("PrefDownloadsLink").addEventListener("click", (e) => {
|
||||||
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".PrefTab"), (tab => tab.classList.add("invisible")));
|
||||||
$("DownloadsTab").classList.remove("invisible");
|
$("DownloadsTab").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
$("PrefConnectionLink").addEventListener("click", (e) => {
|
$("PrefConnectionLink").addEventListener("click", (e) => {
|
||||||
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".PrefTab"), (tab => tab.classList.add("invisible")));
|
||||||
$("ConnectionTab").classList.remove("invisible");
|
$("ConnectionTab").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
$("PrefSpeedLink").addEventListener("click", (e) => {
|
$("PrefSpeedLink").addEventListener("click", (e) => {
|
||||||
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".PrefTab"), (tab => tab.classList.add("invisible")));
|
||||||
$("SpeedTab").classList.remove("invisible");
|
$("SpeedTab").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
$("PrefBittorrentLink").addEventListener("click", (e) => {
|
$("PrefBittorrentLink").addEventListener("click", (e) => {
|
||||||
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".PrefTab"), (tab => tab.classList.add("invisible")));
|
||||||
$("BittorrentTab").classList.remove("invisible");
|
$("BittorrentTab").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
$("PrefRSSLink").addEventListener("click", (e) => {
|
$("PrefRSSLink").addEventListener("click", (e) => {
|
||||||
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".PrefTab"), (tab => tab.classList.add("invisible")));
|
||||||
$("RSSTab").classList.remove("invisible");
|
$("RSSTab").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
$("PrefWebUILink").addEventListener("click", (e) => {
|
$("PrefWebUILink").addEventListener("click", (e) => {
|
||||||
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".PrefTab"), (tab => tab.classList.add("invisible")));
|
||||||
$("WebUITab").classList.remove("invisible");
|
$("WebUITab").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
$("PrefAdvancedLink").addEventListener("click", (e) => {
|
$("PrefAdvancedLink").addEventListener("click", (e) => {
|
||||||
$$(".PrefTab").forEach(tab => { tab.classList.add("invisible"); });
|
Array.prototype.forEach.call(document.querySelectorAll(".PrefTab"), (tab => tab.classList.add("invisible")));
|
||||||
$("AdvancedTab").classList.remove("invisible");
|
$("AdvancedTab").classList.remove("invisible");
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue