User:JJMC89/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:JJMC89/common.css. |
// <nowiki>
/*******************************************************************************
* Variables
*******************************************************************************/
lwgScript = mw.config.get( 'wgScript' );
lwgUserName = mw.config.get( 'wgUserName' );
lwgNamespaceNumber = mw.config.get( 'wgNamespaceNumber' );
lwgPageName = mw.config.get( 'wgPageName' );
maxUsersCUStaleness = 500;
/*******************************************************************************
* Functions
*******************************************************************************/
function importMwScript( page, family, lang ) {
$.when( $.ready, mw.loader.using( ['mediawiki.util'] ) ).then( function() {
if ( typeof family === 'undefined' && typeof lang === 'undefined' ) {
console.log( 'Loading ' + page );
mw.loader.load( lwgScript + '?title=' + mw.util.wikiUrlencode( page ) + '&action=raw&ctype=text/javascript' );
} else {
if ( typeof family === 'undefined' ) {
family = 'wikipedia';
} else if ( typeof lang === 'undefined' ) {
lang = 'en';
}
console.log( 'Loading script: ' + lang + ':' + family + ':' + page );
mw.loader.load( '//' + mw.util.wikiUrlencode( lang + '.' + family + '.org' ) + lwgScript + '?title=' + mw.util.wikiUrlencode( page ) + '&action=raw&ctype=text/javascript' );
}
} );
}
function importMwStylesheet( page, family, lang ) {
$.when( $.ready, mw.loader.using( ['mediawiki.util'] ) ).then( function() {
if ( typeof family === 'undefined' && typeof lang === 'undefined' ) {
console.log( 'Adding ' + page );
mw.loader.load( lwgScript + '?title=' + mw.util.wikiUrlencode( page ) + '&action=raw&ctype=text/css', 'text/css' );
} else {
if ( typeof family === 'undefined' ) {
family = 'wikipedia';
} else if ( typeof lang === 'undefined' ) {
lang = 'en';
}
console.log( 'Loading stylesheet: ' + lang + ':' + family + ':' + page );
mw.loader.load( '//' + mw.util.wikiUrlencode( lang + '.' + family + '.org' ) + lwgScript + '?title=' + mw.util.wikiUrlencode( page ) + '&action=raw&ctype=text/css', 'text/css' );
}
} );
}
/*******************************************************************************
* Gadget and global script configurations
*******************************************************************************/
// [[m:MoreMenu]]
mw.loader.using(['mediawiki.util', 'mediawiki.api'], function () {
importMwScript( 'MediaWiki:Gadget-MoreMenu.enwiki.js' );
});
window.charinsertCustom = {
'Wiki markup': '␥{{Administrator.note}} ␥<small>(not.watching)</small>.~~\~~ '
};
var wikEdConfig = {};
wikEdConfig.regExTypoFix = true;
wikEdConfig.comboPresetOptions = {};
wikEdConfig.comboPresetOptions.summary = [
'reply',
'Add maintenance template(s)',
'Add/update reference details',
'Copyedit',
'No evidence of [[WP:N|notability]]',
'Remove image(s) lacking a [[WP:NFUR|fair use rationale]] for this page',
'Remove image(s) not satisifying the [[WP:NFCC|non-free content criteria]]',
'Remove [[WP:EL|external links]]',
'Remove [[WP:ELMINOFFICIAL|external links]]',
'Remove [[WP:RS|unreliable sources]]',
'Remove [[WP:RS|unreliably sourced]] content',
'Remove [[WP:UNSOURCED|unsourced]]',
'Remove [[WP:BLP|unsourced personal information]]',
'Restore deletion notice',
'Restore maintenance template(s)',
'Revert: Failure to [[WP:CITE|cite]] a [[WP:RS|reliable source]]',
'Revert: Unexplained removal of content',
];
wikEdConfig.comboPresetOptions.find = [
'(“|”|″|«|»)',
"(‘|’)",
' *([|=]) *',
'\\[http[^ ]+ ([^\\]]+)\\]',
'\\|\\s*([^|}]+)\\s*=\\s*([|}])',
'([^\\.,:;])<\\s*ref(\\s*[^>]*)>([^<]*)<\\s*\\/\\s*ref\\s*>([\\.,:;])',
'\\|\\s*author(\\d*)\\s*=\\s*([^,|}]+) ([^,|} ]+)\\s*([|}])',
'\\|\\s*author(\\d*)\\s*=\\s*([^,|}]+), ([^,|}]+)\\s*([|}])'
];
wikEdConfig.comboPresetOptions.replace = [
'"',
'\'',
'$1',
'$2',
'$1$4<ref$2>$3</ref>',
'|last$1=$3|first$1=$2$4',
'|last$1=$2|first$1=$3$4'
];
// Local config for [[:m:User:Dragoniez/Selective Rollback]]
if ( typeof( selectiveRollbackConfig ) === 'undefined' ) selectiveRollbackConfig = {};
if ( typeof( selectiveRollbackConfig.editSummaries ) === 'undefined' ) selectiveRollbackConfig.editSummaries = {};
selectiveRollbackConfig.editSummaries.Hidden = 'Reverted to revision $3 by $1';
selectiveRollbackConfig.editSummaries.Sock = selectiveRollbackConfig.editSummaries.Hidden + ': [[WP:SOCK|sockpuppetry]]';
selectiveRollbackConfig.editSummaries.Unsourced = selectiveRollbackConfig.editSummaries.Hidden + ': failure to [[WP:CITE|cite]] a [[WP:RS|reliable source]]';
/*******************************************************************************
* Links
*******************************************************************************/
$.when( $.ready, mw.loader.using( ['mediawiki.util'] ) ).then( function() {
// My dashboard
mw.util.addPortletLink(
'p-personal',
mw.util.getUrl( 'User:' ) + mw.util.wikiUrlencode( lwgUserName + '/dashboard' ),
'Dashboard',
'pt-mydashboard',
'Show your dashboard',
null,
'#pt-subpages'
);
// Admin dashboard
mw.util.addPortletLink(
'p-personal',
mw.util.getUrl( 'Template:Admin dashboard' ),
'(admin)',
'pt-admindashboard',
'Show the admin dashboard',
null,
'#pt-subpages'
);
//mw.util.addPortletLink(portletId,href,text[,id[,tooltip[,accesskey[,nextnode]]]]);
} );
/*******************************************************************************
* Scripts for all namespaces
*******************************************************************************/
// [[User:Theopolisme/Scripts/adminhighlighter]] fork
window.ADMINHIGHLIGHT_EXTLINKS = true; // highlights exteral links too; needs to be at the top
importMwScript( 'User:Galobtter/scripts/adminhighlighter.js' ); // [[User:Galobtter/scripts/adminhighlighter.js]]
importMwScript( 'User:Anomie/linkclassifier.js' ); // [[User:Anomie/linkclassifier.js]]
importMwStylesheet( 'User:Anomie/linkclassifier.css' ); // [[User:Anomie/linkclassifier.css]]
importMwScript( 'User:Anomie/previewtemplatelastmod.js' ); // [[User:Anomie/previewtemplatelastmod]]
importMwScript( 'User:Ahecht/Scripts/pageswap.js' ); // [[User:Ahecht/Scripts/pageswap]]
importMwScript( 'User:Enterprisey/url-select-revdel.js' ); // [[User:Enterprisey/url-select-revdel]]
importMwScript( 'User:The Earwig/revdel-responder.js' ); // [[User:The Earwig/revdel-responder]]
importMwScript( 'User:Ale jrb/Scripts/csdhelper.js' ); // [[User:Ale jrb/Scripts]]
importMwScript( 'User:Evad37/Xunlink.js' ); // [[User:Evad37/Xunlink]]
importMwScript( 'User:JJMC89/scripts/T210739.js' ); // [[User:JJMC89/scripts/T210739.js]]
importMwScript( 'User:Beetstra/Gadget-Spam-blacklist-Handler.js' ); // [[User:Beetstra/Gadget-Spam-blacklist-Handler]]
importMwScript( 'User:Beetstra/Gadget-Spam-whitelist-Handler.js' ); // [[User:Beetstra/Gadget-Spam-whitelist-Handler]]
/*******************************************************************************
* Scripts by namespace
*******************************************************************************/
if ( [ 0, 118 ].indexOf( lwgNamespaceNumber ) !== -1 ) { // Main and draft
importMwScript( 'User:Erutuon/scripts/imageSize.js' ); // [[User:Erutuon/scripts/imageSize.js]]
importMwScript( 'User:Evad37/duplinks-alt.js' ); // [[User:Evad37/duplinks-alt]]
importMwScript( 'User:Qwertyytrewqqwerty/DisamAssist.js' ); // [[User:Qwertyytrewqqwerty/DisamAssist]]
// [[User:Evad37/MoveToDraft]]
importMwScript( 'User:Evad37/MoveToDraft.js' );
window.m2d_rationale = "incubate in draftspace";
window.m2d_notification = "Hello {{SUBST:BASEPAGENAME}}. I have moved an article you created, $1, to a [[WP:Drafts|draft]] at [[Draft:$1]] to give you more time to work on it before publishing it. When you are sure that it [[WP:NOT|belongs on Wikipedia]] and satisfies our [[WP:42|inclusion criteria]], please submit your draft for review by following the instructions at the top of the draft. ~~~~";
//importMwScript( 'User:Salix alba/Citoid.js' ); // [[User:Salix alba/Citoid]]
} else if ( [ 2, 3 ].indexOf( lwgNamespaceNumber ) !== -1 ) { // User + talk
// [[User:Mr. Stradivarius/gadgets/SpamUserPage]]
SpamUserPage = {};
SpamUserPage.watchlist = 'nochange';
importMwScript( 'User:Mr. Stradivarius/gadgets/SpamUserPage.js' );
} else if ( lwgNamespaceNumber === 4 ) { // Project
importMwScript( 'User:MusikAnimal/responseHelper.js' ); // [[User:MusikAnimal/responseHelper]]
importMwScript( 'User:MusikAnimal/userRightsManager.js' ); // [[User:MusikAnimal/userRightsManager]]
importMwScript( 'User:Enterprisey/delsort.js' ); // [[User:Enterprisey/delsort]]
// importMwScript( 'User:Timotheus Canens/spihelper.js' ); // [[User:Timotheus Canens/spihelper.js]]
importMwScript( 'User:GeneralNotability/spihelper.js' ); // [[User:GeneralNotability/spihelper.js]]
importMwScript( 'User:Writ Keeper/Scripts/cuStaleness.js' ); // [[User:Writ Keeper/Scripts/cuStaleness.js]]
window.charinsertCustom['Wiki markup'] += 'SPI: {{Clerk.note}} {{bnt}} {{bwt}} {{IPblock}} {{CURequest}} {{Endorse}} {{Requestandendorse}} {{Selfendorse}} {{Decline}} {{StaleIP}} {{More.info}} {{subst:DiffsNeeded|moreinfo}}';
} else if ( lwgNamespaceNumber === 6 ) { // File
if ( mw.config.get('wgCategories').indexOf('All non-free media') !== -1 ) { // Non-free
document.getElementById( 'ca-fileExporter' ).remove(); // Remove FileExporter
importMwScript( 'User:Ronhjones/rescaledsidebar.js' ); // [[User:Ronhjones/rescaledsidebar.js]]
}
} else if ( lwgNamespaceNumber === 10 ) { // Template
importMwScript( 'User:Frietjes/addcheckforunknownparameters.js' ); // [[User:Frietjes/addcheckforunknownparameters.js]]
} else if ( lwgNamespaceNumber === 14 ) { // Category
importMwScript( 'User:Writ Keeper/Scripts/sockStaleness.js' ); // [[User:Writ Keeper/Scripts/sockStaleness.js]]
}
if ( lwgNamespaceNumber % 2 === 1 ) { // Talk namespaces
importMwScript( 'User:Jackmcbarn/editProtectedHelper.js' ); // [[User:Jackmcbarn/editProtectedHelper]]
}
// </nowiki>