How do I disable site-specific hotkeys if (and only if) they are already mapped in Opera? For example, I use <C-b> instead of <Right> and <C-h> instead of <BS>. On Stack Overflow/Super User they produce **strong text** and ## Heading ## respectively. I do not want this happen. I can examine Super User/Stack Overflow/some_other_site's javascript and write a userjs to do the job, but this method is not universal.

I'm using Opera-10.51_pre6252 in Gentoo Linux.

link|improve this question

75% accept rate
feedback

1 Answer

up vote 0 down vote accepted

The following userjs prevents firing event for specified hotkeys (see long array starting with ["h"). Does anybody know, how to automatically get the list of hotkeys used by opera? (Without any external scripts that watch for opera ini files and generate similar userjs on changes).

// ==UserScript==
// @include *
// ==/UserScript==
(function() {
 window.opera.addEventListener("BeforeEventListener.keypress", (function(e) {
         if(e.event.ctrlKey || e.event.metaKey) {
             var s=String.fromCharCode(e.event.keyCode).toLowerCase();
             if(["h", "b", "d", "f", "t", "w", "z", "n", "g", "c", "\t"].indexOf(s)!=-1) {
                 e.preventDefault();
             }
         }
     }), false);
 })();
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.