Skip to content

Commit c04fd2d

Browse files
committed
update footer
1 parent bc49929 commit c04fd2d

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

_includes/footer.html

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
</footer>
4040
<script>
4141
(function() {
42+
// 如果本会话已关闭过提示,则不再显示
43+
if (sessionStorage.getItem('domainNoticeClosed')) return;
44+
4245
// 创建提示条容器
4346
const div = document.createElement('div');
4447
div.id = 'domain-notice';
@@ -47,16 +50,17 @@
4750
<div class="domain-notice-inner">
4851
<p>
4952
提示:本站域名已由
50-
<a href="https://imas-sp.com" target="_blank" style="color:#ffd700;text-decoration:underline;">imas-sp.com</a>
53+
<a href="https://imas-sp.com" target="_blank" style="color:#ffd700;text-decoration:underline;">imas-sp.com</a>
5154
迁移至
52-
<a href="https://sp.idolmaster.top" target="_blank" style="color:#ffd700;text-decoration:underline;">sp.idolmaster.top</a>。请更新您的书签。
55+
<a href="https://sp.idolmaster.top" target="_blank" style="color:#ffd700;text-decoration:underline;">sp.idolmaster.top</a>。
56+
请更新您的书签。
5357
</p>
5458
<button id="close-domain-notice">我知道了</button>
5559
</div>
5660
`;
5761
document.body.appendChild(div);
5862

59-
// 样式(含过渡)
63+
// 样式
6064
const style = document.createElement('style');
6165
style.innerHTML = `
6266
#domain-notice {
@@ -115,7 +119,6 @@
115119
});
116120

117121
// 隐藏函数
118-
let hideTimer = null;
119122
function hide(immediate = false) {
120123
const inner = document.querySelector('.domain-notice-inner');
121124
if (!inner) return;
@@ -124,20 +127,15 @@
124127
}
125128
inner.style.transform = 'translateY(120%)';
126129
inner.style.opacity = '0';
127-
clearTimeout(hideTimer);
128130
setTimeout(() => {
129131
const container = document.getElementById('domain-notice');
130132
if (container) container.remove();
131133
}, 320);
132134
}
133135

134-
// 自动 3 秒隐藏
135-
const autoHideTimeout = 3000;
136-
hideTimer = setTimeout(() => hide(false), autoHideTimeout);
137-
138-
// 点击按钮立即隐藏
136+
// 点击“我知道了”关闭提示,并标记为已关闭(仅当前会话)
139137
document.getElementById('close-domain-notice').addEventListener('click', () => {
140-
clearTimeout(hideTimer);
138+
sessionStorage.setItem('domainNoticeClosed', '1');
141139
hide(true);
142140
});
143141

0 commit comments

Comments
 (0)