User:Eatcha/night.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
Documentation for this user script can be added at User:Eatcha/night. |
- Report page listing warnings and errors.
$(function() {
var _0x8bd2x1 = 'on' === mw['storage']['get']('nightpedia'),
_0x8bd2x2 = _0x8bd2x1 ? _0x8bd2x5() : false;
mw['util']['addPortletLink']('p-personal', '#', _0x8bd2x1 ? 'Daypedia' : 'Nightpedia', 'pt-nightpedia', '', 'np', '#pt-watchlist');
$('#pt-nightpedia')['on']('click', function(_0x8bd2x3) {
_0x8bd2x3['preventDefault']();
_0x8bd2x1 = !_0x8bd2x1;
if (_0x8bd2x1) {
_0x8bd2x5()
} else {
_0x8bd2x4()
}
});
function _0x8bd2x4() {
$('html')['removeClass']('nighttime');
$('#pt-nightpedia a')['text']('Nightpedia');
mw['storage']['set']('nightpedia', 'off')
}
function _0x8bd2x5() {
if (!_0x8bd2x2) {
$('head')['append'](mw['loader']['load']('https://en.wikipedia.org/w/index.php?title=User:MusikAnimal/nightpedia.css&action=raw&ctype=text/css', 'text/css'))
};
$('html')['addClass']('nighttime');
$('#pt-nightpedia a')['text']('Daypedia');
mw['storage']['set']('nightpedia', 'on');
return true
}
})