Last active
January 1, 2023 19:19
-
-
Save CarlosRA97/239d8de1230171baf956bd7fd9a461af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isXPathLoaded = async path => { | |
while ( getElementByXpath(path) === null) { | |
await new Promise( resolve => requestAnimationFrame(resolve) ) | |
} | |
return getElementByXpath(path); | |
}; | |
function getElementByXpath(path) { | |
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; | |
} | |
function removeSidePanel() { | |
let xpaths = [ | |
"/html/body/div[1]/div/div[1]/div/div[3]/div/div/div/div[1]/div[1]/div/div/div/div/div[2]", | |
]; | |
xpaths.forEach((path) => isXPathLoaded(path).then(element => element.remove())) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment