NomenChat/Box3

NomenChat/Box3浮窗

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         NomenChat/Box3
// @namespace    https://github.com/helloyork
// @version      0.1
// @description  NomenChat/Box3浮窗
// @author       Nomen
// @match        https://box3.codemao.cn/e/*
// @icon         https://github.com/helloyork/lib/blob/main/Nomen.png?raw=true
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    let main = (async()=>{
        if(!window || !document)return;
        function loadSource(src){
            return new Promise(r=>{
                fetch(src).then(v=>v.text()).then(v=>r(v));
            })
        }
        async function initButton(){
            let b = document.createElement("div");
            b.innerHTML=await loadSource("https://raw.githubusercontent.com/helloyork/lib/main/Box3/nomenchat.html");
            document.body.appendChild(b);
        };
        await initButton();
        var button = document.getElementById('circle-button');
        var iframeContainer = document.getElementById('iframe-container');
        var robotIcon = document.getElementById('robot-icon');
        var closeIcon = document.getElementById('close-icon');

        button.addEventListener('click', function () {
            if (iframeContainer.classList.contains('show')) {
                iframeContainer.classList.remove('show');
                closeIcon.style.display = 'none';
                robotIcon.style.display = 'block';
                iframeContainer.addEventListener('transitionend', function() {
                    if (!iframeContainer.classList.contains('show')) {
                        iframeContainer.style.display = "none";
                    }
                }, {once: true});
            } else {
                iframeContainer.style.display = "block";
                setTimeout(function(){
                    iframeContainer.classList.add('show');
                },0);
                closeIcon.style.display = 'block';
                robotIcon.style.display = 'none';
            }
        });
    });
    setTimeout(main,2000)
})();