Jump to content

MediaWiki talk:Gadget-exlinks.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by He7d3r (talk | contribs) at 18:09, 27 July 2011 (Update). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Update

Hi!

Could someone update this gadget to use jQuery and the recommended functions from MW 1.17? It would be something like this:

$(function() {
    var $alinks = mw.util.$content.find( 'a' );
	$alinks.each( function() {
		var $tablink = $( this );
		if ( $tablink.hasClass( 'external' ) && $tablink.attr( 'href' ).indexOf( mw.config.get( 'wgServer' ) ) !== 0 ) {
		    $tablink.attr( 'target', '_blank' );
		}
	} );
});

After the change, I think it will be possible to change the definition of this gadget to

* exlinks[ResourceLoader|dependencies=mediawiki.util]|exlinks.js

Helder 18:09, 27 July 2011 (UTC)[reply]