MediaWiki:Common.js: Difference between revisions

Load the short description under the title
Cache the add-on scripts for 5 minutes instead of 5 hours
Line 41: Line 41:
if ( extraJS ) {
if ( extraJS ) {
if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
mw.loader.load( '/index.php?title=' + extraJS + '&action=raw&ctype=text/javascript' );
mw.loader.load( '/index.php?title=' + extraJS + '&action=raw&ctype=text/javascript&maxage=300&smaxage=300' );
} else {
} else {
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
Line 173: Line 173:


/* Related Articles box at the bottom of articles: see [[MediaWiki:RelatedArticles.js]] */
/* Related Articles box at the bottom of articles: see [[MediaWiki:RelatedArticles.js]] */
mw.loader.load( mw.config.get( 'wgScript' ) + '?title=MediaWiki:RelatedArticles.js&action=raw&ctype=text/javascript' );
mw.loader.load( mw.config.get( 'wgScript' ) + '?title=MediaWiki:RelatedArticles.js&action=raw&ctype=text/javascript&maxage=300&smaxage=300' );
/* "Read in Hebrew" button at the top of articles: see [[MediaWiki:ReadInHebrew.js]] */
/* "Read in Hebrew" button at the top of articles: see [[MediaWiki:ReadInHebrew.js]] */
mw.loader.load( mw.config.get( 'wgScript' ) + '?title=MediaWiki:ReadInHebrew.js&action=raw&ctype=text/javascript' );
mw.loader.load( mw.config.get( 'wgScript' ) + '?title=MediaWiki:ReadInHebrew.js&action=raw&ctype=text/javascript&maxage=300&smaxage=300' );
/* Short description under the article title: see [[MediaWiki:ShortDescription.js]] */
/* Short description under the article title: see [[MediaWiki:ShortDescription.js]] */
mw.loader.load( mw.config.get( 'wgScript' ) + '?title=MediaWiki:ShortDescription.js&action=raw&ctype=text/javascript' );
mw.loader.load( mw.config.get( 'wgScript' ) + '?title=MediaWiki:ShortDescription.js&action=raw&ctype=text/javascript&maxage=300&smaxage=300' );