// 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])}}
window.hh_highlight = "lightgreen";
importScript('User:Guywan/Scripts/HistoryHighlight.js'); // Backlink: [[User:Guywan/Scripts/HistoryHighlight.js]]
importScript('User:Andrybak/Archiver.js'); // fork of [[User:Σ/Testing facility/Archiver]]
mw.loader.load( '/w/index.php?title=User:Joeytje50/JWB.js/load.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:Joeytje50/JWB.js/load.js]]
importScript('User:Andrybak/user-tabs-on-contribs.js'); // Backlink: [[User:Andrybak/user-tabs-on-contribs.js]]
importScript('User:קיפודנחש/cat-a-lot.js'); // Backlink: [[User:קיפודנחש/cat-a-lot.js]]
importScript('User:Jackmcbarn/editProtectedHelper.js'); // Backlink: [[User:Jackmcbarn/editProtectedHelper.js]]
if (mw.config.get('wgPageName') != 'Main_Page') {
importScript('User:Enterprisey/copy-section-link.js'); // Backlink: [[User:Enterprisey/copy-section-link.js]]
}
importScript('User:GorillaWarfare/script/curlies.js'); // Backlink: [[User:GorillaWarfare/script/curlies.js]]
importScript('User:Enterprisey/diff-permalink-2.js'); // Backlink: [[User:Enterprisey/diff-permalink-2.js]]
importScript('User:DannyS712/Draft no cat.js'); // Backlink: [[User:DannyS712/Draft no cat.js]]
importScript('User:Novem Linguae/Scripts/UserRightsDiff.js'); // Backlink: [[User:Novem Linguae/Scripts/UserRightsDiff.js]]
importScript('User:Andrybak/Not around.js'); // Backlink: [[User:Andrybak/Not around.js]]
// Enable ↑ ↓ links of HotCat
window.hotcat_use_category_links = true;
/*
* Add custom CharInsert entries. See instructions at [[MediaWiki talk:Edittools]] and
* [[Help:CharInsert#Customization]] and comments in [[MediaWiki:Gadget-charinsert-core.js]]
*/
window.charinsertCustom = {
"Wiki markup": ' Wikilinks: [[Template:+]] Templates: {\{Sandbox.other||+}} {\{para|+}} <var>+</var> <syntaxhighlight.lang="wikitext">\n+\n</syntaxhighlight> <code><nowiki>+</nowiki></code> {\{Documentation}} {\{Documentation|content=+}}',
"Category cleanup": 'Categories: break.categorization.cycle:. ' +
'Template_categories: remove.content.categories.per.[[WP:CAT#T]]:. add.[[Template:Template.category]];. {\{Template.category\n|topic=[[+]]\n}}\n \n|topic=[[+]]\n \n|description=+\n {\{Category.see.also|+}} not.just.navboxes;. ' +
'{\{Sandbox.other||+}} \n|type=navbox \n|type=sidebar <noinclude>+</noinclude> <includeonly>+</includeonly> ' +
'User_pages: user.sandbox.is.not.a.template:. user.page.is.not.a.template:. user.talk.page.is.not.a.template:. remove.content.categories.from.a.user.page.per.[[WP:USERNOCAT]]:. ' +
'{\{Navbox.documentation|3=\n==See.also==+}} {\{Documentation|content=+}} '
};
$.ready.then(function() {
var scroll = true; // whether or not to scroll the first highlight into view
// Highlight possible errors on template categories.
if (mw.config.get('wgNamespaceNumber') !== 14)
return;
var pageName = mw.config.get('wgPageName')
if (!(/[tT]emplates/.test(pageName) || /navigational_boxes/.test(pageName)))
return;
// 1. Highlight user pages in template categories
var userRgx = /.*\/wiki\/User(_talk)?:[^/]*([Uu][Bb][Xx]|\/[Uu]serboxe[sn])?$/;
$('#mw-pages a[href^="/wiki/User"]').each(function() {
if (userRgx.test(this.href)) {
$(this).css('outline', '2px solid orange');
if (!scroll)
return;
this.scrollIntoView();
scroll = false;
}
});
// 2. Highlight possible categorization into content categories
$('#mw-normal-catlinks a[href^="/wiki/Category:"]').each(function() {
var excludes = ["Template", "template", "boxes",
"WikiProject", "Wikipedia", "work_group", "stubs",
"Documentation", "Main_Page"
];
var n = excludes.length;
for (var i = 0; i < n; i++) {
if (this.href.includes(excludes[i]))
return;
}
$(this).css('outline', '2px solid maroon');
if (!scroll)
return;
this.scrollIntoView();
scroll = false;
});
// 3. Highlight articles and all talk pages in template categories
var articleRgx = /(.*\/wiki\/[^:/]*|.*\/wiki\/([A-Z][a-z]*_talk|Talk):.*)$/;
$('#mw-pages a[href^="/wiki/"]').each(function() {
if (articleRgx.test(this.href)) {
$(this).css('outline', '2px solid maroon');
if (!scroll)
return;
this.scrollIntoView();
scroll = false;
}
});
});
// Wikitext clean up buttons
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() {
pathoschild.TemplateScript.add([
{
name: 'Wikitext cleanup',
script: function(editor) {
editor
.replace(/\[\[[iI]mage[:]/g, '[[File:')
.replace(/ *$/gm, '')
.replace(/<br>/gi, '<br />')
.replace(/<noinclude>[ \n]*<\/noinclude>/gm, '')
.replace(/[{][{][Tt]emplate:/g, '{{')
.replace(/info-op *= *text-align: *(center|left|right) *; *$/gm, 'info-a = $1')
.replace(/usercategory =/g, 'usercategory =')
.replace(/description=Templates relating to (\[\[.*\]\])/g, 'topic=$1')
.replace(/\{\{ *(Category:.*?)\}\}/g, '[[:$1]]')
.appendEditSummary('cleaned up wikitext')
.clickDiff();
}
},
{
name: 'Image: → File:',
script: function(editor) {
editor
.replace(/\[\[[iI]mage[:]/g, '[[File:')
.appendEditSummary('replace deprecated [[Help:Files|"Image:" with "File:"]]')
.clickDiff();
}
},
{
name: 'Fix category links',
script: function(editor) {
editor
.replace(/\{\{ *(Category:.*?)\}\}/g, '[[:$1]]')
.appendEditSummary('fix category links')
.clickDiff();
}
},
]);
});
(function () { // for content categories on template pages
if (mw.config.get('wgNamespaceNumber') !== 10)
return;
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() {
pathoschild.TemplateScript.add([
{
name: 'Content categories',
script: function(editor) {
editor
.replace(/^\[\[(Category:((?!([tT]emplates|[nN]avigational boxes))[^|])*)([|].*)?\]\]$/gm, '* [[:$1]]')
.appendEditSummary('categorization ([[WP:CAT#T]])');
}
},
{
name: '→{{Navbox documentation}}',
script: function(editor) {
editor
.replace(/\{\{[cC]ollapsible option\}\}/gm, '{{Navbox documentation}}')
.appendEditSummary('[[Template:Navbox documentation|{{Navbox documentation}}]]');
}
},
]);
});
})();
// for content categories on template Category pages
(function() {
if (mw.config.get('wgNamespaceNumber') !== 14)
return;
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() {
pathoschild.TemplateScript.add([
{
name: 'CatRel',
script: function(editor) {
editor
.replace(/\n\n*\[\[Category:(((?!([tT]emplates|navigational boxes))[^|])*)([|].*)?\]\]$/gm, '\n{{Category see also|$1}}')
.replace(/ *[|]description= *[|]portal= *[|]help= *\}\}/, '}}')
.appendEditSummary('remove content categories per [[WP:CAT#T]]');
}
},
{
name: 'Nav2Side',
script: function(editor) {
editor
.replace(/ *[|] *type *= *navbox */g, '|type=sidebar')
.replace(/navigational boxes/g, 'sidebar templates')
.appendEditSummary('create a new [[Wikipedia:SIDEBAR|sidebar template]] category');
}
},
]);
});
})();
/*** BEGIN WIKIBREAK ENFORCER ***/
$(document).ready(function()
{
var log = function(s) {
console.log("[wikibreak enforcer] " + s);
}
// When you want to end your break?
// no leading zeroes. (example: 9 - correct, 09 - incorrect)
var date = { year: 2024, month: 4, day: 6 };
var time = { hours: 23, minutes: 59, seconds: 59 };
var currentDate = new Date();
var enforcedBreakEnd = new Date(date.year, date.month - 1, date.day,
time.hours, time.minutes, time.seconds);
if (currentDate <= enforcedBreakEnd) {
alert("Enforced wikibreak until " + enforcedBreakEnd.toLocaleString()
+ "\n(now is " + currentDate.toLocaleString() + ")\n\nBye!");
mw.loader.using(["mediawiki.api", "mediawiki.user"]).then(function () {
new mw.Api().post({
action: 'logout',
token: mw.user.tokens.get('csrfToken')
}).done(function (data) {
location = "//" + location.host + "/w/index.php?title="
+ "Special:Userlogin&returnto=Main_Page";
}).fail(function () {
log("logout failed");
});
});
}
});
/*** END WIKIBREAK ENFORCER ***/