MediaWiki:Common.js: Difference between revisions
Content deleted Content added
always load monthly convert js |
whitespace cleanup |
||
Line 4:
$(function() {
mw.loader.using( ['mediawiki.util', 'mediawiki.Uri'] ).done( function() {
// If Jimmy tweets a bare link to https://donate.wikimedia.org/w/index.php?title=Special:LandingPage
}▼
▲ }
// Disable logo link
$('#p-logo a').attr( { href: '#', title: '' } );
// Code for donation forms - https://donate.wikimedia.org/wiki/MediaWiki:DonationForm.js
if ( document.forms['donateForm'] ) {
Line 33:
mw.loader.load( '/w/index.php?title=MediaWiki:DonationForm.js&action=raw&ctype=text/javascript' );
}
// Load monthly convert JS
// TODO: allow loading different JS variants, either here or defined in the Template
mw.loader.load( '/w/index.php?title=MediaWiki:MonthlyConvert.js&action=raw&ctype=text/javascript' );
}
// Code for Thank You pages - https://donate.wikimedia.org/wiki/MediaWiki:ThankYouPage.js
if ( mw.config.get( 'wgTitle' ).indexOf('Thank You') !== -1 ) {
mw.loader.load( '/w/index.php?title=MediaWiki:ThankYouPage.js&action=raw&ctype=text/javascript' );
}
// Code for support pages - https://donate.wikimedia.org/wiki/MediaWiki:SupportPage.js
// TODO: have a better way to trigger this
var supportPages = [ 'Ways to Give', 'Problems donating', 'Cancel or change recurring giving',
'Matching Gifts', 'Support Page', 'FAQ', 'Tax deductibility',
'US State Solicitation Disclosures', 'Draft:FAQ' ];
Line 52:
mw.loader.load( '/w/index.php?title=MediaWiki:SupportPage.js&action=raw&ctype=text/javascript' );
}
// Load some tools for editors - https://donate.wikimedia.org/wiki/MediaWiki:EditTemplates.js
if ( mw.config.get( 'wgUserName' ) !== null ) {
mw.loader.load( '/w/index.php?title=MediaWiki:EditTemplates.js&action=raw&ctype=text/javascript' );
}
/**
* @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
Line 64:
var extraCSS = mw.util.getParamValue( 'withCSS' ),
extraJS = mw.util.getParamValue( 'withJS' );
if ( extraCSS ) {
if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) {
Line 72:
}
}
if ( extraJS ) {
if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
Line 80:
}
}
/* HACK to run certain inline scripts when document ready (e.g. so jquery is avaliable)
TODO: Make suitable for multiple scripts. Or figure out a better way to do this.
Line 87:
inlineScriptWhenReady();
}
} );
});
|