Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

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 (canned responses), which you can easily click to insert.

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

Thumbnail

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] (& $MYUSERID$)

    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'). Also, $MYUSERID$ will be replaced with your user id for the current site.

  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.

    Screenshot

Installation, other info

Development of this app is being coordinated over on GitHub. Please see the relevant sections over there to review the source code, view the release notes, report bugs or add feature requests, or read the full documentation.

The app is available for installation:

You may also download the code and run the build process yourself to generate the userscript version as well as Chrome, Firefox and Opera extensions that you can install locally if you'd rather not use the store versions.

Note: Can be used in tandem with my other user script.

share|improve this question
5  
Just recently, this has stopped working for me on Firefox 22.0. The "Auto" button just does not appear anymore. –  John Saunders Jul 24 '13 at 19:02
1  
@MadaraUchiha see below (note, this is not an 'official' fix, just to let you know where to up vote :) –  Benjol Jul 25 '13 at 4:44
1  
@Derek朕會功夫, because I resent the fact that Google are forcing me to pay to give something away. –  Benjol Dec 3 '13 at 5:51
1  
@hexafraction, FYI we've moved to GitHub. –  Benjol Mar 3 at 9:58
1  
@MadaraUchiha, if you're interested, we've moved to GitHub as you suggested (though not quite gone the same file-splitting route as you envisaged) –  Benjol Mar 3 at 9:59
1  
@CanadianLuke, in future there should be. Follow this issue on GitHub –  Benjol Mar 3 at 10:01

54 Answers 54

up vote 6 down vote accepted

Please report new issues or feature requests on our issue tracker!

The work on making this a full-blown Github based project originally outlined in this answer is now complete. All further feature requests and bug reports should be directed at the Github issue tracker.


I have taken the liberty of doing some organization.

  1. I have created a full blown Github repo here. The master branch is the latest from benjol's gist and all commit history is included. The master branch can be installed from this alternate location as a userscript using this url. This should make it easier for others to fork and send pull requests with changes back upstream.

  2. I have created branches that include all the gists that had been forked off of this and merged in those commits. Most of these are behind master and would need rebasing, but at least no work will be lost in the shuffle and this should make it easier to review and integrate their work.

  3. I have created a fork of my own and selectively merged in changes from the branch that came from Izzy's work in gist. His work includes changes so that custom comments are stored and retrieved per-site, but it also included his default comments hard coded in. I cherry-picked just the functional stuff and made a few tweaks. I have tentatively called this 1.4.0-beta1 and can be installed as a userscript from this link. There are some known bugs still but when it's ready I'll submit a pull request and maybe these can be merged into master.

This was just leg work to get everything cleaned up and manageable using a full repo instead of gists which were gitting out of hand.

share|improve this answer

Future ideas: use HTML5 storage to allow users to create/modify their own messages.

enter image description here

  • double click on a title or description to modify
  • save/cancel
  • 'reset' link at bottom of popup (not shown above) resets all custom messages to default

Important

  • The 'Welcome to SiteName!' text is prepended automatically if the user has been member for less than a week.
  • This uses HTML5 Storage, so custom texts only work on the site where they were entered.

NOTE

With this modification, there is no longer any reason that this userscript should be strictly limited to 'review'.

share|improve this answer
5  
How can I make it so that it doesn't say "Welcome to Stack Overflow!". I really don't want this. –  casperOne Dec 29 '11 at 23:12

(used this fix in V1.2.9)

Some people are experiencing a problem where the auto link does not appear. This has to do with the fact that the DOM elements on which the selector is based are dynamically loaded into the DOM.

The workaround for this is to change line 683 to:

setTimeout(function() {
    $('#' + divid).find('.comment-help-link').parent().append(newspan);
}, 10);

Basically this is just a minor time out before trying to add the link, which should not be noticeable.

I'm not 100% sure about the 10 milliseconds, but it works for me (Chrome Canary). If it still doesn't appear for you try 100 milliseconds or something like that.

share|improve this answer
2  
@Dimension10: the script auto-checks for updates everyday, so you can just wait. A new version will not override any customization of comment texts, no. –  Benjol Aug 12 '13 at 11:28

