Jump to content

User:Eizen/LastEditor

From Wikipedia, the free encyclopedia
LastEditor
DescriptionDisplays information concerning last editor of page
Author(s)Eizen
(Using code by PleaseStand)
StatusStable
UpdatedAugust 11, 2017; 7 years ago (2017-08-11)
BrowsersDeveloped in Google Chrome
SkinsVector
Monobook
SourceUser:Eizen/LastEditor.js
This is the documentation page for the LastEditor.js user script.

LastEditor is a JavaScript user script that displays data about a page's last editor. The script provides links to the user's page, talk page, and contributions page, as well as displaying the time elapsed since the last edit, a link to the diff in question, an [m] marker in case of minor edits, and the edit summary of the last edit.

The script is inspired by Slyst's LastEdited script in use on the Wikia network in terms of its design and general appearance, and borrows a pair of functions from PleaseStand's UserInfo script to replicate the TimeAgo jQuery plugin.

Installation

[edit]

The script may be used in any personal common.js, vector.js, or monobook.js file.

importScript("User:Eizen/LastEditor.js");

It may be imported to a global.js file as well through the addition of the following import statement:

mw.loader.load("//en.wikipedia.org/w/index.php?title=User:Eizen/LastEditor.js&action=raw&ctype=text/javascript");

Alternatively, the script accepts a window object of user-defined variables that can alter script performance at will. By default, the script will display all data and will be prepended to the header of all pages listed in namespaces 0, 4, 8, and 10 (mainspace, Project, MediaWiki, and template). The window variables enable users to remove the time elapsed text, the diff link, and the edit summary, as well as adjust namespaces to suit their specific needs and exclude certain pages. An example window object is shown below:

window.LastEditorOptions = {
    namespaces: [0, 4, 8, 12, 14],        // Custom namespace selection
    excluded: ["Elfin_woods_warbler"],    // Excluded page (must be encoded)
    showTime: false,                      // Indicates that the duration of time not be shown 
    showDiff: false,                      // Hides diff link
    showSummary: false                    // Hides new line summary
};
Variables Type Valid values Default value(s) Description
namespaces Array Any valid namespace [0, 4, 8, 10] An array of namespaces upon whose pages the script will be appended
excluded Array Any encoded page [] (empty array) An array of pages to be excluded (must be wgPageName of page)
showTime Boolean true, false true Displays the duration of time that has elapsed since the last edit
showDiff Boolean true, false true Provides a link to the last revision of the page and displays a marker for minor edits
showSummary Boolean true, false true Displays edit summary of last edit