MediaWiki:Gadget-dark-mode-toggle.js: Difference between revisions
Content deleted Content added
Fix typo Tag: Reverted |
Remove mw.uri |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 84:
var $gadgetsLink = $('link[rel="stylesheet"][href^="' + scriptPath + '?"][href*="ext.gadget."]');
if ($gadgetsLink.length) {
var
if (isOn) {
} else {
if (
// dark-mode is the only module in this link
$gadgetsLink.remove();
return;
}
.replace('ext.gadget.dark-mode,', 'ext.gadget.') // dark-mode is first in the gadget list
.replace(/,dark-mode(,|$)/, '$1')); // dark-mode is in middle or end of the list
}
$gadgetsLink.prop('href',
} else {
// No gadget-containing styles are enabled
Line 122:
// Broadcast state change to other tabs
broadcastChannel.postMessage(isOn);
}
Line 143 ⟶ 135:
togglePortlets();
actuallyToggleDarkMode();
}
Line 161 ⟶ 152:
$.when($.ready, mw.loader.using(['mediawiki.util', 'mediawiki.api
setHtmlClass();
setThemeColor();
|