(but not much time in the immediate future, if someone else wants to try...)

Now tracked as a GitHub issue.


Feature Request

Can we have the auto link appear when completing a custom "off-topic" closure reason?

Bonus points if we can declare certain auto-comments to apply in this scenario (e.g. mirroring the "A" and "Q" prefix for answers and questions). Perhaps "C" for closure reasons?

example

share|improve this answer
3  
I just came here to ask the same thing - yes please. –  Iain Jul 19 '13 at 15:56

There are two 'major' changes to V1.2.2

'Remote' comment source

You can now define an external source for your comments, and 'import' them. This means that you don't have to manually copy comments from site to site and PC to PC.

To do this, you click on the 'remote' link; enter the url for your data source; then click on 'get now'.

The data source must be formatted as jsonp. There is a new 'jsonp' link in the import/export dialog which will create the appropriate jsonp from your existing comments.

It is also possible to automatically invoke it every time you open the dialog, by selecting the auto-get checkbox. I'm interested in feedback on this.

'Broadcasts'

I've added a function to be able to 'broadcast' messages without changing the code. The intended use for this will be to ask for feedback on proposed future changes. Taken this off-line again, it was not completely thought-through and you had to dismiss on every site... (sigh, no global storage)

share|improve this answer
1  
@jrg, actually, don't. There seem to be problems with parallel ajax queries here. While trying the next version I found the comments sometimes just disappear and never come back. –  Benjol May 23 '12 at 12:21

I'll drop my setup here.

###Comment as answer
__This is not a forum. Please only use the 'Post Your Answer' button if you can answer the asker's question; <a href="http://gaming.stackexchange.com/privileges/comment">post a comment</a> otherwise.__ We require some <a href="http://gaming.stackexchange.com/faq#reputation">reputation</a> before you can comment others' posts to prevent abuse; why don't you try and get some by <a href="http://gaming.stackexchange.com/unanswered">answering a question?</a>

###Question as answer
__This is not a forum. If you have a different question from the asker's, please use the <a href="http://gaming.stackexchange.com/questions/ask">Ask Question</a> button__ instead. You don't even have to login!

###Upvote as Answer
__This is not a forum. If you wish to thank somebody, you should <a href="http://gaming.stackexchange.com/privileges/vote-up">vote him up</a>.__ We require a little bit of <a href="http://gaming.stackexchange.com/faq#reputation">reputation</a> before you can do that to prevent abuse; why don't you get some by <a href="http://gaming.stackexchange.com/unanswered">answering a question?</a>

###Not a Real Question
This is not a forum; __this is a questions and answer site, and I'm afraid your post isn't really a question, because <a href="http://blog.stackoverflow.com/2011/01/real-questions-have-answers/">real questions have answers, not items or ideas or opinions</a>.__ <a href="http://gaming.stackexchange.com/faq">Please read the FAQ for more information.</a>
share|improve this answer
1  
watch out, because the "Welcome to SiteName" is automagically added if the user is 'younger' than a week. –  Benjol Mar 2 '11 at 16:54
1  
Posting setups is a good idea though –  Benjol Mar 2 '11 at 17:02
2  
I've added an import/export function which will make pasting setups like this easier, and also allow you to copy between sites (and/or browsers). I'm starting to like your list more than my own :) –  Benjol Mar 4 '11 at 10:29

I felt limited by only six comments, so I made some small improvements.

Implemented the following features:

Head list items are intended for users, sub list items are intended for developers.

  • Allow the user to enter an unlimited amount of comments. (Add them in import/export)

    • Based the script on the local storage, while using comments only for initial data or to reset.
    • Refactored duplicate code & checks as comments behavior is replaced by localStorage.
       
  • Scrollbar for when the amount of comments exceeds the standard height.

  • Added a link to allow the user to toggle the visibility of descriptions.

    • This is remembered by using the local storage.
       
  • Improved see-through behavior by hiding title and buttons and making it more transparent.

  • Fixed invalid info: "User info detection doesn't work on CW answers, nor with deleted users."

    The box now either shows "This user is not registered." or hides.

  • Fixed greeting consistency, it's now added again after editing comments.

Old version:

