WebUI: Use native function for selecting elements by ID

This commit is contained in:
skomerko
2025-04-12 11:57:27 +02:00
parent 7b3aa51bb1
commit 411ca0f668
48 changed files with 1303 additions and 1303 deletions

View File

@@ -66,7 +66,7 @@ window.qBittorrent.ContextMenu ??= (() => {
};
// option diffs menu
this.menu = $(this.options.menu);
this.menu = document.getElementById(this.options.menu);
// fx
this.fx = new Fx.Tween(this.menu, {
@@ -457,7 +457,7 @@ window.qBittorrent.ContextMenu ??= (() => {
this.setEnabled("copyInfohash1", thereAreV1Hashes);
this.setEnabled("copyInfohash2", thereAreV2Hashes);
const contextTagList = $("contextTagList");
const contextTagList = document.getElementById("contextTagList");
for (const tag of tagMap.keys()) {
const checkbox = contextTagList.querySelector(`a[href="#Tag/${tag}"] input[type="checkbox"]`);
const count = tagCount.get(tag);
@@ -477,7 +477,7 @@ window.qBittorrent.ContextMenu ??= (() => {
}
updateCategoriesSubMenu(categories) {
const contextCategoryList = $("contextCategoryList");
const contextCategoryList = document.getElementById("contextCategoryList");
[...contextCategoryList.children].forEach((el) => { el.destroy(); });
const createMenuItem = (text, imgURL, clickFn) => {
@@ -527,7 +527,7 @@ window.qBittorrent.ContextMenu ??= (() => {
}
updateTagsSubMenu(tags) {
const contextTagList = $("contextTagList");
const contextTagList = document.getElementById("contextTagList");
contextTagList.replaceChildren();
const createMenuItem = (text, imgURL, clickFn) => {
@@ -727,8 +727,8 @@ window.qBittorrent.ContextMenu ??= (() => {
this.menu.style.left = "-999em";
this.menu.style.top = "-999em";
// position the menu
let xPosMenu = e.pageX + this.options.offsets.x - $("rssdownloaderpage").offsetLeft;
let yPosMenu = e.pageY + this.options.offsets.y - $("rssdownloaderpage").offsetTop;
let xPosMenu = e.pageX + this.options.offsets.x - document.getElementById("rssdownloaderpage").offsetLeft;
let yPosMenu = e.pageY + this.options.offsets.y - document.getElementById("rssdownloaderpage").offsetTop;
if ((xPosMenu + this.menu.offsetWidth) > document.documentElement.clientWidth)
xPosMenu -= this.menu.offsetWidth;
if ((yPosMenu + this.menu.offsetHeight) > document.documentElement.clientHeight)