微件:GGLScratchGame:修订间差异
来自Limbo Wiki Mirror
无编辑摘要 标签:(旧)WikiEditor |
无编辑摘要 标签:(旧)WikiEditor |
||
| 第1行: | 第1行: | ||
<noinclude> | <noinclude> | ||
完整彩票刮刮乐 Widget | |||
</noinclude> | </noinclude> | ||
<includeonly> | <includeonly> | ||
<div class="ggl- | <div class="ggl-root"> | ||
<div class="ggl-ticket"> | <div class="ggl-ticket"> | ||
<div class="ggl- | <!-- 刮奖区域 --> | ||
<div class="ggl- | <div class="ggl-scratch-area"></div> | ||
</div> | |||
<!-- 底部 UI --> | |||
<div class="ggl-footer"> | |||
<div class="ggl-mascot">(`・ω・´) 扫描中…</div> | |||
<button class="ggl-scan">扫描结果</button> | |||
</div> | </div> | ||
</div> | </div> | ||
<style> | <style> | ||
.ggl- | /* ===== 根容器 ===== */ | ||
width: | .ggl-root { | ||
margin: | max-width: 420px; | ||
margin: 30px auto; | |||
font-family: sans-serif; | |||
} | } | ||
/* ===== 彩票主体 ===== */ | |||
.ggl-ticket { | .ggl-ticket { | ||
position: relative; | position: relative; | ||
width: | width: 100%; | ||
aspect-ratio: 1075 / 1911; | |||
background-image: url("https://wm.gaoice.run/images/thumb/b/b6/%E5%9B%BE%E7%89%871.png/ | background-image: url("https://wm.gaoice.run/images/thumb/b/b6/%E5%9B%BE%E7%89%871.png/1075px-%E5%9B%BE%E7%89%871.png"); | ||
background-size: cover; | background-size: cover; | ||
background-position: center; | background-position: center; | ||
} | |||
/* ===== 刮奖黄色区域 ===== */ | |||
.ggl-scratch-area { | |||
position: absolute; | |||
/* 原始比例定位(基于 1075×1911) */ | |||
left: 10.6%; | |||
top: 23.5%; | |||
width: 78.7%; | |||
height: 53.4%; | |||
display: grid; | |||
grid-template-columns: repeat(5, 1fr); | |||
grid-template-rows: repeat(6, 1fr); | |||
} | |||
/* ===== 单个刮奖格 ===== */ | |||
.ggl-cell { | |||
position: relative; | |||
overflow: hidden; | overflow: hidden; | ||
} | } | ||
| 第33行: | 第61行: | ||
position: absolute; | position: absolute; | ||
inset: 0; | inset: 0; | ||
background-image: url("https://wm.gaoice.run/images/thumb/4/4a/%E5%88%AE%E5%BC%80%E5%90%8E.jpg/ | background-image: url("https://wm.gaoice.run/images/thumb/4/4a/%E5%88%AE%E5%BC%80%E5%90%8E.jpg/559px-%E5%88%AE%E5%BC%80%E5%90%8E.jpg"); | ||
background-size: cover; | background-size: cover; | ||
background-position: center; | |||
} | } | ||
/* | /* 刮开前 */ | ||
.ggl- | .ggl-cover { | ||
position: absolute; | position: absolute; | ||
inset: 0; | inset: 0; | ||
background-image: url("https://wm.gaoice.run/images/thumb/5/5a/%E5%88%AE%E5%BC%80%E5%89%8D.png/559px-%E5%88%AE%E5%BC%80%E5%89%8D.png"); | |||
background-size: cover; | |||
background-position: center; | |||
cursor: pointer; | |||
} | |||
.ggl-cell.scratched .ggl-cover { | |||
display: none; | |||
} | |||
/* ===== 底部 UI ===== */ | |||
.ggl-footer { | |||
display: flex; | |||
margin-top: 10px; | |||
} | } | ||
.ggl- | .ggl-mascot { | ||
flex: 1; | |||
background | padding: 6px; | ||
background: #111; | |||
color: #0f0; | |||
font-size: 12px; | |||
} | } | ||
.ggl- | .ggl-scan { | ||
background: | flex: 1; | ||
background: #222; | |||
color: #fff; | |||
border: none; | |||
} | } | ||
</style> | </style> | ||
| 第59行: | 第104行: | ||
<script> | <script> | ||
(function () { | (function () { | ||
var | var root = document.currentScript.parentNode; | ||
var | var area = root.querySelector('.ggl-scratch-area'); | ||
if (! | if (!area) return; | ||
for (var i = 0; i < 30; i++) { | for (var i = 0; i < 30; i++) { | ||
var cell = document.createElement('div'); | var cell = document.createElement('div'); | ||
cell.className = 'ggl-cell'; | cell.className = 'ggl-cell'; | ||
this.classList.add('scratched'); | var reveal = document.createElement('div'); | ||
reveal.className = 'ggl-reveal'; | |||
var cover = document.createElement('div'); | |||
cover.className = 'ggl-cover'; | |||
cover.onclick = function () { | |||
this.parentNode.classList.add('scratched'); | |||
}; | }; | ||
cell.appendChild(reveal); | |||
cell.appendChild(cover); | |||
area.appendChild(cell); | |||
} | } | ||
})(); | })(); | ||
2026年2月1日 (日) 17:26的版本
完整彩票刮刮乐 Widget
