Fix bug with different XPaths across instances
This commit is contained in:
parent
cdceafb4ee
commit
bb65745ef5
|
@ -6,15 +6,21 @@
|
||||||
// @include http*
|
// @include http*
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
let recommendedSidebarXpath = "/html/body/div/div/div[5]/div[3]";
|
let sidebarXpaths = ["/html/body/div/div/div[4]/div[3]", "/html/body/div/div/div[5]/div[3]"];
|
||||||
let recommendedSidebar = document.evaluate(
|
|
||||||
recommendedSidebarXpath,
|
|
||||||
document,
|
|
||||||
null,
|
|
||||||
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
|
||||||
null,
|
|
||||||
).singleNodeValue;
|
|
||||||
|
|
||||||
if (recommendedSidebar != null) {
|
for (const index in sidebarXpaths) {
|
||||||
recommendedSidebar.setAttribute("hidden", true);
|
let xpath = sidebarXpaths[index];
|
||||||
|
|
||||||
|
let recommendedSidebar = document.evaluate(
|
||||||
|
xpath,
|
||||||
|
document,
|
||||||
|
null,
|
||||||
|
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
||||||
|
null,
|
||||||
|
).singleNodeValue;
|
||||||
|
|
||||||
|
if (recommendedSidebar != null) {
|
||||||
|
recommendedSidebar.setAttribute("hidden", true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue