FallMamontsBlock

Mamonts are no longer flying :(

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ć!)

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ć!)

// ==UserScript==
// @name         FallMamontsBlock
// @namespace    http://tampermonkey.net/
// @version      2.2
// @description  Mamonts are no longer flying :(
// @author       k3kzia
// @license      MIT
// @match        *://lolz.guru/*
// @match        *://zelenka.guru/*
// @match        *://lolz.live/*
// @grant        GM_registerMenuCommand
// @grant        GM_setValue
// @grant        GM_getValue
// @run-at       document-start
// ==/UserScript==

(function () {
    'use strict';

    const defaultSettings = {
        snowMinJs: true,
        interactiveMinJs: true
    };

    const settings = GM_getValue('blockSettings') || defaultSettings;

    if (!GM_getValue('blockSettings')) {
        GM_setValue('blockSettings', defaultSettings);
    }

    const blockList = [];
    if (settings.snowMinJs) blockList.push('snow.min.js');
    if (settings.interactiveMinJs) blockList.push('interactive.min.js');

    const isBlocked = (src) => blockList.some(blockedUrl => src.includes(blockedUrl));

    const observer = new MutationObserver((mutations) => {
        mutations.forEach((mutation) => {
            mutation.addedNodes.forEach((node) => {
                if (node.tagName === 'SCRIPT' && node.src && isBlocked(node.src)) {
                    console.log('Blocked script:', node.src);
                    node.remove();
                }
            });
        });
    });

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

    GM_registerMenuCommand(
        `Падающие мамонты (Сейчас ${settings.snowMinJs ? 'выключены' : 'включены'})`,
        () => {
            settings.snowMinJs = !settings.snowMinJs;
            GM_setValue('blockSettings', settings);
            alert(`Падающие мамонты ${settings.snowMinJs ? 'выключены' : 'включены'}, пожалуйста, перезагрузите страницу`);
        }
    );

    GM_registerMenuCommand(
        `Взаимодействия (Сейчас ${settings.interactiveMinJs ? 'выключены' : 'включены'})`,
        () => {
            settings.interactiveMinJs = !settings.interactiveMinJs;
            GM_setValue('blockSettings', settings);
            alert(`Взаимодействия ${settings.interactiveMinJs ? 'выключены' : 'включены'}, пожалуйста, перезагрузите страницу`);
        }
    );
})();