MediaWiki:Common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
(function () {
const banner = document.getElementById('icelist-donate-banner');
if (!banner) return;
if (localStorage.getItem('icelistDonateBannerDismissed') === 'true') {
banner.style.display = 'none';
return;
}
const dismiss = document.getElementById('icelist-donate-dismiss');
if (dismiss) {
dismiss.addEventListener('click', function () {
banner.style.display = 'none';
localStorage.setItem('icelistDonateBannerDismissed', 'true');
});
}
})();
(function(){
var KEY = 'donate_notice_dismissed';
if (localStorage.getItem(KEY)) return;
mw.hook('wikipage.content').add(function(){
var close = document.getElementById('donate-notice-close');
var notice = document.getElementById('donate-top-notice');
if (!close || !notice) return;
close.addEventListener('click', function(){
notice.style.display = 'none';
localStorage.setItem(KEY, '1');
});
});
})();
(function () {
var KEY = 'icelist_donate_notice_until';
var DAYS = 14;
if (!mw.user.isAnon()) return;
var until = parseInt(localStorage.getItem(KEY) || '0', 10);
if (Date.now() < until) return;
function mount() {
var siteNotice = document.getElementById('siteNotice');
if (!siteNotice) return;
// If Anonnotice is empty, don't show anything
var existingText = (siteNotice.textContent || '').trim();
if (!existingText) return;
siteNotice.innerHTML = '';
siteNotice.insertAdjacentHTML('beforeend',
'<div id="donate-top-notice">' +
'<div class="donate-notice-inner">' +
'<span class="donate-title">Support ICE List</span>' +
'<span class="donate-text">We document federal immigration enforcement, identify agents, and preserve evidence that would otherwise disappear. Donations keep this work public, independent, and alive.</span>' +
'<a class="donate-btn" href="' + mw.util.getUrl('ICE_List_Wiki:Donate') + '">Donate</a>' +
'<button id="donate-notice-close" aria-label="Close">×</button>' +
'</div>' +
'</div>'
);
document.getElementById('donate-notice-close').addEventListener('click', function () {
document.getElementById('donate-top-notice').style.display = 'none';
localStorage.setItem(KEY, String(Date.now() + DAYS * 24 * 60 * 60 * 1000));
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', mount);
} else {
mount();
}
})();