MediaWiki:Gadget-dark-mode-toggle.js: Difference between revisions
Content deleted Content added
Rvt edits by Jon (WMF) per talk |
migrate from deprecated mw.Uri to native URL |
||
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
|