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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==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);