1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-20 01:12:38 +01:00

Open details pane only when clicking non-interactive elements

Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3202
This commit is contained in:
Raymond Hill 2024-04-11 11:12:37 -04:00
parent 79543d6c32
commit 6e61a13e40
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1947,13 +1947,13 @@ dom.on(document, 'keydown', ev => {
// interpreted as a request to open the details of the entry. // interpreted as a request to open the details of the entry.
let selectionAtMouseDown; let selectionAtMouseDown;
let selectionAtTimer; let selectionAtTimer;
dom.on('#netInspector', 'mousedown', '.canDetails *', ev => { dom.on('#netInspector', 'mousedown', '.canDetails *:not(a)', ev => {
if ( ev.button !== 0 ) { return; } if ( ev.button !== 0 ) { return; }
if ( selectionAtMouseDown !== undefined ) { return; } if ( selectionAtMouseDown !== undefined ) { return; }
selectionAtMouseDown = document.getSelection().toString(); selectionAtMouseDown = document.getSelection().toString();
}); });
dom.on('#netInspector', 'click', '.canDetails *', ev => { dom.on('#netInspector', 'click', '.canDetails *:not(a)', ev => {
if ( ev.button !== 0 ) { return; } if ( ev.button !== 0 ) { return; }
if ( selectionAtTimer !== undefined ) { if ( selectionAtTimer !== undefined ) {
clearTimeout(selectionAtTimer); clearTimeout(selectionAtTimer);
@ -1968,21 +1968,17 @@ dom.on(document, 'keydown', ev => {
}, 333); }, 333);
}); });
dom.on( dom.on('#netInspector', 'click', '.logEntry > div > span:nth-of-type(8) a', ev => {
'#netInspector', vAPI.messaging.send('codeViewer', {
'click', what: 'gotoURL',
'.logEntry > div > span:nth-of-type(8) a', details: {
ev => { url: ev.target.getAttribute('href'),
vAPI.messaging.send('codeViewer', { select: true,
what: 'gotoURL', },
details: { });
url: ev.target.getAttribute('href'), ev.preventDefault();
select: true, ev.stopPropagation();
}, }
});
ev.preventDefault();
ev.stopPropagation();
}
); );
})(); })();