Jump to content

User:HouseBlaster/common.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Enable caching for resource loads, see [[User:SD0001/Making user scripts load faster]], @revision 7
if(!/\bnocache=\b/.test(location.href)){let e=mw.config.values,t="text/javascript",r="text/css",n=(n,o,i)=>(n=n.replace(/special:mypage/i,"User:"+e.wgUserName),$.get("https://"+o+"/w/api.php?titles="+n+"&origin=*&format=json&formatversion=2&uselang=content&maxage=86400&smaxage=86400&action=query&prop=revisions|info&rvprop=content&rvlimit=1&inprop=protection").then(e=>{let a=e.query.pages[0];if(!a.missing){if(2!==a.ns&&8!==a.ns&&!a.protection.find(e=>"edit"===e.type&&"sysop"===e.level))return $.Deferred().reject('Refused to load "'+n+'"@'+o+": unprotected page");let l=a.revisions[0].content;if(i&&i!==t||"javascript"!==a.contentmodel){if(i!==r||"css"!==a.contentmodel)return $.Deferred().reject('Refused to load "'+n+'"@'+o+": content type mismatch");mw.loader.addStyleTag(l)}else document.head.appendChild(document.createElement("script")).innerHTML=l}})),o=e.wgServerName,i=e=>{let t=/^(?:(?:https:)?\/\/(.*))?\/w\/index.php/.exec(e),r=/\btitle=([^=?&]*)/.exec(e);return t&&r&&/\baction=raw\b/.test(e)&&/\bctype=/.test(e)?[r[1],t[1]||o]:null};window.importScript=e=>{n(encodeURIComponent(e),o,t)},window.importStyleSheet=e=>{n(encodeURIComponent(e),o,r)};let a=mw.loader.load;mw.loader.load=function(e,t){let r=i(e);r?n(r[0],r[1],t):a.apply(mw.loader,[...arguments])};let l=mw.loader.getScript;mw.loader.getScript=function(e){let r=i(e);return r?n(r[0],r[1],t):l.apply(mw.loader,[...arguments])}}

importScript('User:HouseBlaster/MoveToDraft.js'); // Backlink: [[User:HouseBlaster/MoveToDraft.js]]
importScript('User:Evad37/rater.js'); // Backlink: [[User:Evad37/rater.js]]
importScript('User:Anomie/talklink.js'); // Backlink: [[User:Anomie/talklink.js]]
importScript('User:Danski454/hotcat-summary.js'); //Backlink: [[User:Danski454/hotcat-summary.js]]
importScript('User:Novem Linguae/Scripts/UserRightsDiff.js'); // Backlink: [[User:Novem Linguae/Scripts/UserRightsDiff.js]]
importScript('User:Ahecht/Scripts/pageswap.js'); // Backlink: [[User:Ahecht/Scripts/pageswap.js]]
importScript('User:HouseBlaster/AutoEd.js'); //Backlink: [[User:HouseBlaster/AutoEd.js]]
importScript('User:Anomie/unsignedhelper.js'); // Backlink: [[User:Anomie/unsignedhelper.js]]
importScript('User:Trappist the monk/HarvErrors.js'); //Backlink: [[User:Trappist the monk/HarvErrors.js]]
importScript('User:Ohconfucius/script/MOSNUM dates.js'); //Backlink: [[User:Ohconfucius/script/MOSNUM dates.js]]
importScript('User:PleaseStand/userinfo.js'); // Backlink: [[User:PleaseStand/userinfo.js]]
importScript('User:Ahecht/Scripts/refresh.js'); // Backlink: [[User:Ahecht/Scripts/refresh.js]]
importScript('User:SD0001/shortdescs-in-category.js'); // Backlink: [[User:SD0001/shortdescs-in-category.js]]
importScript('User:SD0001/RFUD-helper.js'); // Backlink: [[User:SD0001/RFUD-helper.js]]
importScript('User:MusikAnimal/userRightsManager.js'); // Backlink: [[User:MusikAnimal/userRightsManager.js]]
importScript('User:L235/wordcount.js'); // Backlink: [[User:L235/wordcount.js]]
importStylesheet('User:HouseBlaster/talklink.css'); // Backlink: [[User:HouseBlaster/talklink.css]]
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Nardog/RefRenamer.js&action=raw&ctype=text/javascript'); // Backlink: [[User:Nardog/RefRenamer.js]]
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Nardog/CatChangesViewer.js&action=raw&ctype=text/javascript'); // Backlink: [[User:Nardog/CatChangesViewer.js]]
if (mw.config.get('wgCanonicalSpecialPageName') === 'Blankpage') { //load lintHint, but only in special namespace

// lintHint
// create a user defined object
var myLintHints = { };

myLintHints.rooms = "-";

// communicate user defined object
mw.hook( "lintHint.config" ).fire( myLintHints );

// finally, load gadget
importScript('User:PerfektesChaos/js/lintHint/r.js'); // Backlink: [[User:PerfektesChaos/js/lintHint/r.js]]
}

if (mw.config.get('wgNamespaceNumber') === 14) { // load Cat-a-lot in Category namespace
	importScript('User:קיפודנחש/cat-a-lot.js'); // Backlink: [[User:קיפודנחש/cat-a-lot.js]]
}  

if ((mw.config.get('wgPageName').substring(0, 35) === "Wikipedia:Categories_for_discussion") || (mw.config.get('wgPageName').substring(0, 35) === "Wikipedia:Templates_for_discussion")) { 
var LoadXFDDelay = setInterval(function () { // load [[User:Nardog/CopySectLink.js]] never (it doesn't work with XFDC)
clearInterval(LoadXFDDelay);
importScript('User:Qwerfjkl/scripts/CFDlister.js'); // Backlink: [[User:Qwerfjkl/scripts/CFDlister.js]]
importScript('User:HouseBlaster/HighlightCFD.js'); // [[User:HouseBlaster/HighlightCFD.js]], with massive credit to [[User:Anomie]]'s [[User:Anomie/linkclassifier.js]]
},3000) } else {
	mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Nardog/CopySectLink.js&action=raw&ctype=text/javascript');
}