MediaWiki:Common.js: Difference between revisions
No edit summary Tag: Manual revert |
No edit summary |
||
| Line 72: | Line 72: | ||
}); | }); | ||
} | } | ||
})(); | |||
(function () { | |||
var KEY = 'icelist_notice_closed'; | |||
// anon users only | |||
if (!mw.user.isAnon()) return; | |||
var notice = document.getElementById('siteNotice'); | |||
if (!notice) return; | |||
// already dismissed | |||
if (localStorage.getItem(KEY) === '1') { | |||
notice.style.display = 'none'; | |||
return; | |||
} | |||
// create close button | |||
var btn = document.createElement('button'); | |||
btn.textContent = '×'; | |||
btn.setAttribute('aria-label', 'Close'); | |||
btn.className = 'icelist-notice-close'; | |||
notice.appendChild(btn); | |||
btn.addEventListener('click', function () { | |||
notice.style.display = 'none'; | |||
localStorage.setItem(KEY, '1'); | |||
}); | |||
})(); | })(); | ||