User:Chlod/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:Chlod/common.css. |
// === 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.
//
// Thank you! Have a nice day.
//
// PS: Whoever uses single quotes for strings is a monster.
mw.loader.using(["mediawiki.Title"], function () {
// Override importScript to use mw.loader
window.importScript = function (page, oldid) {
const url = new URL("/w/index.php", window.location.href);
url.searchParams.set("title", new mw.Title(page).getPrefixedDb());
if (oldid != null)
url.searchParams.set("oldid", oldid);
url.searchParams.set("action", "raw");
url.searchParams.set("ctype", "text/javascript");
mw.loader.load(url.toString());
};
// === SCRIPTS BY OTHER USERS ===
// use <nowiki>{{lusc|script}}</nowiki>
// Enable caching for resource loads, see [[User:SD0001/Making 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))}}
if (window.rw == null)
importScript("User:RedWarn/.js"); // [[User:RedWarn/.js]]
importScript("User:Þjarkur/NeverUseMobileVersion.js"); // [[User:Þjarkur/NeverUseMobileVersion.js]]
// importScript("User:Evad37/EditWarChecker.js"); // [[User:Evad37/EditWarChecker.js]]
importScript("User:BrandonXLF/QuickEdit.js"); // [[User:BrandonXLF/QuickEdit.js]]
// importScript("User:Mxn/CommentsInLocalTime.js"); // [[User:Mxn/CommentsInLocalTime.js]]
importScript("User:Mvolz/displayContributions.js"); // [[User:Mvolz/displayContributions.js]]
importScript("User:Anne drew Andrew and Drew/PageDetails.js"); // [[User:Anne drew Andrew and Drew/PageDetails.js]]
importScript("User:Enterprisey/fancy-diffs.js"); // [[User:Enterprisey/fancy-diffs.js]]
importScript("User:Amorymeltzer/userinfo.js"); // [[User:Amorymeltzer/userinfo.js]]
importScript("User:Evad37/rename editors.js"); // [[User:Evad37/rename editors.js]]
importScript("User:Enterprisey/cv-revdel.js"); // [[User:Enterprisey/cv-revdel.js]]
importScript("User:Zhaofeng Li/Reflinks.js"); // [[User:Zhaofeng Li/Reflinks.js]]
importScript("User:Evad37/OneClickArchiver.js"); // [[User:Evad37/OneClickArchiver.js]]
importScript("User:Bradv/endlesscontribs.js"); // [[User:Bradv/endlesscontribs.js]]
// importScript("User:Bradv/Scripts/Superlinks.js"); // [[User:Bradv/Scripts/Superlinks.js]]
importScript("User:Wugapodes/Capricorn.js"); // [[User:Wugapodes/Capricorn.js]]
importScript("User:Awesome Aasim/noeditredlinks.js"); // [[User:Awesome Aasim/noeditredlinks.js]]
// importScript("User:P999/Toggle VF.js"); // [[User:P999/Toggle VF.js]]
importScript("User:Anomie/unsignedhelper.js"); // [[User:Anomie/unsignedhelper.js]]
importScript("User:Evad37/MoveToDraft.js"); // [[User:Evad37/MoveToDraft.js]]
importScript("User:Jackmcbarn/editProtectedHelper.js"); // [[User:Jackmcbarn/editProtectedHelper.js]]
// importScript("User:Evad37/rater.js"); // [[User:Evad37/rater.js]]
// importScript("User:Writ Keeper/Scripts/massRollback.js"); // [[User:Writ Keeper/Scripts/massRollback.js]]
importScript("User:SuperHamster/CiteUnseen.js"); // [[User:SuperHamster/CiteUnseen.js]]
importScript("User:BrandonXLF/CSSImageCrop.js"); // [[User:BrandonXLF/CSSImageCrop.js]]
importScript("User:Awesome Aasim/rcpatrol.js"); // [[User:Awesome Aasim/rcpatrol.js]]
importScript("User:DannyS712/DiscussionCloser.js"); // [[User:DannyS712/DiscussionCloser.js]]
// Disabling this on typhoon articles due to the massive page load lag.
if (!/(typhoon|hurricane|cyclone) season$/gi.test(mw.config.get("wgPageName")))
importScript("User:Novem Linguae/Scripts/CiteHighlighter.js"); // [[User:Novem Linguae/Scripts/CiteHighlighter.js]]
// This conflicts with RecentChanges styling.
if (mw.config.get("wgPageName") !== "Special:RecentChanges")
importScript("User:Bradv/Scripts/ExpandDiffs.js"); // [[User:Bradv/Scripts/ExpandDiffs.js]]
// === STYLESHEETS BY OTHER USERS ===
if (mw.config.get("skin") !== "vector-2022")
importStylesheet("User:BrandonXLF/FloatHead.css"); // [[User:BrandonXLF/FloatHead]]
// === EVERYTHING BELOW THIS POINT WAS WRITTEN BY "Chlod" ===
// I take responsibility for whatever is written below this section, including sublinks.
// importScript("User:Chlod/Scripts/RCP-CV Quicklink.js"); // [[User:Chlod/Scripts/RCP-CV Quicklink.js]]
importScript("User:Chlod/Scripts/UserHighlighter.js"); // [[User:Chlod/Scripts/UserHighlighter.js]]
importScript("User:Chlod/Scripts/DirectPDFDownload.js"); // [[User:Chlod/Scripts/DirectPDFDownload.js]]
importScript("User:Chlod/Scripts/GlobalUserToolbox.js"); // [[User:Chlod/Scripts/GlobalUserToolbox.js]]
importScript("User:Chlod/Scripts/ReferenceDeselector.js"); // [[User:Chlod/Scripts/ReferenceDeselector.js]]
importScript("User:Chlod/Scripts/NewTabMMVDetails.js"); // [[User:Chlod/Scripts/NewTabMMVDetails.js]]
importScript("User:Chlod/Scripts/StormCountTally.js"); // [[User:Chlod/Scripts/StormCountTally.js]]
// Loaded globally.
// importScript("User:Chlod/Scripts/GoToTitle.js"); // [[User:Chlod/Scripts/GoToTitle.js]]
importScript("User:Chlod/Scripts/FoldArchives.js"); // [[User:Chlod/Scripts/FoldArchives.js]]
importScript("User:Chlod/Scripts/AjaxRollbackSummary.js"); // [[User:Chlod/Scripts/AjaxRollbackSummary.js]]
importScript("User:Chlod/Scripts/SectionLink.js"); // [[User:Chlod/Scripts/SectionLink.js]]
importScript("User:Chlod/Scripts/CopiedTemplateEditor-loader.js"); // [[User:Chlod/Scripts/CopiedTemplateEditor-loader.js]]
importScript("User:Chlod/Scripts/InfringementAssistant.js"); // [[User:Chlod/Scripts/InfringementAssistant.js]]
importScript("User:Chlod/Scripts/Coordinator.js"); // [[User:Chlod/Scripts/Coordinator.js]]
// common.js link at hotbar.
mw.util.addPortletLink(
"p-personal",
"/wiki/Special:MyPage/common.js",
"common.js",
"pt-cjs",
"Open your common.js file.",
null,
"#pt-logout"
);
// importScript("User:Chlod/sandbox.js");
});