Please make sure that both versions do not conflict.

Download Old Version | Source

This has been implemented by Benjol!

share|improve this answer
1  
Tom, they say imitation is the sincerest form of flattery, so I'll forgive you suggesting people remove my script! :) Not sure if I'll have time to look at this today, but I'll work through your modifications and see whether/how I might integrate them. I think it would be interesting if you could 'export' your comments and paste them here, like @badp did. –  Benjol Mar 7 '11 at 7:19
2  
@TomWij, V1.0.8 integrates all your modifications (except that I just hide userinfo if I can't find any). –  Benjol Mar 17 '11 at 13:30

Can comment text please be collapsed/hidden by default and only expanded for the currently chosen option? This would work kind of like the 'more info' link in the faq which pops out when you click it. (My dialog is getting pretty big now and this would really help!)

Example mockup

As already said by many others - thank you so much for this script!!

share|improve this answer
2  
status-completed –  Benjol Jul 20 '11 at 5:17
1  
Epic turnaround time and awesome script! –  Kit Menke Jul 20 '11 at 13:36

Doesn't work on superuser.com (only www.superuser.com) because it includes only domains with a period like so:

http://*.superuser.com

and should be

http://*superuser.com
share|improve this answer

Feedback:

The definitions of the sites are not all-inclusive. For instance, the link doesn't show up on stackapps ;)

share|improve this answer

Another future idea: expandable groups of comments similar to the way Close>Off-Topic opens a list of sites.

share|improve this answer
1  
Implementation thoughts: See my answer for a local storage based extension. Use a new syntax (eg. ##) that when read is stored as a comment with description "header", then when reading such comment you could embed all subsequent non-header comments and easily have expandable groups. –  Tom Wijsman Mar 4 '11 at 18:19

(something equivalent, anyway)

I see a couple of comments here suggesting that Benjol is thinking of making the Welcome message configurable.

This is a formal request for that feature.

On Skeptics.SE, we have a meta-post which is a Welcome to New Users FAQ, and explains some of the ways Skeptics.SE differs from other Stack Exchanges. I have experimentally forked this code, just to make the Welcome message include a link to this meta-post.

Unfortunately, my JavaScript skills are too dodgy to make it customisable and offer it back to you as a patch. (The customisation strikes me as particularly tricky for the troublesome few that moderate multiple Stack Exchanges.)


Suggested presentation:

This is only a suggestion - incorporate it into the existing options file. It is a bit ugly, but I think better than having a whole separate config system.

~~~ This is comment text. This line represents the default.
Welcome, my dearest new friend, to $SITENAME.

~~~[skeptics] Using the same 'restriction' notations as [Q] and [A], this overrides the default for one site.
[Welcome to Skeptics](http://meta.skeptics.stackexchange.com/questions/1505/welcome-to-new-users)!

An alternative would be to put it all on one line, but then the [qualifier] notation would conflict with the [link]() notation.

share|improve this answer

Can you also add the auto link on the flag review page of 10k+ users? Especially when going through the "not an answer" flags there are tons of "thanks" and "question instead of answer" posts.

Update: To get it working, there are only minor changes needed:

  • Enable the script for /tools* on the various sites
  • Add .mod-post-header to the delegate list for the click event:

    $(".question, .answer, #questions, .flag-container, .mod-post-header").delegate(".comments-link", "click", function () {
    
share|improve this answer

Small bug: I haven't figured out at which point this happens exactly, but the script seems to be over-enthusiastic adding the "Welcome" prefix:

Welcome to $SITENAME$! Welcome to $SITENAME$! Welcome to $SITENAME$! The code you show is vulnerable to SQL injection. Use the proper sanitation method of your library (like mysql_real_escape_string() for the classic mysql library), or switch to PDO and prepared statements.

Unless you already know what causes this, I'll keep an eye on it and report back.

share|improve this answer

Can you add multiple pages of comments? Currently if you have a lot of auto comments, you have to scroll to see them, but it would be nice to be able to click next and previous to see lists of about 5 comments.

Also, the "see through" feature is cool, but it should be activated by a click, instead of on mouse over.

One more problem: Importing the comments seems not to save them.

share|improve this answer
1  
Hang on, is that Firefox 9 an upside-down six?! –  Benjol Sep 19 '11 at 13:32

Future idea: include an 'auto-update' function which polls for new versions and notifies user (with anti-nagging functionality).

share|improve this answer

Somehow, it doesn't show the "auto" link any more here... re-installed already. FF 4.0.1 using latest version of Greasemonkey.

share|improve this answer
1  
Fixed this in V1.1.0 –  Benjol May 11 '11 at 7:45

Bug: if my comment contains &, when I insert it it will insert &amp; instead.

Preview

enter image description here

Result

enter image description here

Import/Export

enter image description here

share|improve this answer

@Benjol You could add the extra set of comments that I use in-tandem with Phrase Express:


@<username> Please don’t use signatures or taglines in your posts. Every post you make is already "signed" with your standard user card, which links directly back to your user page


Shopping questions are off-topic as per the FAQ: it is not about a shopping or buying recommendation


share|improve this answer

Request: I see a lot of newbies post a comment saying "Thanks this worked perfect for me. It's exactly what I need" on an answer to their question, yet they do not mark the answer as accepted. [username] plugs in the username of the answerer when posting on an answer, but it would be helpful to also include an [OPusername] (or something to that effect) to be able to @ the original question asker on a specific answer.

i.e.

"If this answer is helpful to you, [OPusername], then please consider marking it as the accepted answer so others may more easily find it in the future. This is also a polite way to thank the person answering your question for helping you out."

share|improve this answer
1  
Implemented, but using [OP] instead of [OPusername] –  Benjol Nov 1 '12 at 6:38

Here's a bug report.

I've attempted to add the following comment:

[**Please, don't use `mysql_*` functions in new code**](http://bit.ly/phpmsql). They are no longer maintained and the [deprecation process](http://j.mp/Rj2iVR) has begun on it. See the [**red box**](http://j.mp/Te9zIL)? Learn about [*prepared statements*](http://j.mp/T9hLWi) instead, and use [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli) - [this article](http://j.mp/QEx8IB) will help you decide which. If you choose PDO, [here is a good tutorial](http://j.mp/PoWehJ).

Which should render like so:

Please, don't use mysql_* functions in new code. They are no longer maintained and the deprecation process has begun on it. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.

Instead, right after saving, it renders to

[**Please, don't use `mysql_*` functions in new code***](http://bit.ly/phpmsql)*. They are no longer maintained and the [deprecation process](http://j.mp/Rj2iVR) has begun on it. See the [**red box**](http://j.mp/Te9zIL)? Learn about [</a>*<a href="http://j.mp/T9hLWi">prepared statements*](http://j.mp/T9hLWi) instead, and use [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli) - [this article](http://j.mp/QEx8IB) will help you decide which. If you choose PDO, [here is a good tutorial](http://j.mp/PoWehJ).

Which renders as

Please, don't use mysql_* functions in new code*. They are no longer maintained and the deprecation process has begun on it. See the red box? Learn about prepared statements* instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.

I suspect the asterisks are derailing it, but why should it care about it anyway? Does it attempt to also fix the comment before saving?


Edit

Seems like the Comment's markdown is parsed into HTML and then remapped to Markdown (why?!). Using's Chrome's console and editing the localStorage directly with

<a href="http://bit.ly/phpmsql"><strong>Please, don't use <code>mysql_*</code> functions in new code</strong></a>. They are no longer maintained and the <a href="http://j.mp/Rj2iVR">deprecation process</a> has begun on it. See the <a href="http://j.mp/Te9zIL"><strong>red box</strong></a>? Learn about <a href="http://j.mp/T9hLWi"><em>prepared statements</em></a> instead, and use <a href="http://php.net/pdo">PDO</a> or <a href="http://php.net/mysqli">MySQLi</a> - <a href="http://j.mp/QEx8IB">this article</a> will help you decide which. If you choose PDO, <a href="http://j.mp/PoWehJ">here is a good tutorial</a>.

Appears to fix the problem.

share|improve this answer
1  
to be honest, I can't remember when or why I decided to store it as HTML. Whatever, I've got a pseudo-correction in the works (very pseudo, it skips transformations of * and ** if it finds a backtick in the middle). –  Benjol Oct 25 '12 at 8:54

Can $SITENAME$ be changed for Christianity? Here's what a comment to a new user reads:

Welcome to Christianity! ...

Which sounds pretty creepy. For one thing, most folks who stumble into the site are already affiliated with some faith, which might or might not be Christianity. For another, it sounds like we are a cult or a church. We aren't.

Could $SITENAME$ be changed to "Christianity—Stack Exchange" or "Christianity.SE"?

(I haven't tried to adjust the messages myself, but besides being a bit tedious, it probably would be best to not have new users of the script sending the wrong signals.)

It's less of a concern, but I think it would be odd to see messages like:

Welcome to English! ...

or

Welcome to Parenting! ...


I forked a version and made the following changes at line 67:

if(sitename == "Stack Exchange"){
  sitename = arr[arr.length - 2]; //workaround for SE sites..
  greeting = 'Welcome to ' + sitename + '—Stack Exchange! ';
  sitename = sitename + '.SE';
}

That way, the "Answers just to say Thanks!" comment reads:

Welcome to Christianity—Stack Exchange! Please don't add "thanks" as answers. Invest some time in the site and you will gain sufficient privileges to upvote answers you like, which is the Christianity.SE way of saying thank you.

The same comment on SO reads:

Welcome to Stack Overflow! Please don't add "thanks" as answers. Invest some time in the site and you will gain sufficient privileges to upvote answers you like, which is the Stack Overflow way of saying thank you.

share|improve this answer
1  
Typically lazy developer's response, how about *%SITENAME%*? –  Benjol Mar 7 '12 at 7:13
1  
the way I'm thinking about it right now, I think I'd be tempted to make the whole greeting configurable (there are some people who don't like it). I've got a few other changes in the pipes, so this may take a while. In the meantime, if you want to do a personal hack while you're waiting, you need to track down the user-script file, go to line 66, and replace sitename = arr[arr.length - 2]; with sitename = arr[arr.length - 2] + 'your_suffix_here';. After saving, you'll need to F5 in your browser to see the difference... –  Benjol Mar 9 '12 at 6:44
1  
Looks good to me, watch out, I've got a new version coming up, you'll need to rebase your fork :) –  Benjol Mar 23 '12 at 14:56

Feature Request

Have a selector that is similar to [OP] but it would select the poster of the answerer instead of the question. This would obviously only apply to comments on answers. It could look something like

[OAP] // stands for "Original Answer Poster"
[AP]  // stands for "Answer Poster"
share|improve this answer

It would be nice to have a place other than in these answers for us to share setups. Could you provide one and link it to the main post?

I thought about posting another question to deal with this, but wasn't sure if it belonged in stackapps or meta.stackapps.

share|improve this answer
1  

Since you're fetching user info from the userpage, could you add in something to show whether the user is registered or not?

share|improve this answer

There appears to be a bug with the [edit] magic link.

Using this text:

Question needs more information

We need more information to answer your question. Please [edit] your post and add details as requested by the community. It will be closed for now, but don't worry - once you have improved the question flag a moderator and it can be reopened. See How do I ask questions here? for general guidelines.

Gives a broken preview:

enter image description here

The comment still inserts OK however.

share|improve this answer

The same way we press Esc to close the list can we have Enter to add the comment directly instead of the button bellow the list?

My list is getting a bit big and every time I need to select a comment (in a small laptop screen mind you) I need to scroll to the comment, click, scroll down to the end, click to add the comment and the scroll back up on the page to where I was before.

Can this be fixed so Enter adds the comment directly without needing to scroll all the way down?

share|improve this answer

In GreaseMonkey the Name of the Script is AutoReviewComments but the name of the StackApp is Pro-Forma comments.

This makes it very hard to find the app (once you forgot its name :D).

Maybe those could be named equally?

share|improve this answer

The following message breaks the script, apparently due to the $ in backticks:

###jQuery-$
Did you know that you only have to write `jQuery` in its long form once? By wrapping your code in `(function($) { .... })(jQuery);`, you can use `$` no matter if `noConflict` has been used or not.
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .