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:48, 22 May 2022 (Created page with '// 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.at...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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();
  }
}

const sideBar = document.querySelector("div#mw-panel");
const nav = document.querySelector("nav#p-personal");
sideBar.remove();
nav.remove();

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