User:Grunny/enwikitab.js
Appearance
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.
/**
* Adds a tab to link to the page with the same title on the English Wikipedia
* @author Grunny
*/
$( function () {
var enwikiUrlPath = 'http://en.wikipedia.org/wiki/';
if( mw.config.get( 'wgServer' ).indexOf( 'https://' ) === 0 ) {
enwikiUrlPath = mw.config.get( 'wgServer' ) + '/wikipedia/en/wiki/';
}
if( mw.config.get( 'skin' ) === 'vector' ) {
//Could just use p-views in the addPortletLink for vector, but it looks weird after the watch star
$( '#p-views > ul > li#ca-history' ).after( '<li id="ca-enwiki-link"><span><a href="' + enwikiUrlPath + encodeURIComponent( mw.config.get( 'wgPageName' ) )
+ '" title="View same page on the English Wikipedia">EnWiki</a></span></li>' );
} else {
mw.util.addPortletLink( 'p-cactions', enwikiUrlPath + encodeURIComponent( mw.config.get( 'wgPageName' ) ),
"enwiki", "ca-enwiki-link", "View same page on the English Wikipedia" );
}
} );