mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-11 09:31:01 +01:00
Add ability to toggle god mode in popup panel
Pressing spacebar will toggle god mode in popup panel. This capability shouldn't encourage people to misuse _allow_ rules as having to press the space bar act as an extra necessary step which purpose is to make the creation of _allow_ rules more mindful.
This commit is contained in:
parent
9270f50fe3
commit
aec2f81884
1 changed files with 21 additions and 7 deletions
|
@ -310,8 +310,8 @@ const updateAllFirewallCells = function() {
|
|||
const buildAllFirewallRows = function() {
|
||||
// Do this before removing the rows
|
||||
if ( dfHotspots === null ) {
|
||||
dfHotspots =
|
||||
uDom('#actionSelector').on('click', 'span', setFirewallRuleHandler);
|
||||
dfHotspots = uDom.nodeFromId('actionSelector');
|
||||
dfHotspots.addEventListener('click', setFirewallRuleHandler);
|
||||
}
|
||||
dfHotspots.remove();
|
||||
|
||||
|
@ -846,10 +846,10 @@ uDom('#lessButton').on('click', ( ) => { toggleSections(false); });
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
const mouseenterCellHandler = function() {
|
||||
if ( uDom(this).hasClass('ownRule') === false ) {
|
||||
dfHotspots.appendTo(this);
|
||||
}
|
||||
const mouseenterCellHandler = function(ev) {
|
||||
const target = ev.target;
|
||||
if ( target.classList.contains('ownRule') ) { return; }
|
||||
target.appendChild(dfHotspots);
|
||||
};
|
||||
|
||||
const mouseleaveCellHandler = function() {
|
||||
|
@ -901,7 +901,7 @@ const unsetFirewallRuleHandler = function(ev) {
|
|||
0,
|
||||
ev.ctrlKey || ev.metaKey
|
||||
);
|
||||
dfHotspots.appendTo(cell);
|
||||
cell.appendChild(dfHotspots);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -1110,6 +1110,20 @@ const toggleHostnameSwitch = async function(ev) {
|
|||
hashFromPopupData();
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
Space bar: toggle god mode
|
||||
|
||||
*/
|
||||
|
||||
const keyboardHandler = function(ev) {
|
||||
if ( ev.keyCode === 0x20 ) {
|
||||
document.body.classList.toggle('godMode');
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('keydown', keyboardHandler);
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// Poll for changes.
|
||||
|
|
Loading…
Reference in a new issue