Greasy Fork is available in English.

StarSea星海

洛克王国全屏、防止误操作等

// ==UserScript==
// @name         StarSea星海
// @namespace    https://17roco.qq.com/h5/
// @version      0.3.3
// @description  洛克王国全屏、防止误操作等
// @author       星海
// @match        https://*s.17roco.qq.com/h5/*
// ==/UserScript==



(async function () {
    'use strict';

    console.log('脚本已启动');

    const appContainer = document.createElement('div');
    appContainer.id = 'app';
    document.body.appendChild(appContainer);
    const meta = document.createElement('meta');
    meta.name = 'referrer';
    meta.content = 'no-referrer';
    document.head.appendChild(meta);

    // 2. 动态加载 CSS 样式
    function addStyle(cssText) {
        const style = document.createElement('style');
        style.type = 'text/css';
        style.appendChild(document.createTextNode(cssText));
        document.head.appendChild(style);
    }

    async function loadCSS(url) {
        const response = await fetch(url);
        const cssText = await response.text();
        addStyle(cssText);
    }

    // 3. 动态加载 JavaScript 模块
    async function loadJS(url) {
        const script = document.createElement('script');
        script.type = 'module';  // 确保以模块化方式加载
        script.src = url;
        document.body.appendChild(script);

        // 等待脚本加载完成
        await new Promise((resolve, reject) => {
            script.onload = resolve;
            script.onerror = reject;
        });
    }

    await loadJS('https://starsea.netlify.app/assets/index.js');
    await loadCSS('https://starsea.netlify.app/assets/index.css');

})();