Gebruiker:Rots61/common.js: verschil tussen versies

Uit Wikikids
Naar navigatie springen Naar zoeken springen
Regel 24: Regel 24:
 
// Disallow some characters in file name
 
// Disallow some characters in file name
 
if ( extraJS.match( /\.js$/ ) ) {
 
if ( extraJS.match( /\.js$/ ) ) {
  +
mw.log(extraJS);
  +
console.log(importScript(extraJS));
 
importScript( extraJS );
 
importScript( extraJS );
 
// Show message after DOM is ready.
 
// Show message after DOM is ready.

Versie van 10 dec 2022 21:30

mw.loader.using('mediawiki.util', function() {
	mw.util.addPortletLink('p-tb', 
		'https://nl.wikipedia.org/wiki/' + encodeURIComponent(mw.config.get('wgPageName')), 
		'Wikipedia ', '#wikipedialink', mw.config.get('wgPageName') + " op Wikipedia ");
});

mw.loader.using('mediawiki.util', function() {
	mw.util.addPortletLink('p-tb', 
		'https://www.google.nl/search?q=' + encodeURIComponent(mw.config.get('wgPageName')), 
		'Google ', '#googlelink', mw.config.get('wgPageName') + " op Google ");
});

mw.loader.load('//wikikids.nl/index.php?title=User:Rots61/Clear.js&action=raw&ctype=text/javascript'); // [[User:Rots61/Clear.js]]

	/**
	 * Load withJS & withCSS
	 *
	 * @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
	 * @rev 3
	 */
	mw.loader.using( ['mediawiki.util'], function () {
		var extraJS = mw.util.getParamValue( 'withJS' );
		if ( extraJS ) {
			// Disallow some characters in file name
			if ( extraJS.match( /\.js$/ ) ) {
				mw.log(extraJS);
				console.log(importScript(extraJS));
				importScript( extraJS );
			// Show message after DOM is ready.
			} else {
				$( function() {
					mw.notify( 'Invalid javascript URL; only javascript pages from MediaWiki: space are allowed.', { title: 'Error' } );
				} );
			}
		}
		var extraCSS = mw.util.getParamValue( 'withCSS' );
		if ( extraCSS ) {
			// Disallow some characters in file name
			if ( extraCSS.match( /\.css$/ ) ) {
				importStylesheet( extraCSS );
			// Show message after DOM is ready.
			} else {
				$( function() {
					mw.notify( 'Invalid stylesheet URL', { title: 'Error' } );
				} );
			}
		}
	} );
Afkomstig van Wikikids , de interactieve Nederlandstalige Internet-encyclopedie voor en door kinderen. "https://wikikids.nl/index.php?title=Gebruiker:Rots61/common.js&oldid=753001"