2011-02-24

No more re-typing the same comments over and over!

This script adds a little 'auto' link next to all comments boxes. When you click the link, you see a popup with 6 configurable auto-comments, which you can easily click to insert.

This script was inspired by answers to this question on meta.



Features

1. Read your comment before you post it!

Note that the dialog only inserts the text, it doesn't send the comment, nor does it flag anything; this is so that you can check the text before posting!

2. Customize the texts

Simply double click on a comment text or description in order to customize it. Hit the 'reset' button if you screw up. This customization is currently per-site. Note that the "Welcome to $SITENAME$" text is automagically inserted if the user is 'new' (member for less than a week), so you don't need to add that to your custom text (but you can if you want to, see '9' below).

If you need more/less than the default 6 comments, just carry on reading...

3. Quick user info

The dialog also includes a mini-summary of the user's activity (because if they haven't been back in months, there's no point writing them a comment).

4. Automatic notification of new versions

The script will also notify you if a newer version is created.

5. Import/export of custom comments

This helps with transferring custom comments between sites. The export/import 'format' is also conveniently presented as markdown, so you can post it in an answer below, and let others benefit from your words of wisdom.

Note that you can also use the Import to create an arbitrary number of comments (the default is 6). If there are too many, you can use the show/hide desc link to gain a bit of space.

6. Remote source for comments

If you get bored with copy/pasting your comments between sites and/or computers, you can use the 'remote' button to define a remote source for your comment texts. See here for more details.

7. Differentiated comments for questions/answers

If you prefix your comment title with [Q], it will be only displayed for questions ([A] for answers). Non-prefixed comments are displayed for both.

8. [type here], [username] & [OP]

If the text [type here] is included in a comment, it will be automatically selected for completion when inserted. [username] will be replaced with the user's name (or just 'user' if nothing was found), and [OP] with the original poster's name (if found, else 'OP').

9. Customise welcome message

The default message is "Welcome to $SITENAME$" - which is shown for any 1-week-old users. By clicking on the 'welcome' link at the bottom of the popup, you can opt to change this message, or leave it empty to show no messages at all. You can also 'force' the message for older users on a one-off basis. This is per-site.


Installation

Click HERE to install the user script.

Click HERE to preview the code.

For more information about user scripts, check out the script tag wiki here.

Update info

(See comments and answers below for details)

V1.2.8 - Update to take advantage of new 'draggable dialogue' functionality.

V1.2.7 - Correct bug noted by Oddthinking, and implement the 'force welcome' function requested by Martin Scharrer.

V1.2.6 - Implement the much-requested override for the new user Welcome message. Correct a bug with mangled markdown and another due to modified SE markup.

V1.2.5 - Implement [OP] tag as suggested by Gaffi. 'Fix' for markdown/html conversion bug reported by Madara Uchiha.

V1.2.4 - Modify code to get script working in new Review (reported by Oliver Salzburg), hat-tip to Shog9 for the fix.

V1.2.3 - Slight modification to remote dialogue (details here). You can now use [username] as a wildcard (as suggested by daviesgeek). Corrected & bug noted by Oliver Salzburg

V1.2.2 - Remote comment sources. Broadcasts. Read the details here.

V1.2.1 - update to work with 10k tools (suggested/implemented by ThiefMaster)

V1.2.0 - one fix (remove greeting before switching to edit mode), and one feature: hit Enter key to submit (suggested by Bruno Pereira). Note that this isn't a major change, it's just my version comparison is string-wise, so V1.1.10 won't work.

V1.1.9 - fixed nasty javascript regex backreference replace bug (reported by ThiefMaster). For explanations see here and here.

V1.1.8 - fixed 'jQuery 1.7.1' bug, which stopped insert button being enabled. (No idea why it stopped working - though judging from this, maybe it should never have worked, as I was using attr("disabled", ""))

V1.1.7 - create pseudo categories for differentiating between comments for questions and comments for answers (suggested by oers) - simply prefix the comment title with [Q] or [A]

V1.1.6 - make script work in /admin/dashboard (for moderators, requested/implemented by Sathya)

V1.1.5 - make script work in /review (requested by Gilles (now uses jquery delegate for attaching events)

V1.1.4 - if the text [type here] is included in a comment, it will be automatically selected for completion (requested by daviesgeek)

V1.1.3 - include Registered/Unregistered in user info (requested by waiwai933).

V1.1.2 - Fixed bug when using 'magic' links (reported by Alex)

V1.1.1 - If you have descriptions auto-hidden, the selected one will still be shown (suggested by Alex).

V1.1.0 - bug fix. (SE's full.js is now delayed at load, so the unbind('click') was undoing my click() - fix from @balpha).

V1.0.9 -

- a) removed upgrading bits from previous version

- b) added internal notification feature

- c) now uses internal notification for announcing new versions
- d) corrected the 'new versions announced once only' (it never worked AFAICT)

- e) corrected the $SITEURL$ escaping 'quirk'

- f) stopped using .owner class for userinfo
- g) corrected bug which showed greeting twice.

V1.0.8 -

- a) Mend see-through code.

- b) Make storage more neighbour-friendly (add prefix, backwards compatible).

- c) Allow variable number of custom comments (can only be modified via import).

- d) Add show/hide description functionality. Add vertical scrollbars if too many comments.

- e) Use 'selfupdatingscript' for update checks

- f) Revert $SITEURL$ to not contain the http://.

V1.0.7 - add an import/export function - can be used to transport custom comments between sites (note the use of $SITEURL$ and $SITENAME$ tags),

V1.0.6 - changes to the list of included urls

V1.0.5 - suppress warnings on new updates if already installed (previously each site would tell you about a new update, even if you'd already installed it)

V1.0.4 - corrected two bugs in code detecting the appropriate userid to lookup

V1.0.3 - corrected a bug in rep formatting. Integrated a function to poll once a day for new versions and notify user if any found.

V1.0.2 - implemented customisation, using HTML5 storage to allow users to create/modify their own messages

V1.0.1 - some refactoring, corrected a bug in the regex that converted html to markup.

Note

Any comments welcome, whether on the functionality or the code.

Can be used in tandem with my other user script.

Credits

TomWij (below) created a modified version of the script, which inspired my V1.0.8

balpha came up with the clever (evil) way to make the script 'self-updating'

All the people who made suggestions in the comments and answers below!

Known issues/Future plans

Currently thinking about how to make the Welcome message configurable (i.e, how to present the configuration in the interface without creating extra clutter)

The main future plan is to get this script adopted by SE. I like maintaining it, but some of the usability niggles (sharing across sites is still clunky, even with the remote option) can only be resolved centrally. (Vote here if you agree!)

The new 'service announcement' functionality has a major 'bug' - you have to dismiss it manually on every single site. Sorry!

Show more