User:Mike Dillon/Scripts/toolboxLogLinks.js

// Requires: User:Mike Dillon/Scripts/i18n.js, User:Mike Dillon/Scripts/username.js

/* * This script adds two links to the Toolbox: *    1. Page logs: a log of actions for the page currently being viewed *    2. User logs: a log of actions by the user whose page is currently being viewed */

/* Messages */ // pageLogLinkLabel wfAddMsg("en", "pageLogLinkLabel", "Page logs"); wfAddMsg("es", "pageLogLinkLabel", "Registros de la página");

// pageLogLinkTitle wfAddMsg("en", "pageLogLinkTitle", "View a log of all actions done for this page"); wfAddMsg("es", "pageLogLinkTitle", "Ver a los registros para esta página");

// userLogLinkLabel wfAddMsg("en", "userLogLinkLabel", "User logs"); wfAddMsg("es", "userLogLinkLabel", "Registros del usuario");

// userLogLinkTitle wfAddMsg("en", "userLogLinkTitle", "View a log of all actions done by this user"); wfAddMsg("es", "userLogLinkTitle", "Ver a los registros de acciones por este usuario");

$(function {    if (document.getElementById("t-whatlinkshere")) {        mw.util.addPortletLink("p-tb", wgArticlePath.replace(/\$1/, "Special:Log?page=" + encodeURIComponent(mw.config.get('wgPageName'))), wfMsg("pageLogLinkLabel"), "t-pagelogs", wfMsg("pageLogLinkTitle"), null, document.getElementById("t-upload"));   }

var user = getUsernameForCurrentPage; if (user) { mw.util.addPortletLink("p-tb",           wgArticlePath.replace(/\$1/, "Special:Log?user=" + encodeURIComponent(user)),            wfMsg("userLogLinkLabel"), "t-userlogs", wfMsg("userLogLinkTitle"),            null, document.getElementById("t-upload")); } });