User:Mike Dillon/Scripts/toolboxLogLinks.js
From Wikipedia, the free encyclopedia
If a message on your talk page led you here, please be wary of who left it. Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. If this is a .js page, the code will be executed when previewing the page.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
// Requires: [[User:Mike Dillon/Scripts/i18n.js]], [[User:Mike Dillon/Scripts/username.js]] /* <pre><nowiki> */ /* * 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"); addOnloadHook(function () { if (document.getElementById("t-whatlinkshere")) { addPortletLink("p-tb", wgArticlePath.replace(/\$1/, "Special:Log?page=" + encodeURIComponent(wgPageName)), wfMsg("pageLogLinkLabel"), "t-pagelogs", wfMsg("pageLogLinkTitle"), null, document.getElementById("t-upload")); } var user = getUsernameForCurrentPage(); if (user) { addPortletLink("p-tb", wgArticlePath.replace(/\$1/, "Special:Log?user=" + encodeURIComponent(user)), wfMsg("userLogLinkLabel"), "t-userlogs", wfMsg("userLogLinkTitle"), null, document.getElementById("t-upload")); } }); /* </nowiki></pre> */

