Greasy Fork

Greasy Fork is available in English.

[Aternos] AntiAntiAdblock!

Removes all the adblock reminders without a hussle.

当前为 2021-12-12 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        [Aternos] AntiAntiAdblock!
// @namespace   HKR
// @match       https://aternos.org/*
// @grant       none
// @version     3.0
// @author      HKR
// @description Removes all the adblock reminders without a hussle.
// @supportURL  https://github.com/Hakorr/Userscripts/issues
// @require     https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.js
// @run-at      document-start
// ==/UserScript==

/* NOTE THAT THE SCRIPT MIGHT NOT WORK AS ATERNOS' DEVELOPERS DO NOT SLEEP AND MESS WITH THIS SCRIPT ALMOST EVERY HOUR
- It's almost pointless to make public userscripts as the developers will just change a minor detail on their HTML or JS, which totally messes something up. 
- I have my own private script that works, and will only share it with trusted people. 
That's all, if it doesn't work, please don't cry and make your own one, keep it private. */

/* Note to the developers, touch some grass. */

$(document).ready(function () {
    Array.from($(".ad")).forEach(ad => ad.setAttribute("style","display: none;")); 
  
    $(".body, .header").each(function () {
        this.style.setProperty("display", "");
        this.style.setProperty("height", "");
    });

    $("#start").each(function () {
        this._ready = true;
    });

    $("#userdropdown-toggle").click(function (e) {
        if ($(window).width() <= 1e3) {
        e.preventDefault();
        $(".userdropdown").slideToggle(100);
        }
    });

    $(".logout").click(function () {
        aget("/panel/ajax/account/logout.php", function () {
        location.href = "/go/";
        });
    });
    $(".navigation-toggle").click(function () {
        var cookieValue = 0;
        if ($(".navigation").hasClass("toggled")) {
        $(".navigation").removeClass("toggled");
        } else {
        $(".navigation").addClass("toggled");
        cookieValue = 1;
        }
        document.cookie = COOKIE_PREFIX + "_NAVIGATION_TOGGLED=" + cookieValue + ";path=/;max-age=31536000";
    });
    $(".friend-access-count-dropdown").click(function () {
        var dropdown = $(".friend-access-dropdown");
        if (dropdown.css("display") === "none") {
        dropdown.slideDown(100);
        $(".friend-access-count-dropdown i").fa("fas", "fa-caret-up");
        } else {
        dropdown.slideUp(100);
        $(".friend-access-count-dropdown i").fa("fas", "fa-caret-down");
        }
    });
    $(".js-friends-access").click(friendAccess);
    $(".js-friends-leave").click(friendLeave);
    $(".hamburger").click(function () {
        if ($(".navigation").css("left") == "-200px") {
        $(".navigation").animate({left: "0px"});
        } else {
        $(".navigation").animate({left: "-200px"});
        }
    });
});

/* onbeforescriptexecute - https://github.com/Ray-Adams/beforeScriptExecute-Polyfill */
const HakorrIsCute = Math.random().toString(36).substring(2, Math.floor(Math.random() * 40) + 5);

(() => {
    'use strict';

    if ('onbeforescriptexecute' in document) return;

    const BseEvent = new Event(HakorrIsCute, {
        bubbles: true,
        cancelable: true
    });

    const observerCallback = (mutationsList) => {
        for (let mutationRecord of mutationsList) {
            for (let node of mutationRecord.addedNodes) {
                if (node.tagName !== 'SCRIPT') continue;

                // Adds functionality to document.onbeforescriptexecute
                if (typeof document.HakorrIsCute === 'function') {
                    document.addEventListener(
                        HakorrIsCute,
                        document.HakorrIsCute,
                        { once: true }
                    );
                };

                // Returns false if preventDefault() was called
                if (!node.dispatchEvent(BseEvent)) {
                    node.remove();
                };
            };
        };
    };

    const scriptObserver = new MutationObserver(observerCallback);
    scriptObserver.observe(document, { childList: true, subtree: true });
})();

function HakorrIsCool(str) {
    try {
        return btoa(atob(str)) == str;
    } catch (err) {
        return false;
    }
}

//A new web request initiated
document.HakorrIsCute = (e) => {
    //If it requests a selected file
    if (e.target.src.includes('data:text/javascript;base64,')) {
        //Block it
        e.preventDefault();

        e.target.getAttribute("src")
            .split("data:text/javascript;base64,")
                .forEach(t=>{if(HakorrIsCool(t)){atob(t)
                        .split(" ").forEach(t=>{t
                            .includes(atob("XzB4NGMwND0="))&&t
                                .split("'").forEach(t=>{t
                                    .includes("#")&&0!=t.length&&$(t)&&($(t)[0]
                                        .innerHTML="")})})}});
    }
}