User:Chlod/common.js: Difference between revisions

Content deleted Content added
No edit summary
Line 1:
// === ADDITIONAL NOTES ===
// As a JavaScript developer, I might write code here that isn'"t
// properly documented. If you want to know what a specific part
// of my common.js does, please reach out to my on my talk page.
Line 15:
url.searchParams.set("action", "raw");
url.searchParams.set("ctype", "text/javascript");
// The following likely won'"t pass any userscript usage regexes, so userscript
// imports won'"t be counted twice (only the import script version will be counted).
mw.loader.load(url.toString());
};
 
// Enable caching for resource loads, see [[User:SD0001/Making user scripts load fasterMaking_user_scripts_load_faster]], @revision 5
if(!/\bnocache=\b/.test(___location.href)){var e=function(e,t,r){return e=e.replace(/special:mypage/i,"User:"+mw.config.get("wgUserName")),$.get("https://"+t+"/w/api.php?titles="+e+"&origin=*&format=json&formatversion=2&uselang=content&maxage=86400&smaxage=86400&action=query&prop=revisions|info&rvprop=content&rvlimit=1").then((function(n){var o=n.query.pages[0];if(!o.missing){var a=o.revisions[0].content;if(r&&"text/javascript"!==r||"javascript"!==o.contentmodel){if("text/css"!==r||"css"!==o.contentmodel)return $.Deferred().reject('Refused to load "'+e+'"@'+t+": content type mismatch");mw.loader.addStyleTag(a)}else{if(2!==o.ns&&8!==o.ns)return $.Deferred().reject('Refused to load "'+e+'"@'+t+": outside User and MediaWiki space");var i=document.createElement("script");i.innerHTML=a,document.head.appendChild(i)}}}))},t=function(e){var 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]||mw.config.get("wgServerName")]:null};window.importScript=function(t){e(encodeURIComponent(t),mw.config.get("wgServerName"),"text/javascript")},window.importStyleSheet=function(t){e(encodeURIComponent(t),mw.config.get("wgServerName"),"text/css")};var r=mw.loader.load;mw.loader.load=function(n,o){var a=t(n);a?e(a[0],a[1],o):r.apply(mw.loader,Array.prototype.slice.call(arguments))};var n=mw.loader.getScript;mw.loader.getScript=function(r){var o=t(r);return o?e(o[0],o[1],"text/javascript"):n.apply(mw.loader,Array.prototype.slice.call(arguments))}}
 
Line 37:
importScript("User:Chlod/Scripts/InfringementAssistant.js"); // [[User:Chlod/Scripts/InfringementAssistant.js]]
importScript("User:Chlod/Scripts/Coordinator.js"); // [[User:Chlod/Scripts/Coordinator.js]]
importScript('"User:GoldenRingChlod/wordcountScripts/WordCount.js'"); // Backlink: [[User:GoldenRingChlod/Scripts/wordcountWordCount.js]]
// Loaded globally.
// importScript("User:Chlod/Scripts/GoToTitle.js"); // [[User:Chlod/Scripts/GoToTitle.js]]
Line 89 ⟶ 90:
importScript("User:Awesome Aasim/rcpatrol.js"); // [[User:Awesome Aasim/rcpatrol.js]]
importScript("User:DannyS712/DiscussionCloser.js"); // [[User:DannyS712/DiscussionCloser.js]]
importScript('"User:Enterprisey/rfa-count-toolbar.js'"); // Backlink: [[User:Enterprisey/rfa-count-toolbar.js]]
importScript('User:GoldenRing/wordcount.js'); // Backlink: [[User:GoldenRing/wordcount.js]]