Disable ctrl-b shortcut in Firefox?

As a tmux user, a lot of Ctrl+ events occur b. Also a lot of Firefox.

It is safe to say that I never want to see a vertical strip with a letter. Not interesting. There has never been a computer for 20 years.

Is there a way to disable Ctrl+ bin Firefox without using a plugin?

+5
source share
3 answers

Many topics on this topic, and none of them seem to work, so I just wrote something that really works. This is for JavaScript only, without try / catch blocks for clarity.

: contentEditable DIV Firefox Ctrl-B, BOLD.

, ( ), ( , div). FF, , Webkit IE .

HTML:

<body onkeydown="bodyKeyHandler(this, event);">
    <div contentEditable="true" onkeydown="editorKeyHandler(event);"></div>
</body>

JAVASCRIPT:

function bodyKeyHandler(o,e) {
    var c = e.ctrlKey;
    var k = e.which;
    if (e.ctrlKey) { 
        switch ( k ) {
            case 17:
                e.preventDefault();
                o.stopPropagation();
                break;
        }
    }
}

function editorKeyHandler(e) {
    var c = e.ctrlKey;
    var k = e.which;
    if (c) { 
        switch ( k ) {
            case 17:
                document.execCommand("bold");
                break;
        }
    }
}

, FF, alert(), , , , ! , , .

+1

, , , , -, JavaScript, try/catch .

: contentEditable DIV Firefox Ctrl-B, BOLD.

, ( ), ( , div). FF, , Webkit IE .

HTML:

<body onkeydown="bodyKeyHandler(this, event);">
    <div contentEditable="true" onkeydown="editorKeyHandler(event);"></div>
</body>

JAVASCRIPT:

function bodyKeyHandler(o,e) {
    var c = e.ctrlKey;
    var k = e.which;
    if (e.ctrlKey) { 
        switch ( k ) {
            case 17:
                e.preventDefault();
                o.stopPropagation();
                break;
        }
    }
}

function editorKeyHandler(e) {
    var c = e.ctrlKey;
    var k = e.which;
    if (c) { 
        switch ( k ) {
            case 17:
                document.execCommand("bold");
                break;
        }
    }
}

, FF, alert(), , , , ! , , .

0

This can be done using userChrome.js with the following code

var key = document.getElementById('viewBookmarksSidebarKb');
if (key) key.remove();

Credit - I found this thanks to this answer https://superuser.com/questions/1318336/how-to-disable-ctrlq-shortcut-in-firefox-on-linux/1348082#1348082

0
source

Source: https://habr.com/ru/post/1649832/


All Articles