Possible to disable custom Javascript keybindings in Safari?
Here is Rob W's script from meta, updated to only block cntrl-* and fixed so that it works with NinjaKit which is a safari extension for running user scripts.
NinjaKit: https://github.com/os0x/NinjaKit
Script:
// ==UserScript==
// @name Cya WMD shortcuts
// @namespace Rob W
// @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);
}
})();
It's been a while since I've used it, but the Privoxy proxy server has the feature to modify javascript to change behavior. If you're willing to run a proxy server, that is an option.
I did look (though not exhaustively), and didn't see a browser plugin that rewrote content (xml, html, CSS, or javascript) like privoxy does. In Privoxy's web page, look for the js-annoyances filter. That is where you'll find examples of rewriting javascript.
Perhaps there's a more modern implementation in the form of a browser plugin that provides a similar feature, but privoxy used to work fine for this use case.