Jump to content

User:Exampleava/common.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Exampleava (talk | contribs) at 17:51, 22 May 2022. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// remove all scripts and styles and stylesheet links
const links = document.querySelectorAll("link");
const styles = document.querySelectorAll("style");
const scripts = document.querySelectorAll("script");

console.log("LINKS", links);
console.log("Styles", styles);
console.log("scripts", scripts);

for (const style of styles) {
  style.disabled = true;
}
for (const script of scripts) {
  script.remove();
}
for (const link of links) {
  const rel = link.attributes.rel.nodeValue;
  if (rel === "stylesheet") {
    link.disabled = true;
    // link.remove();
  }
}