Skip to content

Commit

Permalink
Added TLD support. Closes #19
Browse files Browse the repository at this point in the history
  • Loading branch information
ameshkov committed Apr 6, 2019
1 parent a688b73 commit 981fcfb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions syntaxes/adblock.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@
"domainListCommaSeparated": {
"patterns": [
{
"match": "((~?)(([a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]?\\.?)+\\.[a-zA-Z0-9-]{2,})(,?))",
"match": "((~?)(([a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]?\\.?)+\\.([a-zA-Z0-9-]{2,}|\\*))(,?))",
"captures": {
"2": {
"name": "keyword.other.adblock"
Expand Down Expand Up @@ -488,7 +488,7 @@
"domainListPipeSeparated": {
"patterns": [
{
"match": "((~?)(([a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]?\\.?)+\\.[a-zA-Z0-9-]{2,})(\\|?))",
"match": "((~?)(([a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]?\\.?)+\\.([a-zA-Z0-9-]{2,}|\\*))(\\|?))",
"captures": {
"2": {
"name": "keyword.other.adblock"
Expand Down
10 changes: 9 additions & 1 deletion test_rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ example.org
||example.org$domain=~example.org|~test.org
*.domain.com$domain=example.org|test.org,third-party,subdocument
||example.org$domain=j.gs
||example.org$domain=google.*

! No URL
$websocket,domain=example.org
Expand Down Expand Up @@ -76,6 +77,9 @@ j.gs#@##bottom
berlin.de##.teaser[-ext-has='>.inner>h3>a.trakkking,>.inner>h3:not(:has(>))']
xn--fgelsng-exae.se##banner
xn--80aneaaefcxzcih6g1e.xn--p1ai##banner
! TLD
google.*###center_col > #main > .dfrd > .mnr-c > .c._oc._zs
google.*###center_col > #res > #topstuff + #search > div > #ires > #rso > #flun

!
! Elemhide rules (invalid)
Expand Down Expand Up @@ -139,4 +143,8 @@ $$div[id="value"]["val"="val"]
example.org#@%#window.adblock = 1;
example.org,hello.com#%#window.adblock = 1;
nj.com#%#window.hello = 1;
southwalesargus.co.uk#%#window.hello = 1;
southwalesargus.co.uk#%#window.hello = 1;

!
! Scriptlets
!

0 comments on commit 981fcfb

Please sign in to comment.