Skip to content

Instantly share code, notes, and snippets.

@NickCraver
Created December 9, 2010 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickCraver/735127 to your computer and use it in GitHub Desktop.
Save NickCraver/735127 to your computer and use it in GitHub Desktop.
User Script - Disable Enter key on comments on StackExchange.
// ==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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment