User:Nigos/scripts/LogTab.js

mw.loader.using( ['mediawiki.util', 'mediawiki.Uri'], function {	"use strict";	var username, firstTab, logTabUrl;

function setDefault( option, val ) { if ( window[option] === undefined ) { window[option] = val; }	}	setDefault( 'logTabName', 'Logs' ); setDefault( 'logTab', true );

username = mw.config.get( 'wgRelevantUserName' ); if ( !username ) { return; }

firstTab = $( '#p-views ul li' ).eq( 0 );

if ( window.logTab ) { logTabUrl = mw.util.getUrl( 'Special:Log', {			target: username,		} );

mw.util.addPortletLink(			'p-views',			logTabUrl,			window.logTabName,			'ca-contributions',			'Show logs for this user',			null,			firstTab		); }

} );