This script/stylesheet is for PERSONAL use only!
You are free to install this script/stylesheet for yourself, but it is not allowed to be used wiki-wide (e.g., in MediaWiki:ImportJS, MediaWiki:Common.js, MediaWiki:Common.css, MediaWiki:Fandomdesktop.js or MediaWiki:Fandomdesktop.css), as it would violate Fandom's Terms of Use.
(See the customization policy)
LastEdited adds details about the last edit to the current page. These details include the time (minutes/hours/days/months/years) ago the last edit was made, user who made the edit, edit summary given (if any), the current page size in bytes and a link to open a modal to review the changes. The modal includes a link to the actual diff page, a link to undo the edit and a link to rollback the edits if the user has the required rights.
The date and time are added by default and cannot be changed, while the other options can be configured.
Demo
A demo can be seen live at the header of this page, listing the last edited details of the page.
Installation
Configuration
Key | Description | Type | Possible values | Default |
---|---|---|---|---|
avatar
|
Editor's user avatar | boolean | true false
|
true
|
avatarsize
|
Size of the avatar | integer | None specific | 15 |
size
|
Current page size (in bytes) | boolean | true false
|
true
|
diff
|
Appends the last diff link | |||
diffModal
|
If the diff link should be loaded in LastEdited's diff modal. Useful in cases the user prefers opening diff links in QuickDiff. | |||
comment
|
Edit summary given* | |||
newpage
|
Decides whether LastEdited will render on newly created pages without any edits (excluding the page creation edit) | boolean | true false
|
true
|
time
|
Decides whether the time mentioned must be in the "time ago" format or a timestamp | string | timestamp timeago
|
timeago
|
timezone
|
Decides whether the timestamp shown is in local or UTC format* | UTC
|
local | |
lang
|
Changes the language displayed* | Any valid language code | None specific | |
position.element
|
Controls where the details will be added | object | Any valid element present on the page | |
position.method
|
Controls whether the details need to be appended or prepended to the element defined in position.element
|
string | append prepend
| |
namespaces.exclude
|
List of namespace ids to exclude | array | None specific | []
|
pages
|
List of pages to exclude |
All configurations made to the script are to be stored in the lastEdited
object. Here is an example, using Japanese language:
window.lastEdited = {
avatar: true,
avatarsize: 20,
size: false,
diff: true,
comment: false,
newpage: false,
time: 'timestamp',
timezone: 'UTC',
lang: 'ja',
position: {
element: document.getElementById('WikiaPageHeader'),
method: 'append'
},
namespaces: {
exclude: []
},
pages: []
};
Toolbar example
The following can be used to add the script to the toolbar instead of appending it to the title.
//create the element we're attaching to
$('.toolbar .tools').append('<li id="lastedited"/>');
//attach to the element, as well as make the script only show one line
window.lastEdited = {
size: false,
comment: false,
position: {
element: 'li#lastedited',
method: 'append'
}
};
//change how the links look (JustLeafy's suggestion, is optional)
mw.util.addCSS('#lastEdited a { color: ' + $(".lastEdited-timeago").css("color") + '; text-decoration: underline }');
Notes
- If edit summary is not given with the edit, the whole part will be omitted, regardless of the value of
comment
. lang
is meant for personal use only. Using it sitewidely is not encouraged.timezone
is applicable only iftime
is set totimestamp
.- The script works on all namespaces except for Thread and Board Thread. It is also disabled on the main page of the wiki.
- For any styling, the class of the outer div is
lastEdited
and that of the avatar icon islastEdited-avatar
. - Make sure to follow the customization policy while selecting
position.element
. If not provided, the default positions are below the title on pages, and below the edit button on userpages.- Please use the talkpage if you can't figure out how to get the details to show up at a particular place.
- The table below shows a full list of default namespaces that can be used with the script with their ids for exclusion:
ID | Namespace | Description |
---|---|---|
-2 | Media | Used for direct linking to images. For example, Media:Wiki.png links directly to the image page. |
-1 | Special | Special pages. Used by MediaWiki code and extensions |
0 | Mainspace | Articles |
1 | Talk | Article discussion |
2 | User | Personal user pages |
3 | User talk | Pages for discussion with users |
4 | Project/Sitename | Wiki-related content |
5 | Project talk/Sitename talk | Discussion of Project pages' |
6 | Image/File | File descriptions |
7 | Image talk/File talk | File discussion |
8 | MediaWiki | System messages and configuration |
9 | MediaWiki talk | Discussion of MediaWiki pages |
10 | Template | Templates |
11 | Template talk | Template discussion |
12 | Help | Help pages, also see Shared Help |
13 | Help talk | Discussion about Help pages |
14 | Category | Categories |
15 | Category talk | Category discussion |
110 | Forum | Old forum pages |
111 | Forum talk | Discussion about old forum pages |
500 | User blog | Blog pages |
501 | User blog comment | User blog comments |
502 | Blog | Blog listing pages |
503 | Blog | Blog listing pages |
828 | Module | Lua module pages |
829 | Module talk | Lua module discussion pages |
1200 | Message Wall | Pages used for the Wall extension. Touch only if you know what are you doing. |
1201 | Thread | Message Wall thread namespace |
1202 | Message Wall Greeting | Pages used for content above message boxes on Message Walls |
2000 | Board | Board namespace. Used for storing board descriptions |
2001 | Board Thread | Forum threads |
To do
- Handle errors if rollback fails
Updates
- November 1st, 2017
- Script rewritten to use jQuery functions instead of DOM API
- Added a
diffModal
configuration option - No longer throwing errors on ?action=edit
- Extracted CSS to a separate stylesheet
mw.config
caching- Extracted translation data to JSON to support the translations editor
- Finding a user's avatar is no longer requiring another HTTP request
- Script is showing a throbber before it finishes loading
- Diff modal is loading faster
- November 27th, 2016
- Added a few requested features
- October 14th, 2016
- Script rewritten; added functionalities:
- Minor edits are now marked
- Change in size is indicated
- Position of the details can be configured
- More responsive modal
- Edits can be rollbacked from the modal
- July 9th, 2015
- Added Monobook support.
- April 4th, 2015
- Date and time merged together to give an approximate time since the last edit using timeago.
- April 3rd, 2015
- Added i18n support.
- Redid namespace support; added options to include/exclude namespaces and exclude pages.
- April 2nd, 2015
- Re-added previously removed editor's avatar.
- December 30th, 2014
- Added editor's avatar, per request.
- December 1st, 2014
- Namespace support.
- November 15th, 2014
- Features updated.
- October 8th, 2014
- Initial release.