MediaWiki:Gadget-sixtabs.js

$(document).ready( function {	var $action, $main, $talk, $edit, $hist, $move, $clone, href, title, ns = mw.config.get( 'wgNamespaceNumber' );

if ( ns < 0 || mw.config.get('skin') !== 'monobook' ) { return }

$action = $('#p-cactions').find('li'); $main = $action.eq(0); $talk = $action.filter('#ca-talk'); $edit = $action.filter('#ca-edit'); $hist = $action.filter('#ca-history');

if ( ns % 2 ) { $clone = $main; $move = $talk; id = 'subject'; title = ''; } else { $clone = $talk; $move = $main; id = 'talk'; title = 'Talk:'; }	if ( !$edit.length ) { $edit = $action.filter('#ca-viewsource'); }	if ( !$main.length || !$talk.length || !$edit.length || !$hist.length || $clone.hasClass( 'new' ) ) { return; }

$move.after( $hist ); $move.after( $edit ); href = mw.util.wikiScript('index') + '?title' + mw.util.wikiUrlencode( title + mw.config.get( 'wgTitle' ) ) + '&action='; mw.util.addPortletLink (		'p-cactions', href + 'history', $hist.text, 'ca-history-' + id, id + ' history', '', $clone.next.get(0)	); mw.util.addPortletLink (		'p-cactions', href + 'edit', 'Edit', 'ca-edit-' + id, 'Edit ' + id, '', $clone.next.get(0)	); });