Widget:GFLMail:修订间差异
来自OGAS数据中枢
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
<script> | <script> | ||
(function () { | (function () { | ||
if (window._gflMailInit) return; | if (window._gflMailInit) return; | ||
window._gflMailInit = true; | window._gflMailInit = true; | ||
| 第9行: | 第8行: | ||
var root = item.closest('.gfl-mail'); | var root = item.closest('.gfl-mail'); | ||
if (!root) return; | if (!root) return; | ||
root.querySelectorAll('.gfl-detail.is-open').forEach(function (d) { | root.querySelectorAll('.gfl-detail.is-open').forEach(function (d) { | ||
d.classList.remove('is-open'); | d.classList.remove('is-open'); | ||
}); | }); | ||
var target = root.querySelector('#gflDetail-' + idx); | var target = root.querySelector('#gflDetail-' + idx); | ||
if (!target) return; | if (!target) return; | ||
root.classList.add('view-detail'); | root.classList.add('view-detail'); | ||
requestAnimationFrame(function () { | requestAnimationFrame(function () { | ||
target.classList.add('is-open'); | target.classList.add('is-open'); | ||
2026年5月21日 (四) 07:35的版本
<script> (function () {
if (window._gflMailInit) return; window._gflMailInit = true;
function openDetail(item) {
var idx = item.getAttribute('data-gfl-index');
var root = item.closest('.gfl-mail');
if (!root) return;
root.querySelectorAll('.gfl-detail.is-open').forEach(function (d) {
d.classList.remove('is-open');
});
var target = root.querySelector('#gflDetail-' + idx);
if (!target) return;
root.classList.add('view-detail');
requestAnimationFrame(function () {
target.classList.add('is-open');
});
}
function closeDetail(btn) {
var root = btn.closest('.gfl-mail');
if (!root) return;
root.querySelectorAll('.gfl-detail.is-open').forEach(function (d) {
d.classList.remove('is-open');
});
root.classList.remove('view-detail');
}
document.querySelectorAll('.gfl-item').forEach(function (item) {
item.addEventListener('click', function () { openDetail(item); });
item.addEventListener('keydown', function (e) {
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); openDetail(item); }
});
});
document.querySelectorAll('.gfl-back-btn').forEach(function (btn) {
btn.addEventListener('click', function () { closeDetail(btn); });
btn.addEventListener('keydown', function (e) {
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); closeDetail(btn); }
});
});
})(); </script>