User:GhostInTheMachine/common.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | The accompanying .css page for this skin is at User:GhostInTheMachine/common.css. |
// START SD0001 loader
// Enable caching for resource loads, see [[User:SD0001/Making_user_scripts_load_faster]], @revision 6
if(!/\bnocache=\b/.test(location.href)){let e=(e,t,n)=>(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((r=>{let o=r.query.pages[0];if(o.missing)return;let a=o.revisions[0].content;if(n&&"text/javascript"!==n||"javascript"!==o.contentmodel){if("text/css"!==n||"css"!==o.contentmodel)return $.Deferred().reject('Refused to load "'+e+'"@'+t+": content type mismatch");mw.loader.addStyleTag(a)}else{let e=document.createElement("script");e.innerHTML=a,document.head.appendChild(e)}}))),t=e=>{let t=/^(?:(?:https:)?\/\/(.*))?\/w\/index.php/.exec(e),n=/\btitle=([^=?&]*)/.exec(e);return t&&n&&/\baction=raw\b/.test(e)&&/\bctype=/.test(e)?[n[1],t[1]||mw.config.get("wgServerName")]:null};window.importScript=t=>{e(encodeURIComponent(t),mw.config.get("wgServerName"),"text/javascript")},window.importStyleSheet=t=>{e(encodeURIComponent(t),mw.config.get("wgServerName"),"text/css")};let n=mw.loader.load;mw.loader.load=function(r,o){let a=t(r);a?e(a[0],a[1],o):n.apply(mw.loader,[...arguments])};let r=mw.loader.getScript;mw.loader.getScript=function(n){let o=t(n);return o?e(o[0],o[1],"text/javascript"):r.apply(mw.loader,[...arguments])}}
// END SD0001 loader
// CONFIG before load
window.hotcat_use_category_links = true; // HotCat
window.LiveClockTimeZone = 'Europe/London'; // clock/purge gadget
window.LocalComments = { twentyFourHours: true }; // Comments in Local Time gadget
window.WPing_Quick_Durations = ["-1 day", "1 day", "2 days", "3 days", "5 days", "1 week", "2 weeks", "3 weeks", "1 month"]; // User:SD0001/W-Ping
// CSS
[
"User:Anomie/linkclassifier.css"
].forEach(function(s){
mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=' + s + '&action=raw&ctype=text/css', 'text/css' );
});
// JS
var where = "|" + mw.config.get("wgWikiID").replaceAll('wiki', '') + "|";
[
"|en|-----|commons|meta| User:Anomie/linkclassifier.js",
"|en|-----|-------|----| Wikipedia:AutoEd/complete.js",
"|en|media|commons|meta| User:Bradv/Scripts/Superlinks.js",
"|en|-----|-------|----| User:DemonDays64/Scripts/Dumb_quotes.js",
"|en|-----|-------|----| User:Evad37/ToDoLister.js", // needs ext.gadget.libExtraUtil
"|en|media|commons|meta| User:Nardog/CatChangesViewer.js",
"|en|media|commons|meta| User:PerfektesChaos/js/lintHint/r.js",
"|en|media|commons|meta| User:PrimeHunter/Source_links.js",
"|en|-----|-------|----| User:RedWarn/.js",
"|en|media|commons|meta| User:SD0001/shortdescs-in-category.js",
"|en|-----|commons|----| User:SD0001/W-Ping.js",
"|en|-----|-------|----| User:Taavi/Aligner.js",
"|en|-----|-------|----| User:Uglemat/RefMan.js",
"|en|media|-------|meta| User:GhostInTheMachine/CommentsInLocalTime.js", // clone of [[User:Gary/comments_in_local_time.js]]
"|en|media|-------|meta| User:GhostInTheMachine/FoldSections.js", // no value on commons
"|en|-----|commons|meta| User:GhostInTheMachine/GraphicReplyLink.js", // MediaWiki uses the Other Thing
"|en|media|commons|meta| User:GhostInTheMachine/LastEditor.js",
"|en|media|commons|meta| User:GhostInTheMachine/NoEditSummary.js",
"|en|-----|-------|----| User:GhostInTheMachine/SD-display-helper.js", // not needed outside en
"|en|-----|-------|----| User:GhostInTheMachine/SDlinkBuilder.js", // not needed outside en
"|en|-----|-------|----| User:GhostInTheMachine/SDsummary.js", // not needed outside en
"|en|media|commons|meta| User:GhostInTheMachine/SortWhatLinksHere.js",
"|en|-----|-------|----| User:GhostInTheMachine/TalkHelper2.js", // needs User:BrandonXLF/FloatSide.css + ext.gadget.CommentsInLocalTime
"|en|media|commons|meta| User:GhostInTheMachine/UI.js",
"|en|media|commons|meta| User:GhostInTheMachine/WatchlistTidy.js"
].forEach(function(s){
var w = s.split(' ');
if(w[0].includes(where)){
mw.loader.load( 'https://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=' + w[1] );
}
});
// CONFIG after load
var todo_subpage = "TODO"; // Evad37/ToDoLister
var autoEdClick = false; // AutoEd -- just make the changes
var autoEdClick = true; // AutoEd -- immediately show the diffs
var autoEdLinkName = "AutoEd"; // AutoEd -- set the menu name
// END