mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-03 01:29:39 +02: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
@ -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 New Issue
Block a user