-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support blocking rules for a defined list of domains #330
Comments
/medium\.(com|freecodecamp\.org)/,hackernoon.com##.js-stickyFooter, .u-tintSpectrum, .js-metabar, .u-clearfix.metabar, .butterBar-message, .is-other.markup--p-quote.markup--quote, .js-postActionsBar, .postActionsBar, .overlay--lighter.overlay, .js-metabarMiddle, .js-postActionsBarContent, .metabar-block superuser.com,serverfault.com,stackoverflow.com,askubuntu.com,mathoverflow.net,stackexchange.com###hero-content, #herobox, #newsletter-ad, #herobox-mini, #js-gdpr-consent-banner, #noscript-warning, .js-dismissable-hero, .s-hero--container, .hero-container.s-hero, #clc-tlb, #announcement-banner, #dfp-tlb, .community-bulletin.module, #left-sidebar, #overlay-header, .unread-feature-notice.-feature-notice
superuser.com,serverfault.com,stackoverflow.com,askubuntu.com,mathoverflow.net,stackexchange.com##header.top-bar:style(position:absolute !important ; margin-top:0px) ➖ exceptions disable all, |
Thanks for the reply. Could you please elaborate on the first two points? EDIT I think I understand. These are comma-separated selectors, as defined by CSS, yes? |
if combine all simple cosmetic filters you must use all in exception filter. for example
exception:
only this exception will turn it off and then you have to manually check what has become obsolete or compare with the html code from web development tools (with example
Probably it was modeled on it, as it was added to Adblock Plus and then others started to support it. |
So the purpose of the exception is only to check which selectors have become obsolete? |
Sorry for opening a feature request for this. I didn't realise uBlock could already do this. It didn't occur to me to read the CSS selectors documentation to achieve what I want (I did read the uBlock Wiki and the AdBlock Plus Filters page). |
In total, there is no such functionality, it is only similar and more difficult to use.
example: class and then be wise here with these ~12 classes of css in the filter is guilty without preview in the developer's tools (uBO logger tree for this rather average, IMO).
rather, it could be programmed to work almost as if it were handwritten in domain filters to exceptions |
Ah, interesting. Thanks for the workaround! |
Not likely to be implemented, similar thing has been asked for dynamic filtering and was rejected (cannot find issue now) and also this introduces more incompatibility to ABP filter syntax. Why not use local server or github/gist and pre-parse list in bash (or any other tool)? |
Hmmm... it may be difficult to get a step by step guide or some old one. I would not cry for the bot, e.g. @travis-ci. |
@gwarser good suggestion for a workaround, but I maintain my own personal filter list which I use on all my devices. Several of these devices are portable (they don't share the same local network), so this server would have to be on the public internet to be accessible by them all, and I don't want the hassle of administering & maintaining a public server. Edit if you meant I could pre-process them locally, that is technically an option. But I'd have to update each device manually (running the pre-processor myself, then updating the filter list in the uBlock dashboard), or find a way for uBlock to trigger the local preprocessor to run before updating that filter-list. |
I meant, have two versions of your list, current one and |
or modular build list - maybe... |
Actually this is an idea I entertained in the past, having variables to be used to replace long instances of strings which repeats often. I didn't pursue though as it's not clear how this could be implemented. The
This is a very different case than dynamic filtering. uBO does modify/add/delete the output of dynamic filtering rules, so this complicates quite a lot such feature. On the other hand, the output of a filter lists is never modified by uBO (hence "static") -- except for user filters, but even then a feature like the one here would not interfere with uBO merely adding filters in the list (the only programmatic modification allowed). |
My original goal was to define a 'single source of truth' for the sites that many cosmetic filter rules applied to. I consider this to be largely solved by @krystian3w 's suggestion of comma-separated selectors on the same line -- although as they pointed out, it only works if the action for all the selectors is the same. With regards to implementation, I would naively suggest using a map/dictionary //example line:
//#!define arbitrary_key_nospaces literally anything
var dictionary;//string:string
for (line in filter_list_file){
if (line.startsWith('#!define ')){
name = line.split(' ')[1];//=arbitrary_key_nospaces
value = line.substring(indexOf(name)+name.length, line.length);//='literally anything'
dictionary.put(name, value);
}
else {
for((name, value) in dictionary) {
if(line.contains(name)) {
line.replace(name, value);
}
}
}
} Obviously this probably has poor performance. |
Ugh.. When I said "the placeholders to receive the replacement is something that must be thought through" I didn't mean I had no clue how to write code. I meant that the placeholder syntax must not interfere with all the current and future parsing code. Also the consequences of such features must be taken into account: it could be introduced with allowing only very specific places to be used validly (like say to replace only lists of domains for cosmetic filters), but it would be just a matter of time before issues are opened with people complaining that their placeholders are not filled in by uBO when used e;sewhere. Overall, I lean on declining this, but I will keep the issue opened and see if ever in the future the pressure from filter list maintainers to implement such feature increases. |
Apologies, I didn't mean to imply that. I'm aware that many people often turn up to prominent projects like this, and ask/demand that a feature be implemented, with no intention of helping implement that feature. I just didn't want to be another one of those people. I am also aware (if probably only dimly, due to lack of familiarity with the language & codebase) that there would be rather a lot of issues with implementing this. Thanks for your feedback. |
I would design it like this: The identifier of the defined domains set must start with
When a domain name is expected (prefix of cosmetic filter and
Are the same as:
In terms of code, I would carry a global state storage for the compiler and update the state in:
The compiler is synchronous, and will probably always be synchronous, so a global state storage should be fine. Or you can pass the state storage as parameter, but that's way more places to change. |
What about revising the domain component to support shell-style brace expansion? E.g., this:
is expanded into
possibly with support for line-continuation:
Since I know it won't solve the broader issue of being unable to assign an identifier to a reusable domain list. However, it's at least a step in the right direction, and certainly better than having to write
|
@Alhadis ? |
uBlock Origin doesn't seem to support multiple hostnames in its extended filter syntax, which makes this ugly-looking copy+pasta necessary. References: uBlockOrigin/uBlock-issues#330
@llacb47 Brace expansion Is more flexible and compact, not to mention it's immediately familiar to shell users (especially since the $ printf '%s\n' {askubuntu,mathoverflow,serverfault,stack{apps,exchange,overflow},superuser}.{com,net}
askubuntu.com
askubuntu.net
mathoverflow.com
mathoverflow.net
serverfault.com
serverfault.net
stackapps.com
stackapps.net
stackexchange.com
stackexchange.net
stackoverflow.com
stackoverflow.net
superuser.com
superuser.net |
Declined. If ever other top blockers come up with a solution for this, I will consider adopting it. |
Can This Be Considered Now To Be Used For Special Cases Only ? |
Prerequisites
Description
Certain companies use a large, growable list of domains -- namely Stack Overflow, Medium.
The same static blocking filter rules apply to all sites by those companies.
But at the moment, every filter rule needs to specify all the domains in the list.
It would be helpful if instead I could (eg)
!#define
a list of domains that a static block rule applies to.Steps to Reproduce
Current behavior:
An example -- the situation now:
Desired behavior:
The desired situation (the used syntax is only a suggestion for illustrative purposes):
Your environment
The text was updated successfully, but these errors were encountered: