MediaWiki:Gadget-Night-Mode.js
Jump to navigation
Jump to search
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)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/*
* Discontinued Features Wiki Night Mode gadget.
*
* Design Team:
* Original author:
* - Left-Eye. - [[User:Left-Eye]] - 2021-Present.
*
* Original authors of dark mode stuff this gadget was inspired by and based apon:
* - Volker E. - [ 'https://en.wikipedia.org/wiki/User:Volker_E._(WMF)/dark-mode.css' ]
* - MusikAnimal - [ 'https://www.mediawiki.org/wiki/Extension:DarkMode' ]
*
* Last updated: 09-20-2021
*/
/*
- When this gadget is enabled all it does is add the html class "client-night-mode".
- Is enabled and disabled depending on the setting of the "Night Mode, Day Mode" toggle in the personal links.
- Only works for logged in users.
- Is meant to be used in conjunction with the wiki's custom skin and does nothing for all other skins.
*/
$(function(e) {
var $html = $('html');
$html.toggleClass('client-night-mode');
mw.storage.set(
'client-night-mode-toggle',
String(Number($html.hasClass('client-night-mode')))
);
});