微件:Test:修订间差异
无编辑摘要 标签:(旧)WikiEditor |
无编辑摘要 标签:(旧)WikiEditor |
||
| 第101行: | 第101行: | ||
/* ===== DOM ===== */ | /* ===== DOM ===== */ | ||
const root = document.querySelector('.ggl-root'); | |||
const grid = document.querySelector('.ggl-grid'); | const grid = document.querySelector('.ggl-grid'); | ||
const bubble = document.querySelector('.ggl-bubble'); | const bubble = document.querySelector('.ggl-bubble'); | ||
| 第111行: | 第112行: | ||
const ticket = document.querySelector('.ggl-ticket'); | const ticket = document.querySelector('.ggl-ticket'); | ||
/* 页面内预写的 WikiText | /* 页面内预写的 WikiText */ | ||
const wikiText = document.getElementById('ggl-wikitext'); | const wikiText = document.getElementById('ggl-wikitext'); | ||
const OPEN = 'https://wm.gaoice.run/images/thumb/4/4a/%E5%88%AE%E5%BC%80%E5%90%8E.jpg/180px-%E5%88%AE%E5%BC%80%E5%90%8E.jpg'; | const OPEN = 'https://wm.gaoice.run/images/thumb/4/4a/%E5%88%AE%E5%BC%80%E5%90%8E.jpg/180px-%E5%88%AE%E5%BC%80%E5%90%8E.jpg'; | ||
/* ===== | /* ===== 状态 ===== */ | ||
let idx = 0; | |||
let revealed = 0; | |||
let scanned = false; | |||
let finalized = false; | |||
/* ===== 第十张状态 ===== */ | |||
let alertTimer = null; | |||
let redeemModalLock = false; | |||
/* ===== 票数据(原样) ===== */ | |||
const TICKETS = [ | const TICKETS = [ | ||
{left:2,data:0,mascot:'',bubble:'你好。',onScan:'扫描完成:未检测到异常。',onRedeem:'点击兑奖区将作废本票。',rewards:{12:'DATA'}}, | {left:2,data:0,mascot:'',bubble:'你好。',onScan:'扫描完成:未检测到异常。',onRedeem:'点击兑奖区将作废本票。',rewards:{12:'DATA'}}, | ||
| 第127行: | 第138行: | ||
{left:0,data:7,mascot:'...',bubble:'▒▓░▒▓▒▓',onScan:'▒▓░▒▓▒▓▒▓',onRedeem:'▒▓░▒▓▒▓',rewards:{3:'DATA',18:'DATA'}}, | {left:0,data:7,mascot:'...',bubble:'▒▓░▒▓▒▓',onScan:'▒▓░▒▓▒▓▒▓',onRedeem:'▒▓░▒▓▒▓',rewards:{3:'DATA',18:'DATA'}}, | ||
{left:1,data:'—',mascot:'',bubble:'哦 嗯 嘿 哈',onScan:'扫描结果:DATA 溢出。',onRedeem:'兑奖接口未响应。',rewards:Object.fromEntries([...Array(30).keys()].map(i=>[i,'DATA']))}, | {left:1,data:'—',mascot:'',bubble:'哦 嗯 嘿 哈',onScan:'扫描结果:DATA 溢出。',onRedeem:'兑奖接口未响应。',rewards:Object.fromEntries([...Array(30).keys()].map(i=>[i,'DATA']))}, | ||
{left:0,data:'—',mascot:'',bubble:'你是谁?',onScan:'扫描中……',rewards:{}}, | {left:0,data:'—',mascot:'',bubble:'你是谁?',onScan:'扫描中……',rewards:{}}, | ||
{left:'▒▓░▒▓▒▓',data:'▒▓░▒▓▒▓',mascot:'平安喜乐',bubble:'你知道的太多了。',onScan:'权限越界。',rewards:{}} | {left:'▒▓░▒▓▒▓',data:'▒▓░▒▓▒▓',mascot:'平安喜乐',bubble:'你知道的太多了。',onScan:'权限越界。',rewards:{}} | ||
]; | ]; | ||
/* ===== 刮奖渐隐(原样) ===== */ | /* ===== 刮奖渐隐(原样) ===== */ | ||
| 第153行: | 第152行: | ||
function frame(now){ | function frame(now){ | ||
const p = Math.min((now - start) / duration, 1) * 100; | const p = Math.min((now - start) / duration, 1) * 100; | ||
cover.style.clipPath = ` | cover.style.clipPath = ` | ||
polygon( | polygon( | ||
| 第179行: | 第177行: | ||
} | } | ||
/* ===== | /* ===== 构建 ===== */ | ||
function build(){ | function build(){ | ||
if(finalized) return; | |||
const t = TICKETS[idx]; | const t = TICKETS[idx]; | ||
grid.innerHTML = ''; | grid.innerHTML = ''; | ||
| 第203行: | 第203行: | ||
`; | `; | ||
const cover = c.querySelector('.ggl-cover'); | const cover = c.querySelector('.ggl-cover'); | ||
cover.onclick = ()=>{ | cover.onclick = ()=>{ | ||
if(c.dataset.done) return; | if(c.dataset.done || finalized) return; | ||
c.dataset.done = 1; | c.dataset.done = 1; | ||
fadeOutCover(cover, ()=>{ | fadeOutCover(cover, ()=>{ | ||
if(++revealed === 30){ | if(++revealed === 30){ | ||
| 第214行: | 第212行: | ||
}); | }); | ||
}; | }; | ||
grid.appendChild(c); | grid.appendChild(c); | ||
} | } | ||
} | } | ||
/* ===== | /* ===== 第十张 alert ===== */ | ||
function startInfiniteAlert(){ | function startInfiniteAlert(){ | ||
if(alertTimer) return; | if(alertTimer) return; | ||
function tick(){ | function tick(){ | ||
alert( | alert('【越界访问】'); | ||
alertTimer = setTimeout(tick, 200); | alertTimer = setTimeout(tick, 200); | ||
} | } | ||
| 第231行: | 第226行: | ||
} | } | ||
/* ===== | /* ===== 第十一张终局 ===== */ | ||
function | function triggerFinal(){ | ||
finalized = true; | |||
document.body.style.filter = 'invert(1)'; | document.body.style.filter = 'invert(1)'; | ||
if(root) root.style.display = 'none'; | |||
if(wikiText) wikiText.style.display = 'block'; | |||
if(wikiText) | |||
} | } | ||
/* ===== 扫描 ===== */ | /* ===== 扫描 ===== */ | ||
scan.onclick = ()=>{ | scan.onclick = ()=>{ | ||
if(!scan.classList.contains('active')) return; | if(finalized || !scan.classList.contains('active')) return; | ||
if(idx === 9 && revealed === 30){ | if(idx === 9 && revealed === 30){ | ||
startInfiniteAlert(); | startInfiniteAlert(); | ||
| 第299行: | 第243行: | ||
} | } | ||
if(idx === 10 && !scanned){ | if(idx === 10 && !scanned){ | ||
scanned = true; | scanned = true; | ||
bubble.textContent = TICKETS[idx].onScan; | bubble.textContent = TICKETS[idx].onScan; | ||
triggerFinal(); | |||
return; | return; | ||
} | } | ||
| 第309行: | 第252行: | ||
if(!scanned){ | if(!scanned){ | ||
scanned = true; | scanned = true; | ||
bubble.textContent = TICKETS[idx].onScan; | |||
scan.textContent = '再来一张'; | scan.textContent = '再来一张'; | ||
return; | return; | ||
| 第320行: | 第263行: | ||
/* ===== 兑奖 ===== */ | /* ===== 兑奖 ===== */ | ||
redeem.onclick = ()=>{ | redeem.onclick = ()=>{ | ||
if(finalized) return; | |||
if(idx === 9 && revealed === 30){ | if(idx === 9 && revealed === 30){ | ||
// 原有模态逻辑你之前那份已经是对的,这里不再重复 | |||
} | } | ||
}; | }; | ||
| 第336行: | 第277行: | ||
/* ===== 快捷调试 ===== */ | /* ===== 快捷调试 ===== */ | ||
document.addEventListener('keydown',e=>{ | document.addEventListener('keydown',e=>{ | ||
if(finalized) return; | |||
if(e.shiftKey && e.key.toLowerCase()==='d'){ | if(e.shiftKey && e.key.toLowerCase()==='d'){ | ||
grid.querySelectorAll('.ggl-cover').forEach(c=>c.style.display='none'); | grid.querySelectorAll('.ggl-cover').forEach(c=>c.style.display='none'); | ||
| 第344行: | 第286行: | ||
})(); | })(); | ||
</script> | </script> | ||
2026年2月2日 (一) 22:32的版本
<button class="ggl-start-btn">来一张彩票…
…不,三张吧</button>
刮开奖券 · 在整张刮完后交由bot扫描
刮出数字即能获得对应额度的data
当“平”“安”“喜”“乐”四个字连城一条线时,可再获得一张刮刮卡
看不懂也没关系!bot会告诉你结果!
剩余彩票:— 张 可提现 DATA:—
<img class="ggl-bg"
src="
">
<button class="ggl-redeem-hit" id="ggl-redeem-hit"></button>
<button id="ggl-scan">扫描结果</button>
<style> .ggl-root{width:375px;margin:auto;font-family:sans-serif;position:relative} .ggl-mask{position:absolute;inset:0;background:#000d;z-index:99;display:flex;align-items:center;justify-content:center} .ggl-start-btn{padding:12px 20px;font-size:16px}
.ggl-top{text-align:center;font-size:14px;margin-bottom:6px} .ggl-frame{padding:10px;border:3px solid #ff00aa;box-shadow:0 0 12px #ff00aa88} .ggl-ticket{position:relative;aspect-ratio:1075/1911} .ggl-bg{width:100%;display:block}
.ggl-scratch-area{position:absolute;left:10%;top:35%;width:80%;height:53%} .ggl-grid{display:grid;width:100%;height:100%;grid-template-columns:repeat(5,1fr);grid-template-rows:repeat(6,1fr);gap:6px}
.ggl-cell{position:relative;overflow:hidden} .ggl-cell img,.ggl-cover{position:absolute;inset:0;width:100%;height:100%} .ggl-cover{
background:url("
") center/cover;
cursor:pointer
} .ggl-reward{
position:absolute;inset:0; display:flex;align-items:center;justify-content:center; font-size:12px;font-weight:bold;pointer-events:none
}
.ggl-mascot{position:absolute;left:6%;top:107%} .ggl-bubble{position:absolute;left:6%;top:103%;width:60%;background:#fff;padding:6px;font-size:13px} .ggl-controls{position:absolute;right:6%;top:103%}
- ggl-scan{opacity:.3}
- ggl-scan.active{opacity:1}
.ggl-redeem-hit{
position:absolute;bottom:1%;left:2%; width:48%;height:10%; background:transparent;border:none
} </style>
<script> (function(){
/* ===== DOM ===== */ const root = document.querySelector('.ggl-root'); const grid = document.querySelector('.ggl-grid'); const bubble = document.querySelector('.ggl-bubble'); const mascot = document.querySelector('.ggl-mascot'); const scan = document.getElementById('ggl-scan'); const leftEl = document.getElementById('ggl-left'); const dataEl = document.getElementById('ggl-data'); const mask = document.getElementById('ggl-mask'); const redeem = document.getElementById('ggl-redeem-hit'); const ticket = document.querySelector('.ggl-ticket');
/* 页面内预写的 WikiText */ const wikiText = document.getElementById('ggl-wikitext');
const OPEN = 'https://wm.gaoice.run/images/thumb/4/4a/%E5%88%AE%E5%BC%80%E5%90%8E.jpg/180px-%E5%88%AE%E5%BC%80%E5%90%8E.jpg';
/* ===== 状态 ===== */ let idx = 0; let revealed = 0; let scanned = false; let finalized = false;
/* ===== 第十张状态 ===== */ let alertTimer = null; let redeemModalLock = false;
/* ===== 票数据(原样) ===== */ const TICKETS = [
{left:2,data:0,mascot:,bubble:'你好。',onScan:'扫描完成:未检测到异常。',onRedeem:'点击兑奖区将作废本票。',rewards:{12:'DATA'}},
{left:1,data:1,mascot:'(^▽^)ノ',bubble:'第一张,只中了 DATA。',onScan:'扫描结果:DATA ×1',onRedeem:'兑奖操作不可逆。',rewards:{1:'连',3:'着',16:'四',19:'个'}},
{left:2,data:2,mascot:'(ノ◕ヮ◕)ノ',bubble:'连成了一条线。',onScan:'检测到异常排列,追加机会。',onRedeem:'系统记录兑奖请求。',rewards:{1:'平',2:'安',3:'喜',4:'乐'}},
{left:2,data:4,mascot:'(^▽^)',bubble:'中奖了。',onScan:'扫描完成:DATA 2MB',onRedeem:'兑奖成功。',rewards:{8:'DATA'}},
{left:2,data:5,mascot:'(・_・)',bubble:'什么都没有。',onScan:'扫描完成:空。',onRedeem:'无可兑奖内容。',rewards:{}},
{left:1,data:5,mascot:'(;゚Д゚)',bubble:'好像哪里不对。',onScan:'扫描警告:结构异常。',onRedeem:'请求被拒绝。',rewards:{}},
{left:0,data:5,mascot:,bubble:'什么都没有。',onScan:'扫描完成:无数据。',onRedeem:'兑奖无效。',rewards:{}},
{left:0,data:7,mascot:'...',bubble:'▒▓░▒▓▒▓',onScan:'▒▓░▒▓▒▓▒▓',onRedeem:'▒▓░▒▓▒▓',rewards:{3:'DATA',18:'DATA'}},
{left:1,data:'—',mascot:,bubble:'哦 嗯 嘿 哈',onScan:'扫描结果:DATA 溢出。',onRedeem:'兑奖接口未响应。',rewards:Object.fromEntries([...Array(30).keys()].map(i=>[i,'DATA']))},
{left:0,data:'—',mascot:,bubble:'你是谁?',onScan:'扫描中……',rewards:{}},
{left:'▒▓░▒▓▒▓',data:'▒▓░▒▓▒▓',mascot:'平安喜乐',bubble:'你知道的太多了。',onScan:'权限越界。',rewards:{}}
];
/* ===== 刮奖渐隐(原样) ===== */ function fadeOutCover(cover, done){
const start = performance.now(); const duration = 450;
cover.style.pointerEvents = 'none'; cover.style.willChange = 'clip-path,opacity';
function frame(now){
const p = Math.min((now - start) / duration, 1) * 100;
cover.style.clipPath = `
polygon(
0% ${100 - p}%,
${p}% 100%,
100% 100%,
100% 0%,
0% 0%
)
`;
cover.style.opacity = 1 - p / 100;
if(p < 100){
requestAnimationFrame(frame);
}else{
cover.style.display = 'none';
cover.style.clipPath = ;
cover.style.opacity = ;
cover.style.pointerEvents = ;
cover.style.willChange = ;
done && done();
}
}
requestAnimationFrame(frame);
}
/* ===== 构建 ===== */ function build(){
if(finalized) return;
const t = TICKETS[idx]; grid.innerHTML = ; revealed = 0; scanned = false;
leftEl.textContent = t.left; dataEl.textContent = t.data; mascot.textContent = t.mascot || ; bubble.textContent = t.bubble || ;
scan.textContent = '扫描结果';
scan.classList.remove('active');
for(let i=0;i<30;i++){
const c = document.createElement('div');
c.className = 'ggl-cell';
c.innerHTML = `
<img src="${OPEN}">
`;
const cover = c.querySelector('.ggl-cover');
cover.onclick = ()=>{
if(c.dataset.done || finalized) return;
c.dataset.done = 1;
fadeOutCover(cover, ()=>{
if(++revealed === 30){
scan.classList.add('active');
}
});
};
grid.appendChild(c);
}
}
/* ===== 第十张 alert ===== */ function startInfiniteAlert(){
if(alertTimer) return;
function tick(){
alert('【越界访问】');
alertTimer = setTimeout(tick, 200);
}
tick();
}
/* ===== 第十一张终局 ===== */ function triggerFinal(){
finalized = true; document.body.style.filter = 'invert(1)'; if(root) root.style.display = 'none'; if(wikiText) wikiText.style.display = 'block';
}
/* ===== 扫描 ===== */ scan.onclick = ()=>{
if(finalized || !scan.classList.contains('active')) return;
if(idx === 9 && revealed === 30){
startInfiniteAlert();
return;
}
if(idx === 10 && !scanned){
scanned = true;
bubble.textContent = TICKETS[idx].onScan;
triggerFinal();
return;
}
if(!scanned){
scanned = true;
bubble.textContent = TICKETS[idx].onScan;
scan.textContent = '再来一张';
return;
}
idx++; if(idx < TICKETS.length) build();
};
/* ===== 兑奖 ===== */ redeem.onclick = ()=>{
if(finalized) return;
if(idx === 9 && revealed === 30){
// 原有模态逻辑你之前那份已经是对的,这里不再重复
}
};
/* ===== 初始遮罩 ===== */ mask.onclick = ()=>{
mask.remove(); build();
};
/* ===== 快捷调试 ===== */ document.addEventListener('keydown',e=>{
if(finalized) return;
if(e.shiftKey && e.key.toLowerCase()==='d'){
grid.querySelectorAll('.ggl-cover').forEach(c=>c.style.display='none');
revealed = 30;
scan.classList.add('active');
}
});
})(); </script>
