Wikipedia:WikiProject User scripts/Scripts/Logs link

From Wikipedia, the free encyclopedia

// from User:Thebainer/monobook.js


// adds a 'logs for this page' link to the toolbox bar
// if the page is a user's page, talk page or subpage, the link will go to logs for the user instead
// if the page is a special page, then no link is displayed

addOnloadHook(function () {
 
 // if this is a user, show the logs for the user rather than the page
 if ( wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk" ) {
  url = wgServer + "/w/index.php?title=Special:Log&user=" + wgTitle.split("/")[0];
 } else if ( wgCanonicalNamespace == "Special" ) {
  // don't display link for special pages
  return;
 } else {
  url = wgServer + "/w/index.php?title=Special:Log&page=" + wgPageName;
 }
 
 addPortletLink("p-tb", url, "Logs", "pt-logs");

});

//