mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Add support to toggle no-scripting switch with keyboard shortcut
Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/692
This commit is contained in:
parent
c03c23d962
commit
936444883f
3 changed files with 15 additions and 0 deletions
|
|
@ -30,6 +30,9 @@
|
|||
},
|
||||
"toggle-cosmetic-filtering": {
|
||||
"description": "__MSG_toggleCosmeticFiltering__"
|
||||
},
|
||||
"toggle-javascript": {
|
||||
"description": "__MSG_toggleJavascript__"
|
||||
}
|
||||
},
|
||||
"content_scripts": [
|
||||
|
|
|
|||
|
|
@ -1253,6 +1253,10 @@
|
|||
"message": "Toggle cosmetic filtering",
|
||||
"description": "Label for keyboard shortcut used to toggle cosmetic filtering"
|
||||
},
|
||||
"toggleJavascript": {
|
||||
"message": "Toggle JavaScript",
|
||||
"description": "Label for keyboard shortcut used to toggle no-scripting switch"
|
||||
},
|
||||
"relaxBlockingMode": {
|
||||
"message": "Relax blocking mode",
|
||||
"description": "Label for keyboard shortcut used to relax blocking mode"
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ vAPI.commands.onCommand.addListener(async command => {
|
|||
// Tab-specific commands
|
||||
const tab = await vAPI.tabs.getCurrent();
|
||||
if ( tab instanceof Object === false ) { return; }
|
||||
|
||||
switch ( command ) {
|
||||
case 'launch-element-picker':
|
||||
case 'launch-element-zapper': {
|
||||
|
|
@ -168,6 +169,13 @@ vAPI.commands.onCommand.addListener(async command => {
|
|||
hostname: hostnameFromURI(µb.normalizeTabURL(tab.id, tab.url)),
|
||||
});
|
||||
break;
|
||||
case 'toggle-javascript':
|
||||
µb.toggleHostnameSwitch({
|
||||
name: 'no-scripting',
|
||||
hostname: hostnameFromURI(µb.normalizeTabURL(tab.id, tab.url)),
|
||||
});
|
||||
vAPI.tabs.reload(tab.id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue