Skip to content

Instantly share code, notes, and snippets.

@CarlosRA97
Last active January 1, 2023 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CarlosRA97/239d8de1230171baf956bd7fd9a461af to your computer and use it in GitHub Desktop.
Save CarlosRA97/239d8de1230171baf956bd7fd9a461af to your computer and use it in GitHub Desktop.
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