The Demopædia Encyclopedia on Population is under heavy modernization and maintenance. Outputs could look bizarre, sorry for the temporary inconvenience
Multilingual Demographic Dictionary, second unified edition, English volume
MediaWiki:Gadget-exlinks.js
Multilingual Demographic Dictionary, second unified edition, English vol.
Revision as of 11:08, 7 June 2017 by Nicolas Brouard (talk | contribs) (Created page with "→* * @source mediawiki.org/wiki/Snippets/Open_external_links_in_new_window * @version 6: mw.hook( 'wikipage.content' ).add( function( $content ) { // Second selector is...")
Note: After saving, 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)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/**
* @source mediawiki.org/wiki/Snippets/Open_external_links_in_new_window
* @version 6
*/
mw.hook( 'wikipage.content' ).add( function( $content ) {
// Second selector is for external links in Parsoid HTML+RDFa output (bug 65243).
$content.find( 'a.external, a[rel="mw:ExtLink"]' ).each( function () {
// Can't use wgServer because it can be protocol relative
// Use this.href property instead of this.getAttribute( 'href' ) because the property
// is converted to a full URL (including protocol)
if ( this.href.indexOf( location.protocol + '//' + location.hostname ) !== 0 ) {
if ( !this.rel.indexOf( 'noopener' ) < 0 ) {
this.rel += ' noopener'; // the leading space matters, rel attributes have space-separated tokens
}
if ( !this.rel.indexOf( 'noreferrer' ) < 0 ) {
this.rel += ' noreferrer'; // the leading space matters, rel attributes have space-separated tokens
}
this.target = '_blank';
}
} );
} );