Skip to content

Commit

Permalink
Mind drop events in filter expression field of logger
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Dec 22, 2023
1 parent d7063a0 commit c8b7d1a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Fixes / changes

- [Improve `xml-prune` scriptlet](https://github.com/gorhill/uBlock/commit/d7063a052f)
- [Fix message entries overflowing in logger](https://github.com/gorhill/uBlock/commit/49c8310e22)
- [Add support for `application/x-javascript` in `replace=` option](https://github.com/gorhill/uBlock/commit/abeadf18eb)
- [Extend support for differential updates to imported lists](https://github.com/gorhill/uBlock/commit/443c1f81e1)
Expand Down
16 changes: 16 additions & 0 deletions src/js/logger-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -2251,6 +2251,22 @@ const rowFilterer = (( ) => {
dom.cl.toggle(ev.target, 'on');
builtinFilterExpression();
});
dom.on('#filterInput > input', 'drop', ev => {
const dropItem = item => {
if ( item.kind !== 'string' ) { return false; }
item.getAsString(s => {
qs$('#filterInput > input').value = s;
parseInput();
filterAll();
});
return true;
};
for ( const item of ev.dataTransfer.items ) {
if ( dropItem(item) === false ) { continue; }
ev.preventDefault();
break;
}
});

// https://github.com/gorhill/uBlock/issues/404
// Ensure page state is in sync with the state of its various widgets.
Expand Down
2 changes: 1 addition & 1 deletion src/logger-ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<span id="filterExprGroup">
<button id="filterButton" class="iconified notext" data-i18n-title="loggerRowFiltererButtonTip"><span class="fa-icon">filter</span><span class="hover"></span></button>
<span id="filterInput">
<input type="search" placeholder="logFilterPrompt">
<input type="search" placeholder="logFilterPrompt" spellcheck="false">
<span id="filterExprButton" class="button fa-icon expanded" data-i18n-title="loggerRowFiltererBuiltinTip">angle-up</span>
<div id="filterExprPicker">
<div><span data-filtex="!" data-i18n="loggerRowFiltererBuiltinNot"></span><span data-filtex="\t--\t|\t<<\t|\t##" data-i18n="loggerRowFiltererBuiltinBlocked"></span><span data-filtex="\t\+\+\t|\t\*\*\t|\t#@#" data-i18n="loggerRowFiltererBuiltinAllowed"></span><span data-filtex="[$,](?:csp|permissions|removeparam|redirect-rule|replace|urltransform)=|\t\<\<\t" data-i18n="loggerRowFiltererBuiltinModified"></span></div>
Expand Down

2 comments on commit c8b7d1a

@u-RraaLL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now dropping as:

<html id="uBO-popup-panel" class="dark portrait"><body class="advancedUser" data-more="abcdef" dir="ltr"><div id="panes"><div id="firewall" data-more="e" class="expanded has3pScript"><div data-des="github.com" data-type="*" class="isRootContext isDomain hasSubdomains allowed totalAllowed totalBlocked"><span></span></div></div></div></body></html>

Instead of github.com.

@gorhill
Copy link
Owner Author

@gorhill gorhill commented on c8b7d1a Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested dropping the logger's own text, you selected-dropped from where?


Never mind, I see it's specific to Firefox.

Please sign in to comment.