Jump to content

User:Anomie/previewtemplatelastmod

From Wikipedia, the free encyclopedia

This script provides more information in the "Pages transcluded onto the current version of this page" or "Templates used in this preview" box at the bottom of the preview screen. It also sorts the templates by last edit date. This can help in finding template vandalism, as the templates at the top of the list are most likely to have been vandalized.

Example

[edit]

For a page containing only {{fact}}, as of 2011-01-29:

Before

Templates used in this preview:

After

Templates used in this preview:

Usage

[edit]

To use the script, add the following to your skin-specific Javascript file.

importScript('User:Anomie/previewtemplatelastmod.js'); // Linkback: [[User:Anomie/previewtemplatelastmod.js]]

Note that this script has only been extensively tested on Monobook, although it does appear to work correctly in Vector too.

Styling

[edit]

The following CSS classes may be used for styling the generated content:

PreviewTemplateLastMod_timestamp
The timestamp at the start of the line.
PreviewTemplateLastMod_history
The "hist" link.
PreviewTemplateLastMod_user
The "user" link.
PreviewTemplateLastMod_comment
The edit summary.
PreviewTemplateLastMod_no_comment
The text "(no summary)" displayed when the user did not give a summary.

For example, to display the comment in grey you could add the following to your skin-specific CSS file:

span.PreviewTemplateLastMod_comment {
    color:#888;
}
span.PreviewTemplateLastMod_no_comment {
    color:#ccc;
}