Jump to content
Wikimedia Meta-Wiki

User:Jdlrobson/global.js

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by Jdlrobson (talk | contribs) at 02:01, 29 May 2024. It may differ significantly from the current version .

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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
 mw.trackSubscribe('resourceloader.exception',function(topic,data){
 alert(topic+JSON.stringify(data));
 $('body').addClass('user-jdlrobson-error');
 });
 // setup the global error handler
 mw.trackSubscribe('global.error',function(topic,error){
 alert(JSON.stringify(error));alert(topic);
 $('body').addClass('user-jdlrobson-error');
 });

 mw.trackSubscribe('global.error',console.log.bind(console))

 mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Jdlrobson/readingList.js&action=raw&ctype=text/javascript');


 (function(){
 constc=document.documentElement.classList;
 if(mw.user.options.values[mw.config.get('skin')+'-theme']==='day')return;
 if(c.contains('skin-night-mode-page-disabled')||c.contains('skin-theme-clientpref--excluded')){
 c.remove('skin-night-mode-page-disabled');
 c.remove('skin-theme-clientpref--excluded');

 c.add('skin-theme-clientpref-night');
 constbtn=document.createElement('button');
 btn.textContent='restore day theme';
 btn.setAttribute('style','position: fixed; bottom: 0; right: 0;');
 document.body.appendChild(btn);
 btn.addEventListener('click',()=>{
 c.add('skin-night-mode-page-disabled');
 c.remove('skin-theme-clientpref-night');
 });
 }
 }());

AltStyle によって変換されたページ (->オリジナル) /