mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-13 02:14:17 +01:00
[firefox] create key elements even if no shortcut assigned
This commit is contained in:
parent
7aab05f00a
commit
88cafba445
1 changed files with 4 additions and 9 deletions
|
@ -3435,19 +3435,14 @@ vAPI.commands = (function() {
|
||||||
|
|
||||||
var myKey, shortcut, parts, modifiers, key;
|
var myKey, shortcut, parts, modifiers, key;
|
||||||
for ( var command of commands ) {
|
for ( var command of commands ) {
|
||||||
|
modifiers = key = '';
|
||||||
shortcut = vAPI.localStorage.getItem('shortcuts.' + command.id);
|
shortcut = vAPI.localStorage.getItem('shortcuts.' + command.id);
|
||||||
if ( shortcut === null ) {
|
if ( shortcut === null ) {
|
||||||
vAPI.localStorage.setItem('shortcuts.' + command.id, '');
|
vAPI.localStorage.setItem('shortcuts.' + command.id, '');
|
||||||
|
} else if ( (parts = /^((?:[a-z]+-){1,})?(\w)$/.exec(shortcut)) !== null ) {
|
||||||
|
modifiers = (parts[1] || '').slice(0, -1).replace(/-/g, ',');
|
||||||
|
key = parts[2] || '';
|
||||||
}
|
}
|
||||||
if ( typeof shortcut !== 'string' ) { continue; }
|
|
||||||
parts = /^((?:[a-z]+-){1,})?(\w)$/.exec(shortcut);
|
|
||||||
if ( parts === null ) { continue; }
|
|
||||||
modifiers = parts[1];
|
|
||||||
if ( typeof modifiers === 'string' ) {
|
|
||||||
modifiers = parts[1].slice(0, -1).split('-').join(' ');
|
|
||||||
}
|
|
||||||
key = parts[2];
|
|
||||||
if ( typeof key !== 'string' ) { continue; }
|
|
||||||
myKey = doc.createElement('key');
|
myKey = doc.createElement('key');
|
||||||
myKey.setAttribute('id', 'uBlock0Key-' + command.id);
|
myKey.setAttribute('id', 'uBlock0Key-' + command.id);
|
||||||
if ( modifiers !== '' ) {
|
if ( modifiers !== '' ) {
|
||||||
|
|
Loading…
Reference in a new issue