fandom.com - Remove bloatware

Removes unnecessary elements from fandom website, leaving only what's important.

2024-04-24 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name           fandom.com - Remove bloatware
// @namespace      fandom.com utils
// @match          https://*.fandom.com/*
// @icon           https://www.google.com/s2/favicons?sz=64&domain=fandom.com
// @description    Removes unnecessary elements from fandom website, leaving only what's important.
// @grant          none
// @version        1.0.0
// @author         eye-wave
// @license        GPL-3.0+
// ==/UserScript==
"use strict";
(() => {
  // ../../utils/src/index.ts
  function $(query) {
    return document.querySelectorAll(query);
  }
  function $s(query) {
    return document.querySelector(query);
  }

  // src/window.js
  window.ads = void 0;

  // src/index.ts
  var toResize = [".fandom-community-header__background", ".main-container"];
  var massRemove = ["iframe", "link[as='script']", "meta", "script", "style:not([type='text/css'])"];
  var removeListSingle = [
    ".bottom-ads-container",
    ".fandom-sticky-header",
    ".global-navigation",
    ".global-registration-buttons",
    ".notifications-placeholder",
    ".page__right-rail",
    ".page-side-tools",
    ".right-rail-wrapper",
    ".top-ads-container",
    ".unified-search__layout__right-rail",
    "#age-gate",
    "#featured-video__player-container",
    "#global-explore-navigation",
    "#p-views",
    "#WikiaBar",
    "body > svg + *",
    "div>div[data-tracking-opt-in-overlay]",
    "footer"
  ];
  removeBloatware();
  function removeBloatware() {
    removeListSingle.forEach((q) => $s(q)?.remove());
    massRemove.forEach((q) => $(q).forEach((e) => e?.remove()));
    toResize.forEach((q) => $s(q)?.setAttribute("style", "width:100%;margin:0"));
  }
  removeExcessiveBodyClassNames();
  function removeExcessiveBodyClassNames() {
    for (const c of document.body.classList) {
      if (c.includes("skin-fandom"))
        continue;
      document.body.classList.remove(c);
    }
  }
  function removeExcessiveHtmlAttrs() {
    document.documentElement.removeAttribute("class");
    document.documentElement.removeAttribute("dir");
    document.documentElement.removeAttribute("style");
  }
  new MutationObserver((mutationsList) => {
    for (const mutation of mutationsList) {
      if (mutation.type === "childList")
        removeBloatware();
      if (mutation.type === "attributes") {
        removeExcessiveBodyClassNames();
        removeExcessiveHtmlAttrs();
      }
    }
  }).observe(document.documentElement, {
    childList: true,
    subtree: true,
    attributes: true,
    attributeOldValue: true
  });
})();