mirror of https://github.com/gorhill/uBlock.git
Normalize Adguard's plain cosmetic filters disguised as style-based filters
Reported by https://github.com/uBlock-user in https://github.com/orgs/uBlockOrigin/teams/ublock-issues-volunteers/discussions/56 For some reasons, many cosmetic filters in Adguard's Annoyance List are plain cosmetic filters disguised as style-based cosmetic filters, and this was breaking uBO's ability to reverse lookup such filters from the logger.
This commit is contained in:
parent
96fe5f7232
commit
e2d1f50dd8
|
@ -119,9 +119,16 @@
|
|||
};
|
||||
|
||||
const translateAdguardCSSInjectionFilter = function(suffix) {
|
||||
var matches = /^([^{]+)\{([^}]+)\}$/.exec(suffix);
|
||||
const matches = /^([^{]+)\{([^}]+)\}$/.exec(suffix);
|
||||
if ( matches === null ) { return ''; }
|
||||
return matches[1].trim() + ':style(' + matches[2].trim() + ')';
|
||||
const selector = matches[1].trim();
|
||||
const style = matches[2].trim();
|
||||
// For some reasons, many of Adguard's plain cosmetic filters are
|
||||
// "disguised" as style-based cosmetic filters: convert such filters
|
||||
// to plain cosmetic filters.
|
||||
return /display\s*:\s*none\s*!important;?$/.test(style)
|
||||
? selector
|
||||
: selector + ':style(' + style + ')';
|
||||
};
|
||||
|
||||
const hostnamesFromPrefix = function(s) {
|
||||
|
|
Loading…
Reference in New Issue