mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-22 05:37:41 +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
1 changed files with 21 additions and 7 deletions
|
@ -310,8 +310,8 @@ const updateAllFirewallCells = function() {
|
||||||
const buildAllFirewallRows = function() {
|
const buildAllFirewallRows = function() {
|
||||||
// Do this before removing the rows
|
// Do this before removing the rows
|
||||||
if ( dfHotspots === null ) {
|
if ( dfHotspots === null ) {
|
||||||
dfHotspots =
|
dfHotspots = uDom.nodeFromId('actionSelector');
|
||||||
uDom('#actionSelector').on('click', 'span', setFirewallRuleHandler);
|
dfHotspots.addEventListener('click', setFirewallRuleHandler);
|
||||||
}
|
}
|
||||||
dfHotspots.remove();
|
dfHotspots.remove();
|
||||||
|
|
||||||
|
@ -846,10 +846,10 @@ uDom('#lessButton').on('click', ( ) => { toggleSections(false); });
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
const mouseenterCellHandler = function() {
|
const mouseenterCellHandler = function(ev) {
|
||||||
if ( uDom(this).hasClass('ownRule') === false ) {
|
const target = ev.target;
|
||||||
dfHotspots.appendTo(this);
|
if ( target.classList.contains('ownRule') ) { return; }
|
||||||
}
|
target.appendChild(dfHotspots);
|
||||||
};
|
};
|
||||||
|
|
||||||
const mouseleaveCellHandler = function() {
|
const mouseleaveCellHandler = function() {
|
||||||
|
@ -901,7 +901,7 @@ const unsetFirewallRuleHandler = function(ev) {
|
||||||
0,
|
0,
|
||||||
ev.ctrlKey || ev.metaKey
|
ev.ctrlKey || ev.metaKey
|
||||||
);
|
);
|
||||||
dfHotspots.appendTo(cell);
|
cell.appendChild(dfHotspots);
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -1110,6 +1110,20 @@ const toggleHostnameSwitch = async function(ev) {
|
||||||
hashFromPopupData();
|
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.
|
// Poll for changes.
|
||||||
|
|
Loading…
Reference in a new issue