MediaWiki:Common.js: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 17: | Zeile 17: | ||
} | } | ||
/* | /* From https://en.wikipedia.org/wiki/MediaWiki:Common.js */ | ||
/** | |||
* Map addPortletLink to mw.util | |||
* @deprecated: Use mw.util.addPortletLink instead. | |||
*/ | |||
mw.log.deprecate( window, 'addPortletLink', mw.util.addPortletLink, 'Use mw.util.addPortletLink instead' ); | |||
/** | |||
* Extract a URL parameter from the current URL | |||
* @deprecated: Use mw.util.getParamValue with proper escaping | |||
*/ | |||
mw.log.deprecate( window, 'getURLParamValue', mw.util.getParamValue, 'Use mw.util.getParamValue instead' ); | |||
/** | |||
* Test if an element has a certain class | |||
* @deprecated: Use $(element).hasClass() instead. | |||
*/ | |||
mw.log.deprecate( window, 'hasClass', function ( element, className ) { | |||
return $( element ).hasClass( className ); | |||
}, 'Use jQuery.hasClass() instead' ); | |||
/** | |||
* @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL | |||
* @rev 6 | |||
*/ | |||
var extraCSS = mw.util.getParamValue( 'withCSS' ), | |||
extraJS = mw.util.getParamValue( 'withJS' ); | |||
if ( extraCSS ) { | |||
if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) { | |||
mw.loader.load( '/w/index.php?title=' + 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 ) { | |||
if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) { | |||
mw.loader.load( '/w/index.php?title=' + extraJS + '&action=raw&ctype=text/javascript' ); | |||
} else { | |||
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } ); | |||
} | |||
} | |||