Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

bigulnews.tv and similar domains #1116

Closed
jspenguin2017 opened this issue May 27, 2020 · 10 comments
Closed

bigulnews.tv and similar domains #1116

jspenguin2017 opened this issue May 27, 2020 · 10 comments
Labels
Archived This thread was archived, open new issues for similar problems. Duplicate

Comments

@jspenguin2017
Copy link
Owner

jspenguin2017 commented May 27, 2020

Add a way to make some rules optional, at the cost of possible race conditions. This is suitable for annoyance and maybe experimental rules.

For example, there are a large amount of websites that have the same anti-select and anti-right-click annoyance:
https://publicwww.com/websites/%22wpcp_disable_selection%22+%22wpcp_disable_Right_Click%22/

Related: uBlockOrigin/uAssets#7468

@jspenguin2017 jspenguin2017 changed the title [Feature [Feature] Add a way to make some rules optional May 27, 2020
@jspenguin2017
Copy link
Owner Author

Or maybe it would be better to just allow generic script snippet injection for privileged filters?

@krystian3w
Copy link

krystian3w commented May 28, 2020

*##+js(ra, class|id)

maybe scriptlets need exclude.


For Firefox 57 - 68 ESR / 77 Beta (uBlockOrigin/uBlock-issues#942):

*##^script[id^="wpcp_"][id*="_disable_"]
*##^head style:has-text(.unselectable):has-text(/([\w\W]{303}|[\w\W]{286}|[\w\W]{259})/)

as long no generate blank pages.

@jspenguin2017
Copy link
Owner Author

Oh, right. Script snippet injections can already be generic. I totally forgot that.
I think I just need to add a script snippet that can abort script by ID.

@kulfoon
Copy link

kulfoon commented May 29, 2020

Oh, right. Script snippet injections can already be generic. I totally forgot that.

Just like me and perhaps 100 other people as well, if something is never used it's being forgotten - I didn't found a single *## filter in any uBO / AdGuard list.

Also the WIKI seems to be outdated / confusing, as usual, coz it still says that:

Generic +js filters are ignored: those filters must be specific, i.e. they must apply to specific hostnames, e.g. example.com##+js(nobab)

Perhaps something changed and was mentioned in some old and forgotten comment / commit / release description or somewhere at the bottom of the Pacific Ocean.

+ for #1116 (comment) for finding out that we can use generic js, however, his soultions for Firefox can be fine-tuned:

As for :has-text(/[\w\W]{286,303}/) is kinda weird

  • the starting range is bad, it must be not bigger than 259 so we get ==> :has-text(/[\w\W]{259,303}/)
  • the closing range is redundant so we get ==> :has-text(/[\w\W]{259}/)
  • further it can be converted to a dedicated solution so we get ==> :min-text-length(259)
  • further it can be converted to a single chain regex so we get ==>
    *##^head style:has-text(/\.unselectable[\w\W]{246}/)

As for: *##^script[id^="wpcp_disable_"], script[id^="wpcp_css_disable_"] seems ok, if one is looking for an alternative, can check this one, a shorter and wider (but risky? doesn't seem so but it's better to make sure): *##^script[id^="wpcp_"][id*="_disable_"]

jspenguin2017 added a commit to NanoAdblocker/NanoCore2 that referenced this issue Jun 1, 2020
@jspenguin2017
Copy link
Owner Author

It's not documented in the wiki probably to deter people from using it. It's a really big hammer and things can go wrong if used improperly.

As for the rules, I'll do something different. Looks like this works:

*##+js(nano-abort-inline-scripts-by-id, /^wpcp_(?:(?:css_)?disable_selection|disable_Right_Click)$/)
*##style:has-text(.unselectable):remove()

I do need a whitelist system though, as the second rule has quite a high chance to break things. I'm also considering a specific script snippet for this issue.

@jspenguin2017
Copy link
Owner Author

jspenguin2017 commented Jun 1, 2020

After tweaking the rules, I think this should work and should be rather safe:

*##+js(nano-abort-inline-scripts-by-id, /^wpcp_disable_(?:selection|Right_Click)$/)
*##script#wpcp_css_disable_selection:xpath(preceding-sibling::style[contains(text(), ".unselectable")]):remove()

@jspenguin2017
Copy link
Owner Author

Either way, let's continue the discussion in the NanoFilters repository.

@jspenguin2017
Copy link
Owner Author

Duplicate of: NanoAdblocker/NanoFilters#510

@jspenguin2017 jspenguin2017 changed the title [Feature] Add a way to make some rules optional bigulnews.tv and similar domains Jun 1, 2020
@krystian3w
Copy link

krystian3w commented Jun 1, 2020

is kinda weird

this is not compressed enters version, sometimes is not compressed into one line.

303 if someone use Windows Server (CRLF) and if available in view-source.

@kulfoon
Copy link

kulfoon commented Jun 2, 2020

I'm aware, but in your regex you use ranges wrong way to the actual case (which I realised just now by the way), in your bad regex the closing range is redundant, coz it still will match text that exceeds 303 length, try this to actually make the closing range working as intended and not being redundant: :has-text(/^[\w\W]{259,303}$/) - it will not match text that exceeds 303.

@github-actions github-actions bot added the Archived This thread was archived, open new issues for similar problems. label Aug 21, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Aug 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Archived This thread was archived, open new issues for similar problems. Duplicate
Projects
None yet
Development

No branches or pull requests

3 participants