打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

MediaWiki:Gadget-CaoCaoBi.js:修订间差异

MediaWiki界面页面
第1行: 第1行:
(function() {
'use strict';
    'use strict';
if (!document.body.classList.contains("action-view")) return;
    if (document.body.classList.contains("action-view")) {
 
    let elep_size = 64
let elep_size = 64;
    let elep_invl,einv_avail,c_kd,sw_s,c_clk_s
let elep_invl, einv_avail, c_kd, sw_s, c_clk_s;
    function sho_elep_CCB() {
 
        sw_s = 1
function sho_elep_CCB() {
        const a = document.createElement("div")
    sw_s = 1;
        a.style = "cursor:none;left:0px;top:0px;width:"+elep_size+"px;height:"+elep_size*1.3+"px;position:fixed;pointer-events:none;background-size:cover;z-index:1145"
    const a = document.createElement("div");
        elep_invl = setInterval(()=>{
    a.style = `cursor:none;left:0px;top:0px;width:${elep_size}px;height:${elep_size*1.3}px;position:fixed;pointer-events:none;background-size:cover;z-index:1145`;
            if (einv_avail) {
    elep_invl = setInterval(() => {
                a.style.backgroundImage = "url(/images/a/ab/Ccb_elep_1.webp)"
        if (einv_avail) {
                setTimeout(()=>{
            a.style.backgroundImage = "url(/images/a/ab/Ccb_elep_1.webp)";
                    a.style.backgroundImage = "url(/images/9/97/Ccb_elep_2.webp)"
            setTimeout(() => {
                },100)
                a.style.backgroundImage = "url(/images/9/97/Ccb_elep_2.webp)";
            }
             }, 100);
        },200)
        a.id = "ccb_elephant"
        document.body.appendChild(a)
        const b = document.createElement("div")
        const bse = "position:relative;left:"+-elep_size*1.5+"px;top:"+-elep_size*.5+"px;width:"+elep_size*4+"px;height:"+elep_size*3+"px;background-image:url(/images/4/4c/Ccb_waao.webp);background-size:cover;z-index:1144;transform:rotate(24deg)"
        b.style = bse+";opacity:0"
        a.appendChild(b)
        const c = document.createElement("audio")
        c.src = "/images/2/29/%E8%80%81%E7%88%B7%E7%88%B7%2C%E6%88%91%E6%9D%A5%E7%BB%99%E4%BD%A0%E8%B8%A9%E8%83%8C%E6%9D%A5%E5%96%BD.mp3"
        c.autoplay = 1
        a.appendChild(c)
        document.body.style.cursor = "none"
        window.addEventListener("mousemove",(e)=>{
            a.style.transform = "translate("+(e.clientX-elep_size*.5)+"px,"+(e.clientY-elep_size*1.2)+"px)"
             einv_avail = 1
        })
        window.addEventListener("mousedown",(e)=>{
            einv_avail = 0
            a.style.top = "8px"
        })
        window.addEventListener("mouseup",(e)=>{
            einv_avail = 1
            a.style.top = "0px"
            b.style = bse+" scale(.2);opacity:1;transition:none"
            setTimeout(()=>{b.style = bse+";opacity:0;transition:.2s"},3)
        })
    }
    window.addEventListener("mouseup",()=>{
        gen_wow_CCB()
    })
    function gen_wow_CCB() {
        if (!sw_s) {
            return
         }
         }
         const a = document.createElement("audio")
    }, 200);
        a.src = "/images/transcoded/c/ca/%E5%93%87%E8%A2%84.ogg/%E5%93%87%E8%A2%84.ogg.mp3"
    a.id = "ccb_elephant";
        a.autoplay = 1
    document.body.appendChild(a);
        document.body.appendChild(a)
 
        setTimeout(()=>{a.remove()},1470)
    const b = document.createElement("div");
    const bse = `position:relative;left:${-elep_size*1.5}px;top:${-elep_size*.5}px;width:${elep_size*4}px;height:${elep_size*3}px;background-image:url(/images/4/4c/Ccb_waao.webp);background-size:cover;z-index:1144;transform:rotate(24deg)`;
    b.style = bse + ";opacity:0";
    a.appendChild(b);
 
    const c = document.createElement("audio");
    c.src = "/images/2/29/%E8%80%81%E7%88%B7%E7%88%B7%2C%E6%88%91%E6%9D%A5%E7%BB%99%E4%BD%A0%E8%B8%A9%E8%83%8C%E6%9D%A5%E5%96%BD.mp3";
    c.autoplay = 1;
    a.appendChild(c);
 
    document.body.style.cursor = "none";
 
    window.addEventListener("mousemove", (e) => {
        a.style.transform = `translate(${e.clientX - elep_size * 0.5}px,${e.clientY - elep_size * 1.2}px)`;
         einv_avail = 1;
    });
    window.addEventListener("mousedown", () => {
        einv_avail = 0;
        a.style.top = "8px";
    });
    window.addEventListener("mouseup", () => {
        einv_avail = 1;
        a.style.top = "0px";
        b.style = bse + " scale(.2);opacity:1;transition:none";
        setTimeout(() => { b.style = bse + ";opacity:0;transition:.2s"; }, 3);
    });
}
 
function gen_wow_CCB() {
    if (!sw_s) return;
    const a = document.createElement("audio");
    a.src = "/images/transcoded/c/ca/%E5%93%87%E8%A2%84.ogg/%E5%93%87%E8%A2%84.ogg.mp3";
    a.autoplay = 1;
    document.body.appendChild(a);
    setTimeout(() => { a.remove(); }, 1470);
}
 
function swit_so_CCB() {
    if (!sw_s) {
        sho_elep_CCB();
        return;
     }
     }
     function swit_so_CCB() {
     document.body.removeChild(document.getElementById("ccb_elephant"));
        if (!sw_s) {
    document.body.style.cursor = "";
            sho_elep_CCB()
    if (document.body.getAttribute("style") === "") {
            return
        document.body.removeAttribute("style");
        }
        document.body.removeChild(document.getElementById("ccb_elephant"))
        document.body.style.cursor = ""
        if (document.body.getAttribute("style") === "") {
            document.body.removeAttribute("style");
        }
        sw_s = 0
     }
     }
     function elep_resz_CCB(z) {
     sw_s = 0;
         if (z) {
}
            elep_size = elep_size*1.25
 
         } else {
function elep_resz_CCB(z) {
             elep_size = elep_size*.8
    elep_size = z ? elep_size * 1.25 : elep_size * 0.8;
    document.body.removeChild(document.getElementById("ccb_elephant"));
    sho_elep_CCB();
}
 
window.addEventListener("mouseup", gen_wow_CCB);
window.addEventListener("keydown", (e) => {
    if (e.key === "c") c_kd = 1;
    if (c_kd) {
         if (e.key === "b") swit_so_CCB();
        if (e.key === "=") elep_resz_CCB(1);
        if (e.key === "-") elep_resz_CCB();
         if (e.key === "n") {
             const elep = document.getElementById("ccb_elephant");
            if (!elep) return;
            elep.style.pointerEvents = c_clk_s ? "none" : "auto";
            c_clk_s = !c_clk_s;
         }
         }
        document.body.removeChild(document.getElementById("ccb_elephant"))
        sho_elep_CCB()
     }
     }
    window.addEventListener("keydown",(e)=>{
});
        if (e.key == "c") {
window.addEventListener("keyup", (e) => {
            c_kd = 1
    if (e.key === "c") c_kd = 0;
        }
});
        if (c_kd == 1) {
 
            if (e.key == "b") {
console.log("Cao!Cao!Bi!Gadget 0.0.3 OTTOWiki.Ver updated 2025/6/10");
                swit_so_CCB()
 
            }
return {
            if (e.key == "=") {
    swit_so_CCB,
                elep_resz_CCB(1)
    sho_elep_CCB,
            }
    gen_wow_CCB,
            if (e.key == "-") {
    elep_resz_CCB
                elep_resz_CCB()
};
            }
            if (e.key == "n") {
                if (c_clk_s) {
                    document.getElementById("ccb_elephant").style.pointerEvents = "none"
                    c_clk_s = 0
                } else {
                    document.getElementById("ccb_elephant").style.pointerEvents = "auto"
                    c_clk_s = 1
                }
            }
        }
    })
    window.addEventListener("keyup",(e)=>{
        if (e.key == "c") {
            c_kd = 0
        }
    })
console.log("Cao!Cao!Bi!Gadget 0.0.3 OTTOWiki.Ver updated 2025/6/10")
window.sho_elep_CCB = sho_elep_CCB;
window.gen_wow_CCB = gen_wow_CCB;
window.swit_so_CCB = swit_so_CCB;
window.elep_resz_CCB = elep_resz_CCB;
}//if
})();

