MediaWiki:Common.js: Difference between revisions

Fix dark mode notice not attaching to DOM if previously dismissed
(Ensure darkModeNoticeElem always defined regardless of previous dismissal of prompt (in case user clicks 'Dark Mode' links))
(Fix dark mode notice not attaching to DOM if previously dismissed)
Line 608: Line 608:
newDiv.style.cssText = 'display:none; max-width:100%; width:100%; text-align:center;';
newDiv.style.cssText = 'display:none; max-width:100%; width:100%; text-align:center;';
darkModeNoticeElem = newDiv;
darkModeNoticeElem = newDiv;
const cnElem = document.getElementById('mw-content');
if (cnElem !== null) {
cnElem.insertBefore(darkModeNoticeElem, cnElem.firstChild);
}
if (!darkModeNoticeDismissed) {
if (!darkModeNoticeDismissed) {
const cnElem = document.getElementById('mw-content');
if (cnElem !== null) {
cnElem.insertBefore(darkModeNoticeElem, cnElem.firstChild);
}
darkModeNoticeToggle();
darkModeNoticeToggle();
if (darkModeSchemeQuery.addEventListener) {
if (darkModeSchemeQuery.addEventListener) {