Tarayıcı üzerinde çalışan !important temizleme kütüphanesi
Script này sẽ không được không được cài đặt trực tiếp. Nó là một thư viện cho các script khác để bao gồm các chỉ thị meta
// @require https://update.greasyfork.org/scripts/582798/1851893/AntiImportant.js
// ==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);