mirror of https://github.com/gorhill/uBlock.git
Support aborting "Pick" mode in element picker
This allows a user to go back to the previous selection after entering interactive "Pick" mode.
This commit is contained in:
parent
0f4e50db07
commit
a557f62112
|
@ -266,9 +266,6 @@ html#ublock0-epicker,
|
|||
height: 2em;
|
||||
width: 2em;
|
||||
}
|
||||
#ublock0-epicker:not(.paused) #windowbar #minimize {
|
||||
display: none;
|
||||
}
|
||||
#windowbar #quit:hover,
|
||||
#windowbar #minimize:hover {
|
||||
background-color: var(--surface-2)
|
||||
|
|
|
@ -161,9 +161,9 @@ dom.cl = class {
|
|||
}
|
||||
}
|
||||
|
||||
static remove(target, name) {
|
||||
static remove(target, ...names) {
|
||||
for ( const elem of normalizeTarget(target) ) {
|
||||
elem.classList.remove(name);
|
||||
elem.classList.remove(...names);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -802,14 +802,16 @@ const showDialog = function(details) {
|
|||
/******************************************************************************/
|
||||
|
||||
const pausePicker = function() {
|
||||
pickerRoot.classList.add('paused');
|
||||
dom.cl.add(pickerRoot, 'paused');
|
||||
dom.cl.remove(pickerRoot, 'minimized');
|
||||
svgListening(false);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
const unpausePicker = function() {
|
||||
pickerRoot.classList.remove('paused', 'preview');
|
||||
dom.cl.remove(pickerRoot, 'paused', 'preview');
|
||||
dom.cl.add(pickerRoot, 'minimized');
|
||||
pickerContentPort.postMessage({
|
||||
what: 'togglePreview',
|
||||
state: false,
|
||||
|
@ -836,7 +838,12 @@ const startPicker = function() {
|
|||
$id('create').addEventListener('click', onCreateClicked);
|
||||
$id('pick').addEventListener('click', onPickClicked);
|
||||
$id('minimize').addEventListener('click', ( ) => {
|
||||
dom.cl.toggle(dom.html, 'minimized');
|
||||
if ( dom.cl.has(pickerRoot, 'paused') === false ) {
|
||||
pausePicker();
|
||||
onCandidateChanged();
|
||||
} else {
|
||||
dom.cl.toggle(pickerRoot, 'minimized');
|
||||
}
|
||||
});
|
||||
$id('quit').addEventListener('click', onQuitClicked);
|
||||
$id('move').addEventListener('mousedown', onStartMoving);
|
||||
|
|
Loading…
Reference in New Issue