Ouedkniss Elements Remover

Remove sponsored banners from Ouedkniss

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Ouedkniss Elements Remover
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Remove sponsored banners from Ouedkniss
// @author       Harrysof
// @icon         https://greasyfork.s3.us-east-2.amazonaws.com/9emqda6d7wwfzlfawkqaxcqx6o5h
// @match        https://www.ouedkniss.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    // Array of selectors to remove
    const selectorsToRemove = [
        '.page-top-1',
        '.o-section-heading',
        '.home-promo-header'
    ];

    function removeElements(selector) {
        const elements = document.querySelectorAll(selector);
        elements.forEach(element => element.remove());
    }

    function removeBlur() {
        const blurredElements = document.querySelectorAll('[class*="blurred"]');
        blurredElements.forEach(element => {
            element.style.filter = 'none';
            element.classList.remove('blurred');
        });
    }

    function load() {
        // Remove specified elements
        selectorsToRemove.forEach(selector => removeElements(selector));
        removeBlur(); // Remove blur effects if any
    }

    load();

    for (const f of ['pushState', 'replaceState', 'forward', 'back', 'go']) {
        const fn = history[f];
        history[f] = function(...args) {
            fn.apply(this, args);
            load();
        };
    }
    const observer = new MutationObserver(() => {
        selectorsToRemove.forEach(selector => removeElements(selector));
        removeBlur();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();