# MediaWiki:Gadget-exlinks.js

From faraghaib
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.

    // **********************************************************************
    // **                 ***WARNING GLOBAL GADGET FILE***                 **
    // **             changes to this file affect many users.              **
    // **           please discuss on the talk page before editing         **
    // **                                                                  **
    // **********************************************************************

    mw.hook( 'wikipage.content' ).add( function ( $content ) {

    	var $alinks = $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' );
    		}
    	});
    });

Retrieved from "https://en.faraghaib.ir/w/index.php?title=MediaWiki:Gadget-exlinks.js&oldid=280"