// Add a link to the user rights log on meta into the toolbox on user and user talk pages
// as well as on Special:Log and Special:Contributions.
$(function () {
var userName = "";
if ( wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk" ) {
if ( wgTitle.indexOf("/") >= 0 ) return;
userName = wgTitle;
}
else if ( wgCanonicalNamespace == "Special" && wgCanonicalSpecialPageName == "Log" ) {
var pageField = document.getElementById("page");
if ( !pageField || pageField.value.substring(0,5) != "User:") return;
userName = pageField.value.substring(5);
}
else if ( wgCanonicalNamespace == "Special" &&
( wgCanonicalSpecialPageName == "Contributions" ||
wgCanonicalSpecialPageName == "DeletedContributions" ) ) {
var contribsForm = document.forms[0]; // an ID or a name would be nice...
if ( !contribsForm || !contribsForm.elements["target"] ) return;
userName = contribsForm.elements["target"].value;
}
if ( !userName ) return;
var metaPrefix = ( wgServer == "https://secure.wikimedia.org" ? wgServer + "/wikipedia/meta" : "http://meta.wikimedia.org" );
mw.util.addPortletLink( "p-tb", metaPrefix + "/wiki/Special:Log?page=User:" + encodeURIComponent(userName) + "@enwiki",
"Meta user rights", "t-metarightslog", "User rights changes made by stewards for \"" + userName + "@enwiki\"" );
});