Ouedkniss Elements Remover

Remove sponsored banners from Ouedkniss

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

Advertisement:

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

Advertisement:

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