Skip to content

Commit

Permalink
WebUI: Use closest() to get parent element
Browse files Browse the repository at this point in the history
  • Loading branch information
skomerko committed Dec 21, 2024
1 parent e2db0bc commit b285a67
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/webui/www/private/scripts/dynamicTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,16 @@ window.qBittorrent.DynamicTable ??= (() => {
if ((brect.width - mouseXRelative) < 5) {
this.resizeTh = e.target;
this.canResize = true;
e.target.getParent("tr").style.cursor = "col-resize";
e.target.closest("tr").style.cursor = "col-resize";
}
else if ((mouseXRelative < 5) && e.target.getPrevious('[class=""]')) {
this.resizeTh = e.target.getPrevious('[class=""]');
this.canResize = true;
e.target.getParent("tr").style.cursor = "col-resize";
e.target.closest("tr").style.cursor = "col-resize";
}
else {
this.canResize = false;
e.target.getParent("tr").style.cursor = "";
e.target.closest("tr").style.cursor = "";
}
}
if (this.currentHeaderAction === "drag") {
Expand All @@ -215,7 +215,7 @@ window.qBittorrent.DynamicTable ??= (() => {
this.dropSide = "left";
}

e.target.getParent("tr").style.cursor = "move";
e.target.closest("tr").style.cursor = "move";

if (!previousVisibleSibling) { // right most column
borderChangeElement = e.target;
Expand Down Expand Up @@ -1949,14 +1949,14 @@ window.qBittorrent.DynamicTable ??= (() => {
if (value) {
td.textContent = "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]";
td.title = "QBT_TR(Yes)QBT_TR[CONTEXT=SearchPluginsTable]";
td.getParent("tr").classList.add("green");
td.getParent("tr").classList.remove("red");
td.closest("tr").classList.add("green");
td.closest("tr").classList.remove("red");
}
else {
td.textContent = "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]";
td.title = "QBT_TR(No)QBT_TR[CONTEXT=SearchPluginsTable]";
td.getParent("tr").classList.add("red");
td.getParent("tr").classList.remove("green");
td.closest("tr").classList.add("red");
td.closest("tr").classList.remove("green");
}
};
},
Expand Down Expand Up @@ -3294,7 +3294,7 @@ window.qBittorrent.DynamicTable ??= (() => {
break;
}
td.set({ "text": logLevel, "title": logLevel });
td.getParent("tr").className = `logTableRow${addClass}`;
td.closest("tr").className = `logTableRow${addClass}`;
};
},

Expand Down Expand Up @@ -3354,7 +3354,7 @@ window.qBittorrent.DynamicTable ??= (() => {
addClass = "peerBanned";
}
td.set({ "text": status, "title": status });
td.getParent("tr").className = `logTableRow${addClass}`;
td.closest("tr").className = `logTableRow${addClass}`;
};
},

Expand Down

0 comments on commit b285a67

Please sign in to comment.