Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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);
 })();
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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