AntiImportant

Tarayıcı üzerinde çalışan !important temizleme kütüphanesi

بۇ قوليازمىنى بىۋاسىتە قاچىلاشقا بولمايدۇ. بۇ باشقا قوليازمىلارنىڭ ئىشلىتىشى ئۈچۈن تەمىنلەنگەن ئامبار بولۇپ، ئىشلىتىش ئۈچۈن مېتا كۆرسەتمىسىگە قىستۇرىدىغان كود: // @require https://update.greasyfork.org/scripts/582798/1851893/AntiImportant.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         AntiImportant
// @namespace    http://tampermonkey.net/
// @version      1
// @description  Tarayıcı üzerinde çalışan !important temizleme kütüphanesi
// @author       Atilla
// @license MIT
// ==/UserScript==
((rootElement) => {
  // İç fonksiyon: Sadece verilen elemanı ve alt elemanlarını temizler
  const clean = (el) => {
    if (!el || el.nodeType !== 1) return;
    
    const elements = [el, ...el.querySelectorAll("*")];
    
    elements.forEach((node) => {
      const style = node.style;
      if (!style || style.length === 0) return;

      // Performans için canlı listeyi diziye kopyala
      const props = Array.from(style);
      props.forEach((prop) => {
        if (style.getPropertyPriority(prop) === "important") {
          style.setProperty(prop, style.getPropertyValue(prop), "");
        }
      });
    });
  };

  // 1. Mevcut DOM'u temizle
  clean(rootElement);

  // 2. Yeni eklenenleri takip et ve temizle
  new MutationObserver((mutations) => {
    mutations.forEach((m) => m.addedNodes.forEach(clean));
  }).observe(rootElement, { childList: true, subtree: true });
})(document.body);