MediaWiki:Gadget-CaoCaoBi.js:修订间差异
MediaWiki界面页面
更多操作
![]() OctoberSama(留言 | 贡献) 小 |
![]() OctoberSama(留言 | 贡献) 小 |
||
第111行: | 第111行: | ||
// window.swit_so_CCB = swit_so_CCB; | // window.swit_so_CCB = swit_so_CCB; | ||
// window.elep_resz_CCB = elep_resz_CCB; | // window.elep_resz_CCB = elep_resz_CCB; | ||
return { | |||
sho_elep_CCB, | |||
gen_wow_CCB, | |||
swit_so_CCB, | |||
elep_resz_CCB | |||
}; | |||
}//if | }//if | ||
})(); | })(); |
2025年6月20日 (五) 20:52的版本
(function() {
'use strict';
if (document.body.classList.contains("action-view")) {
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*.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")
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) {
if (z) {
elep_size = elep_size*1.25
} else {
elep_size = elep_size*.8
}
document.body.removeChild(document.getElementById("ccb_elephant"))
sho_elep_CCB()
}
window.addEventListener("keydown",(e)=>{
if (e.key == "c") {
c_kd = 1
}
if (c_kd == 1) {
if (e.key == "b") {
swit_so_CCB()
}
if (e.key == "=") {
elep_resz_CCB(1)
}
if (e.key == "-") {
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;
return {
sho_elep_CCB,
gen_wow_CCB,
swit_so_CCB,
elep_resz_CCB
};
}//if
})();