2025年6月20日 (五) 20:39的版本

'use strict';
if (!document.body.classList.contains("action-view")) return;

let elep_size = 64;
let elep_invl, einv_avail, c_kd, sw_s, c_clk_s;

function sho_elep_CCB() {
    sw_s = 1;
    const a = document.createElement("div");
    a.style = `cursor:none;left:0px;top:0px;width:${elep_size}px;height:${elep_size*1.3}px;position:fixed;pointer-events:none;background-size:cover;z-index:1145`;
    elep_invl = setInterval(() => {
        if (einv_avail) {
            a.style.backgroundImage = "url(/images/a/ab/Ccb_elep_1.webp)";
            setTimeout(() => {
                a.style.backgroundImage = "url(/images/9/97/Ccb_elep_2.webp)";
            }, 100);
        }
    }, 200);
    a.id = "ccb_elephant";
    document.body.appendChild(a);

    const b = document.createElement("div");
    const bse = `position:relative;left:${-elep_size*1.5}px;top:${-elep_size*.5}px;width:${elep_size*4}px;height:${elep_size*3}px;background-image:url(/images/4/4c/Ccb_waao.webp);background-size:cover;z-index:1144;transform:rotate(24deg)`;
    b.style = bse + ";opacity:0";
    a.appendChild(b);

    const c = document.createElement("audio");
    c.src = "/images/2/29/%E8%80%81%E7%88%B7%E7%88%B7%2C%E6%88%91%E6%9D%A5%E7%BB%99%E4%BD%A0%E8%B8%A9%E8%83%8C%E6%9D%A5%E5%96%BD.mp3";
    c.autoplay = 1;
    a.appendChild(c);

    document.body.style.cursor = "none";

    window.addEventListener("mousemove", (e) => {
        a.style.transform = `translate(${e.clientX - elep_size * 0.5}px,${e.clientY - elep_size * 1.2}px)`;
        einv_avail = 1;
    });
    window.addEventListener("mousedown", () => {
        einv_avail = 0;
        a.style.top = "8px";
    });
    window.addEventListener("mouseup", () => {
        einv_avail = 1;
        a.style.top = "0px";
        b.style = bse + " scale(.2);opacity:1;transition:none";
        setTimeout(() => { b.style = bse + ";opacity:0;transition:.2s"; }, 3);
    });
}

