4
$\begingroup$

On my keyboard, I programmed CTRLM to be something special, and always when I press CTRLM when I ask a question on Mathematics Stack Exchange, an "Insert Citation" appears! How can I deactivate this "Insert citation"? It's really annoying.

$\endgroup$
5
$\begingroup$

Rob W's answer on Meta Stack Exchange contains a bookmarklet and a user script to disable all of the keyboard shortcuts in the editor.

The answer explains the methodology of the user script, but as is it will no longer work, since Stack Exchange uses https instead of http. You can fix this by changing all the @match lines to something like

// @match          *://stackoverflow.com/*

Also, MathOverflow is not part of the matched sites, so if you ever want to block the keyboard shortcuts on that site you'll have to add a line like

// @match          *://*.mathoverflow.net/*

to the preamble.

Someone better versed than I in user scripts could probably find a way to disable specific keyboard shortcuts.


For completeness, here's the user script with the minor changes described above.

// ==UserScript==
// @name           Cya WMD shortcuts
// @namespace      Rob W
// @version        1.00001
// @match          *://*.stackoverflow.com/*
// @match          *://*.superuser.com/*
// @match          *://*.serverfault.com/*
// @match          *://*.askubuntu.com/*
// @match          *://*.stackexchange.com/*
// @match          *://*.mathoverflow.net/*
// @match          *://stackapps.com/*
// @run-at         document-end
// @grant          none
// ==/UserScript==

(typeof unsafeWindow !== 'undefined' ? unsafeWindow : window).$(function() {
    var p = document.getElementById('wmd-input');
    if (!p) return;
    p = p.parentNode;
    function ignore(e){e.stopPropagation();}    
    p.addEventListener('keydown', ignore, true);
    p.addEventListener('keypress', ignore, true);
    p.addEventListener('keyup', ignore, true);
});
$\endgroup$
  • $\begingroup$ how can I get this file ? $\endgroup$ – user330587 May 29 '17 at 14:13
  • $\begingroup$ You need to install an extension to your browser (e.g., Tapermonkey), and then you can basically copy-and-paste the above code into the extension to get it to run. $\endgroup$ – user642796 May 29 '17 at 15:04

You must log in to answer this question.

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