Skip to content

Instantly share code, notes, and snippets.

@sambrightman
Last active October 24, 2016 09:46
Show Gist options
  • Save sambrightman/ca6f6728cfdf8237f8ed4d507e0af0ae to your computer and use it in GitHub Desktop.
Save sambrightman/ca6f6728cfdf8237f8ed4d507e0af0ae to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Cya WMD shortcuts
// @author Rob W
// @description Disables the annoying keyboard shortcuts in StackExchange sites' Markdown editors
// @namespace http://meta.stackexchange.com/questions/2980/is-there-a-way-to-disable-the-hotkeys
// @version 1.0
// @include http://apple.stackexchange.com/*
// @include http://stackoverflow.com/*
// @include http://superuser.com/*
// @include http://meta.superuser.com/*
// @include http://serverfault.com/*
// @include http://meta.serverfault.com/*
// @include http://askubuntu.com/*
// @include http://meta.askubuntu.com/*
// @include http://*.stackexchange.com/*
// @include http://answers.onstartups.com/*
// @include http://meta.answers.onstartups.com/*
// @include http://stackapps.com/*
// @run-at document-end
// @grant none
// ==/UserScript==
(function () {
var p = document.getElementById('wmd-input');
console.log("wmd-input:" + p);
if (p) {
p = p.parentNode;
function ignore(e) {
if (e.ctrlKey) {
e.stopPropagation();
}
}
p.addEventListener('keydown', ignore, true);
p.addEventListener('keypress', ignore, true);
p.addEventListener('keyup', ignore, true);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment