User:Hamish/TwinkleGlobal.js
Appearance
From Meta, a Wikimedia project coordination wiki
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.
/** * Forked from https://zh.wikipedia.org/w/index.php?oldid=45972864 * @see [[User:Xiplus/TwinkleGlobal]] * @author [[User:逆襲的天邪鬼]] * @author [[User:Xiplus]] * @author [[User:WhitePhosphorus]] */ (function(){ varVERSION='20200525165249'; varPREFIX='User:Hamish/Twinkle/'; varrebuildcache=localStorage.Twinkle_global_hamishdev_version!==VERSION; vartests=[]; varapi; varajax=function(title){ returnapi.get({ 'action':'query', 'format':'json', 'prop':'revisions', 'titles':title, 'rvprop':'content' }).then(function(data){ for(varkeyindata.query.pages){// eslint-disable-line guard-for-in returndata.query.pages[key].revisions[0]['*']; } }); }; varload=function(p){ vardone=function(data){ if(rebuildcache||!localStorage['Twinkle_global_hamishdev_'+p.name]){ localStorage['Twinkle_global_hamishdev_'+p.name]=data; } }; if(localStorage['Twinkle_global_hamishdev_'+p.name]&&!rebuildcache){ return$.Deferred().resolve(localStorage['Twinkle_global_hamishdev_'+p.name]); } if(p.test){ returnajax(PREFIX+p.name).done(done); } returnajax('MediaWiki:Gadget-'+p.name).done(done); }; varmessage=function(text){ console.log('[Twinkle_global_hamishdev]',text);// eslint-disable-line no-console // $('#simpleSearch input[type="search"]').attr('placeHolder', text); }; tests.push({name:'morebits.js',test:true}); tests.push({name:'twinkle.js',test:true}); tests.push({name:'modules/twinklearv.js',test:true}); // tests.push({name: 'modules/twinklewarn.js', test: true}); // tests.push({name: 'modules/friendlyshared.js', test: true}); // tests.push({name: 'modules/friendlytag.js', test: true}); // tests.push({name: 'modules/friendlytalkback.js', test: true}); // tests.push({name: 'modules/twinklebatchdelete.js', test: true}); // tests.push({name: 'modules/twinklebatchundelete.js', test: true}); // tests.push({name: 'modules/twinkleblock.js', test: true}); // tests.push({name: 'modules/twinkleclose.js', test: true}); tests.push({name:'modules/twinkleconfig.js',test:true}); // tests.push({name: 'modules/twinklecopyvio.js', test: true}); // tests.push({name: 'modules/twinkledelimages.js', test: true}); tests.push({name:'modules/twinklediff.js',test:true}); tests.push({name:'modules/twinklefluff.js',test:true}); // tests.push({name: 'modules/twinkleimage.js', test: true}); // tests.push({name: 'modules/twinkleprotect.js', test: true}); tests.push({name:'modules/twinklespeedy.js',test:true}); // tests.push({name: 'modules/twinklestub.js', test: true}); // tests.push({name: 'modules/twinkleunlink.js', test: true}); // tests.push({name: 'modules/twinklexfd.js', test: true}); functionmain(){ if(mw.config.get('wgServer')==='//meta.wikimedia.org'){ api=newmw.Api(); }else{ api=newmw.ForeignApi('https://meta.wikimedia.org/w/api.php'); } mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:Hamish/Twinkle/morebits.css&action=raw&ctype=text/css','text/css'); varfinished=0; varcode=[]; // all message('Loading Twinkle_global_hamishdev...'); vardone=function(x){ returnfunction(data){ finished++; message('Loading Twinkle_global_hamishdev... ('+finished+'/'+tests.length+')'); code[x]=data; if(x===tests.length-1){ localStorage.Twinkle_global_hamishdev_version=VERSION; eval(code.join('\n;\n')); message('Twinkle Done'); if($('#twinkleglobal-config-titlebar').length){ $('#twinkleglobal-config-titlebar').append('--Version: hamishdev '+localStorage.Twinkle_global_hamishdev_version); $('#twinkleglobal-config-titlebar').append('<button onclick="localStorage.Twinkle_global_hamishdev_version = \'\';location.reload();">Purge</button>'); } }else{ load(tests[x+1]).done(done(x+1)); } }; }; load(tests[0]).done(done(0)); } mw.loader.using(['mediawiki.user','mediawiki.util','mediawiki.Title','jquery.ui','jquery.tipsy','mediawiki.api','mediawiki.ForeignApi']).done(function(){ main(); }); })();