User:Anomie/unsignedhelper

From Wikipedia, the free encyclopedia

This script adds an entry to the Insert and Wikitext sections of the Edit tools box (at the bottom of the edit page) for adding {{subst:unsigned}} or {{subst:unsignedIP}}.

Usage[edit]

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

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

Note that this script has only been extensively tested on Monobook with Firefox.

Then, when editing a page, highlight the unsigned comment (or the last part of it) or position the cursor just after it and use the {{unsigned}} in the Edit tools box. This will use the API to find the user who added that comment and add the appropriate {{subst:unsigned}} or {{subst:unsignedIP}} at the cursor position.

Caveats[edit]

  • If someone else has edited the non-signing user's comment (e.g. to change indentation, prepend some sort of template, or the like), that someone else will be used in the {{unsigned}} template.
  • Similarly, if the unsigned comment was removed and then the removal was reverted, the reverting user will be used in the {{unsigned}} template.
    • The script will attempt to detect this by looking for "reverted" or "undid" in the edit summary, but a revert not using those keywords won't be detected.
  • If the same comment appears more than once in the page, the user who first added the comment will be used in the {{unsigned}} template. Even if that first addition was somewhere else entirely.
  • This script probably does not work with VisualEditor, the VE-based 2017 wikitext editor, or wikEd. It also probably does not work when syntax highlighting is enabled.