User:Mike Dillon/Scripts/toolboxLogLinks.js
< User:Mike Dillon | Scripts
Note: You may have to bypass your browser’s cache to see the changes. In addition, after saving a sitewide CSS file such as MediaWiki:Common.css, it will take 5-10 minutes before the changes take effect, even if you clear your cache.
- Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
- Konqueror and Chrome: click Reload or press F5;
- Opera: clear the cache in Tools → Preferences;
- Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.
- This script lacks a documentation subpage. Please create it.
- Useful links: root page • root page’s subpages • links • redirects • your own
// 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"));
}
});