Widget:追放信息:修订间差异
来自OGAS数据中枢
更多操作
无编辑摘要 |
|||
| 第1行: | 第1行: | ||
<script> | <script> | ||
(function() { | (function() { | ||
function initExileInfobox() { | |||
document.querySelectorAll('.xb').forEach(function(box) { | |||
if (box.dataset.initialized) return; | |||
box.dataset.initialized = 'true'; | |||
var btn = box.querySelector('.xb-skin-btn'); | |||
var overlay = box.querySelector('.xb-overlay'); | |||
var curName = box.querySelector('.xb-cur-name'); | |||
var items = box.querySelectorAll('.xb-skin-item'); | |||
var imgs = box.querySelectorAll('.xb-img-item'); | |||
var intros = box.querySelectorAll('.xb-intro-item'); | |||
if (!btn || !overlay) return; | |||
btn.addEventListener('click', function(e) { | |||
e.stopPropagation(); | |||
var isOpen = overlay.classList.toggle('open'); | |||
btn.classList.toggle('open', isOpen); | |||
}); | |||
items.forEach(function(item) { | |||
item.addEventListener('click', function() { | |||
var idx = item.getAttribute('data-idx'); | |||
items.forEach(function(el) { el.classList.remove('on'); }); | |||
imgs.forEach(function(el) { el.classList.remove('on'); }); | |||
intros.forEach(function(el) { el.classList.remove('on'); }); | |||
}); | item.classList.add('on'); | ||
if (imgs[idx]) imgs[idx].classList.add('on'); | |||
if (intros[idx]) intros[idx].classList.add('on'); | |||
var nameEl = item.querySelector('.xb-skin-item-name'); | |||
if (nameEl && curName) { | |||
curName.textContent = nameEl.textContent; | |||
} | |||
overlay.classList.remove('open'); | |||
btn.classList.remove('open'); | |||
}); | |||
}); | |||
document.addEventListener('click', function(e) { | |||
if (!overlay.contains(e.target) && e.target !== btn) { | |||
overlay.classList.remove('open'); | |||
btn.classList.remove('open'); | |||
} | |||
}); | |||
}); | |||
} | |||
if (document.readyState === 'loading') { | |||
document.addEventListener('DOMContentLoaded', initExileInfobox); | |||
} else { | |||
initExileInfobox(); | |||
} | |||
})(); | })(); | ||
</script> | </script> | ||
2026年5月27日 (三) 22:55的最新版本
<script> (function() {
function initExileInfobox() {
document.querySelectorAll('.xb').forEach(function(box) {
if (box.dataset.initialized) return;
box.dataset.initialized = 'true';
var btn = box.querySelector('.xb-skin-btn');
var overlay = box.querySelector('.xb-overlay');
var curName = box.querySelector('.xb-cur-name');
var items = box.querySelectorAll('.xb-skin-item');
var imgs = box.querySelectorAll('.xb-img-item');
var intros = box.querySelectorAll('.xb-intro-item');
if (!btn || !overlay) return;
btn.addEventListener('click', function(e) {
e.stopPropagation();
var isOpen = overlay.classList.toggle('open');
btn.classList.toggle('open', isOpen);
});
items.forEach(function(item) {
item.addEventListener('click', function() {
var idx = item.getAttribute('data-idx');
items.forEach(function(el) { el.classList.remove('on'); });
imgs.forEach(function(el) { el.classList.remove('on'); });
intros.forEach(function(el) { el.classList.remove('on'); });
item.classList.add('on');
if (imgs[idx]) imgs[idx].classList.add('on');
if (intros[idx]) intros[idx].classList.add('on');
var nameEl = item.querySelector('.xb-skin-item-name');
if (nameEl && curName) {
curName.textContent = nameEl.textContent;
}
overlay.classList.remove('open');
btn.classList.remove('open');
});
});
document.addEventListener('click', function(e) {
if (!overlay.contains(e.target) && e.target !== btn) {
overlay.classList.remove('open');
btn.classList.remove('open');
}
});
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initExileInfobox);
} else {
initExileInfobox();
}
})(); </script>