MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

/** * Load jquery.ui button if used in content * for backward-compatibilty * Should be removed/replaced with mediawiki.ui, when that is loaded on each page */ mw.hook( 'wikipage.content' ).add( function ( $content ) {       if ( $content.find( '.ui-button' ).length ) {                mw.loader.load( 'jquery.ui' );        } } );

/** * @source https://www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL * @revision 2017-05-16 */ mw.loader.using( ['mediawiki.util'], function {	var extraCSS = mw.util.getParamValue( 'withCSS' ),		extraJS = mw.util.getParamValue( 'withJS' );

if ( extraCSS ) { // DONT REMOVE THIS IF (unless you are OK with CSRF attacks) if ( /^MediaWiki:[^&<>=%#]*\.css$/.test( extraCSS ) ) { mw.loader.load( '/w/index.php?title=' + encodeURIComponent( extraCSS ) + '&action=raw&ctype=text/css', 'text/css' ); } else { mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } ); }	}

if ( extraJS ) { // DONT REMOVE THIS IF (unless you are OK with XSS & CSRF attacks) if ( /^MediaWiki:[^&<>=%#]*\.js$/.test( extraJS ) ) { mw.loader.load( '/w/index.php?title=' + encodeURIComponent( extraJS ) + '&action=raw&ctype=text/javascript' ); } else { mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } ); }	} });

// ScoredRevision configs, see #wikimedia-ai at 28.04.2016 // XXX: Shouldn't this be set in configuration? // (workaround for T35355) mw.config.set( 'ScoredRevisionsThresholds', { low: 0.8, medium: 0.9, high: 0.95 } );

$( '.mw-notification-tag-wikibase-anonymouseditwarning a').each( function { $( this ).attr('target', '_blank') } ); // Script that adds "Special:MyLanguage" to every link // Author: User:Xena document.body.innerHTML = document.body.innerHTML.replace(/<a href="\/wiki\/(?!Special:)/g, '<a href="/wiki/Special:MyLanguage/');