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.

About

This user script disables the default behavior of the enter key submitting a comment. With this script installed, you must explicitly click the Add Comment button to submit your comment.

Source

If you have Firefox+GreaseMonkey, Opera, or Google Chrome, try this GreaseMonkey script that will disable enter in comments.

// ==UserScript==
// @name           Disable Enter key on comments on Stack Exchange.
// @namespace      http://networkpx.googlecode.com
// @description    Disable Enter key on comments on Stack Exchange.
// @include        http://*.stackexchange.com/*
// @include        http://stackoverflow.com/*
// @include        http://meta.stackoverflow.com/*
// @include        http://serverfault.com/*
// @include        http://meta.serverfault.com/*
// @include        http://superuser.com/*
// @include        http://meta.superuser.com/*
// @include        http://askubuntu.com/*
// @include        http://meta.askubuntu.com/*
// ==/UserScript==

var s = document.createElement("script");
    s.innerHTML = '$(document).delegate(".comments-link, .comment-edit", "click", function(e) { \
  var events = $(this).closest("td").find("textarea[name=comment]").data("events"); \
  var makeShift = { handler: function(e) { e.shiftKey = true; } }; \
  events.keyup.splice(0, 0, makeShift); \
  events.keypress.splice(0, 0, makeShift); \
});';
document.body.appendChild(s);

Installation

Click here to download this script.

See the script info page for step-by-step install instructions

http://stackapps.com/tags/script/info

share|improve this question
    
P.S. This works on Firefox with GreaseMonkey - I tested it. –  Nathan Osman Feb 17 '11 at 19:26
1  
@Nick: Thanks, now it also prevents the Enter key from posting the comment while editing too! –  Tsuyoshi Ito Jun 7 '11 at 18:43
    
please you didn't include stackapps in your script. –  Mhmd Mar 17 at 18:17
add comment

You must log in to answer this question.

Browse other questions tagged .