PureRender: Instant-Web

Clean, stable, and fast. PureRender accelerates your web experience by removing render-blocking elements, overlays, and layout-lagging effects for a seamless browsing experience.

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

Um dieses Skript zu installieren, müssen Sie eine Erweiterung wie Tampermonkey oder Violentmonkey installieren.

Um dieses Skript zu installieren, müssen Sie eine Erweiterung wie Tampermonkey oder Violentmonkey installieren.

Um dieses Skript zu installieren, müssen Sie eine Erweiterung wie Tampermonkey oder Userscripts installieren.

Um dieses Skript zu installieren, müssen Sie eine Erweiterung wie Tampermonkey installieren.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

Um dieses Design zu installieren, müssen Sie eine Erweiterung wie Stylus installieren.

Um dieses Design zu installieren, müssen Sie eine Erweiterung wie Stylus installieren.

Um dieses Design zu installieren, müssen Sie eine Erweiterung wie Stylus installieren.

Um diesen Stil zu installieren, müssen Sie eine Erweiterung für den Benutzerstil Verwaltung installieren.

Um diesen Stil zu installieren, müssen Sie eine Erweiterung für den Benutzerstil Verwaltung installieren.

Um diesen Stil zu installieren, müssen Sie eine Erweiterung für den Benutzerstil Verwaltung installieren.

(Ich habe bereits einen Benutzerstil Verwaltung, ich möchte ihn installieren!)

// ==UserScript==
// @name         PureRender: Instant-Web
// @namespace    https://github.com/wandersons13/PureRender
// @version      0.9
// @description  Clean, stable, and fast. PureRender accelerates your web experience by removing render-blocking elements, overlays, and layout-lagging effects for a seamless browsing experience.
// @author       wandersons13
// @match        *://*/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=speedtest.net
// @run-at       document-start
// @noframes
// @grant        GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// @license      GNU
// ==/UserScript==

(function () {
    "use strict";

    const host = location.hostname.toLowerCase();
    const href = location.href.toLowerCase();
    const referrer = (document.referrer || "").toLowerCase();

    const isYouTubeHost = (value) => /(^|\.)((youtube\.com)|(youtu\.be)|(youtube-nocookie\.com))$/.test(value);

    if (
        isYouTubeHost(host) ||
        href.includes("youtube.com/embed/") ||
        href.includes("youtube.com/live_embed") ||
        href.includes("youtube-nocookie.com") ||
        referrer.includes("youtube.com") ||
        referrer.includes("youtu.be") ||
        referrer.includes("youtube-nocookie.com")
    ) {
        return;
    }

    const userExcluded = GM_getValue("excluded_sites", []) || [];
    if (userExcluded.includes(host)) return;

    const blockedDomains = [
        "google-analytics.com", "googletagmanager.com", "connect.facebook.net",
        "hotjar.com", "scorecardresearch.com", "criteo.com", "quantserve.com",
        "adservice.google.com", "pagead2.googlesyndication.com"
    ];

    const originalFetch = window.fetch;
    window.fetch = function(...args) {
        const url = args[0] ? args[0].toString().toLowerCase() : "";
        if (blockedDomains.some(domain => url.includes(domain))) {
            return Promise.resolve(new Response("", { status: 204, statusText: "No Content" }));
        }
        return originalFetch.apply(this, args);
    };

    if (navigator.sendBeacon) {
        const originalBeacon = navigator.sendBeacon;
        navigator.sendBeacon = function(url, data) {
            const stringUrl = url ? url.toString().toLowerCase() : "";
            if (blockedDomains.some(domain => stringUrl.includes(domain))) {
                return true;
            }
            return originalBeacon.call(this, url, data);
        };
    }

    const originalSetTimeout = window.setTimeout;
    window.setTimeout = function(callback, delay, ...args) {
        if (typeof delay === 'number' && delay > 150 && delay < 3000) {
            delay = 10;
        }
        return originalSetTimeout.call(this, callback, delay, ...args);
    };

    GM_addStyle(`
        html, body {
            scroll-behavior: auto !important;
            visibility: visible !important;
            opacity: 1 !important;
        }

        img {
            image-rendering: -webkit-optimize-contrast;
        }

        iframe[src*="analytics"], iframe[src*="track"], iframe[src*="pixel"],
        [class*="preloader"], [id*="preloader"], [class*="loading-overlay"],
        [class*="skeleton"], [class*="spinner"], .loader, #loader {
            display: none !important;
            visibility: hidden !important;
            pointer-events: none !important;
        }

        * {
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }

        *:not(input):not(textarea):not(select) {
            text-shadow: none !important;
        }
    `);

    const quickUnlock = () => {
        requestAnimationFrame(() => {
            if (!document.body) return;

            const style = getComputedStyle(document.body);

            if (style.overflow === "hidden" || style.position === "fixed") {
                document.body.style.setProperty("overflow", "auto", "important");
                document.body.style.setProperty("position", "static", "important");
                document.documentElement.style.setProperty("overflow", "auto", "important");
            }

            const forceEager = () => {
                document.querySelectorAll('img[loading="lazy"], iframe[loading="lazy"]').forEach(el => {
                    el.setAttribute("loading", "eager");
                });
            };

            forceEager();

            const observer = new MutationObserver((mutations) => {
                for (let mutation of mutations) {
                    if (mutation.addedNodes.length) {
                        forceEager();
                    }
                }
            });

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

    window.addEventListener("DOMContentLoaded", quickUnlock, { once: true });
    window.addEventListener("load", quickUnlock, { once: true });

    GM_registerMenuCommand("🚫 Exclude this site", () => {
        const currentExcluded = GM_getValue("excluded_sites", []);
        if (!currentExcluded.includes(host)) {
            currentExcluded.push(host);
            GM_setValue("excluded_sites", currentExcluded);
            location.reload();
        }
    });

    GM_registerMenuCommand("🔄 Clear exclusion list", () => {
        if (confirm("Clear all exclusions?")) {
            GM_setValue("excluded_sites", []);
            location.reload();
        }
    });
})();