function gen_wow_CCB() {
    if (!sw_s) return;
    const a = document.createElement("audio");
    a.src = "/images/transcoded/c/ca/%E5%93%87%E8%A2%84.ogg/%E5%93%87%E8%A2%84.ogg.mp3";
    a.autoplay = 1;
    document.body.appendChild(a);
    setTimeout(() => { a.remove(); }, 1470);
}

function swit_so_CCB() {
    if (!sw_s) {
        sho_elep_CCB();
        return;
    }
    document.body.removeChild(document.getElementById("ccb_elephant"));
    document.body.style.cursor = "";
    if (document.body.getAttribute("style") === "") {
        document.body.removeAttribute("style");
    }
    sw_s = 0;
}

function elep_resz_CCB(z) {
    elep_size = z ? elep_size * 1.25 : elep_size * 0.8;
    document.body.removeChild(document.getElementById("ccb_elephant"));
    sho_elep_CCB();
}

window.addEventListener("mouseup", gen_wow_CCB);
window.addEventListener("keydown", (e) => {
    if (e.key === "c") c_kd = 1;
    if (c_kd) {
        if (e.key === "b") swit_so_CCB();
        if (e.key === "=") elep_resz_CCB(1);
        if (e.key === "-") elep_resz_CCB();
        if (e.key === "n") {
            const elep = document.getElementById("ccb_elephant");
            if (!elep) return;
            elep.style.pointerEvents = c_clk_s ? "none" : "auto";
            c_clk_s = !c_clk_s;
        }
    }
});
window.addEventListener("keyup", (e) => {
    if (e.key === "c") c_kd = 0;
});

console.log("Cao!Cao!Bi!Gadget 0.0.3 OTTOWiki.Ver updated 2025/6/10");

return {
    swit_so_CCB,
    sho_elep_CCB,
    gen_wow_CCB,
    elep_resz_CCB
};