MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
/* ICE List | /* === ICE List Site Notice Close Button (Minimal, Safe) === */ | ||
mw.hook('wikipage.content').add(function () { | |||
(function () { | |||
if (!mw.user.isAnon()) return; | if (!mw.user.isAnon()) return; | ||
| Line 82: | Line 7: | ||
if (!notice) return; | if (!notice) return; | ||
// | // Already dismissed | ||
if (localStorage.getItem( | if (localStorage.getItem('icelist_notice_closed') === '1') { | ||
notice.style.display = 'none'; | notice.style.display = 'none'; | ||
return; | return; | ||
} | } | ||
// | // Prevent duplicate buttons | ||
if (notice.querySelector('.icelist-notice-close')) return; | |||
var btn = document.createElement('button'); | var btn = document.createElement('button'); | ||
btn.className = 'icelist-notice-close'; | |||
btn.setAttribute('aria-label', 'Close'); | |||
btn.textContent = '×'; | btn.textContent = '×'; | ||
btn. | |||
btn.onclick = function () { | |||
notice.style.display = 'none'; | |||
localStorage.setItem('icelist_notice_closed', '1'); | |||
}; | |||
notice.appendChild(btn); | notice.appendChild(btn); | ||
}); | |||
Revision as of 14:46, 20 December 2025
/* === ICE List Site Notice Close Button (Minimal, Safe) === */
mw.hook('wikipage.content').add(function () {
if (!mw.user.isAnon()) return;
var notice = document.getElementById('siteNotice');
if (!notice) return;
// Already dismissed
if (localStorage.getItem('icelist_notice_closed') === '1') {
notice.style.display = 'none';
return;
}
// Prevent duplicate buttons
if (notice.querySelector('.icelist-notice-close')) return;
var btn = document.createElement('button');
btn.className = 'icelist-notice-close';
btn.setAttribute('aria-label', 'Close');
btn.textContent = '×';
btn.onclick = function () {
notice.style.display = 'none';
localStorage.setItem('icelist_notice_closed', '1');
};
notice.appendChild(btn);
});