Difference between revisions of "MediaWiki:Common.js"

From Bookkeepingpedia
Jump to: navigation, search
(Created page with "Any JavaScript here will be loaded for all users on every page load.: $( function () { // Paste snippet here. // Paste as many as you like, only one "$( function () {...")
 
 
Line 4: Line 4:
 
// Paste snippet here.
 
// Paste snippet here.
 
// Paste as many as you like, only one "$( function () { ... } );" wrapper is needed!
 
// Paste as many as you like, only one "$( function () { ... } );" wrapper is needed!
 +
} );
 +
 +
/**
 +
* @source https://mediawiki.org/wiki/Snippets/Open_specific_external_links_in_new_window
 +
* @version 2018-09-15
 +
*/
 +
$( function () {
 +
$( '#mw-content-text' ).on( 'click', '.newwin > a', function () {
 +
var otherWindow = window.open();
 +
otherWindow.opener = null;
 +
otherWindow.location = this;
 +
return false;
 +
} );
 
} );
 
} );

Latest revision as of 04:46, 16 November 2018

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

$( function ()  {
	// Paste snippet here.
	// Paste as many as you like, only one "$( function () { ... } );" wrapper is needed!
} );

/**
 * @source https://mediawiki.org/wiki/Snippets/Open_specific_external_links_in_new_window
 * @version 2018-09-15
 */
$( function () {
	$( '#mw-content-text' ).on( 'click', '.newwin > a', function () {
		var otherWindow = window.open();
		otherWindow.opener = null;
		otherWindow.location = this;
		return false;
	} );
} );