diff --git a/.gitmodules b/.gitmodules index 50fa7765a0..22c2cc38cf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -194,6 +194,9 @@ [submodule "vendor/grammars/Vala-TMBundle"] path = vendor/grammars/Vala-TMBundle url = https://github.com/technosophos/Vala-TMBundle +[submodule "vendor/grammars/VscodeAdblockSyntax"] + path = vendor/grammars/VscodeAdblockSyntax + url = https://github.com/ameshkov/VscodeAdblockSyntax.git [submodule "vendor/grammars/WhileySyntaxBundle"] path = vendor/grammars/WhileySyntaxBundle url = https://github.com/Whiley/WhileySyntaxBundle.git diff --git a/grammars.yml b/grammars.yml index 79790ef5d3..c35ff30e6c 100644 --- a/grammars.yml +++ b/grammars.yml @@ -167,6 +167,8 @@ vendor/grammars/VBDotNetSyntax: - source.vbnet vendor/grammars/Vala-TMBundle: - source.vala +vendor/grammars/VscodeAdblockSyntax: +- text.adblock vendor/grammars/WhileySyntaxBundle: - source.whiley vendor/grammars/X10: diff --git a/lib/linguist/heuristics.yml b/lib/linguist/heuristics.yml index d83243dbcd..c30a681aae 100644 --- a/lib/linguist/heuristics.yml +++ b/lib/linguist/heuristics.yml @@ -650,6 +650,27 @@ disambiguations: # VIM_MODELINE pattern in `./lib/linguist/strategy/modeline.rb`. - language: Vim Help File pattern: '(?:(?:^|[ \t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \t]ex)(?=:(?=[ \t]*set?[ \t][^\r\n:]+:)|:(?![ \t]*set?[ \t]))(?:(?:[ \t]*:[ \t]*|[ \t])\w*(?:[ \t]*=(?:[^\\\s]|\\.)*)?)*[ \t:](?:filetype|ft|syntax)[ \t]*=(help)(?=$|\s|:)' + - language: Adblock Filter List + pattern: |- + (?x)\A + \[ + (?<version> + (?: + [Aa]d[Bb]lock + (?:[ \t][Pp]lus)? + | + u[Bb]lock + (?:[ \t][Oo]rigin)? + | + [Aa]d[Gg]uard + ) + (?:[ \t] \d+(?:\.\d+)*+)? + ) + (?: + [ \t]?;[ \t]? + \g<version> + )*+ + \] # HACK: This is a contrived use of heuristics needed to address # an unusual edge-case. See https://git.io/JULye for discussion. - language: Text diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index e3a1c3521e..3c65ac431a 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -227,6 +227,19 @@ Ada: tm_scope: source.ada ace_mode: ada language_id: 11 +Adblock Filter List: + type: data + color: "#800000" + ace_mode: text + extensions: + - ".txt" + aliases: + - ad block filters + - ad block + - adb + - adblock + tm_scope: text.adblock + language_id: 884614762 Adobe Font Metrics: type: data color: "#fa0f00" diff --git a/samples/Adblock Filter List/Imperial Units Remover.txt b/samples/Adblock Filter List/Imperial Units Remover.txt new file mode 100644 index 0000000000..afd0c53e30 --- /dev/null +++ b/samples/Adblock Filter List/Imperial Units Remover.txt @@ -0,0 +1,20 @@ +[Adblock Plus 3.13] +! Title: 📏 Imperial Units Remover +! Version: 23May2022v1-Alpha +! Expires: 10 days +! Description: Are you pro-metric and are tired of seeing imperial unites all over the English-language parts of the internet? If so, then here's a list for you. +! Homepage: https://github.com/DandelionSprout/adfilt/blob/master/Wiki/General-info.md#english + +! Removing miles from dual-unit distance measurements in Google Maps (uBO and AdGuard only) +google.*##html[lang$=US] #ruler span:first-of-type +google.*##html[lang=en] #ruler span:first-of-type +google.*##html:not([lang$=US], [lang=en]) #ruler span:nth-of-type(2) + +! Removes imperial measurements from multi-unit displays +weather.gov###myfcst-tempf +weather.gov#?#p[class^=myforecast-current-]:has-text(°F) +holiday-weather.com#?#.temperature_data_container > :has-text(°F) +holiday-weather.com#?#.distance_data_container > :has-text(miles) +lematin.ma##.meteo-bloc span +sveip.no##.wmsb_f +gismeteo.de##.ifnoie diff --git a/samples/Adblock Filter List/abp-filters-anti-cv.txt b/samples/Adblock Filter List/abp-filters-anti-cv.txt new file mode 100644 index 0000000000..bc49875e24 --- /dev/null +++ b/samples/Adblock Filter List/abp-filters-anti-cv.txt @@ -0,0 +1,82 @@ +[Adblock Plus 3.1] +! Checksum: i7lcTV9/kkiE8g3aav4y/g +! Version: 202208071141 +! Title: ABP filters +! Last modified: 07 Aug 2022 11:41 UTC +! Expires: 1 hours (update frequency) +! Homepage: https://github.com/abp-filters/abp-filters-anti-cv +! +! Filter list designed to fight circumvention ads (including, in some cases, their tracking) and fix critical issues for Adblock Plus users +! +! Please report any issues +! on GitHub https://github.com/abp-filters/abp-filters-anti-cv/issues +! or via filters+cv@adblockplus.org +! +! *** abp-filters-anti-cv:arabic.txt *** +! MISC +3sk.io,3sk.co,33sk.tv,esheeq.co#$#abort-on-property-read atob; abort-on-property-write Fingerprint2; abort-on-property-read decodeURIComponent; abort-on-property-read RegExp +3oloum.com,7olm.org,ahladalil.com,syriaforums.net,ahlamontada.com,alamontada.com,arabepro.com,banouta.net,gid3an.com,jordanforum.net,yoo7.com,forumalgerie.net,own0.com##a[onclick^="this.href=atob"] +3oloum.com,7olm.org,ahladalil.com,syriaforums.net,ahlamontada.com,alamontada.com,arabepro.com,banouta.net,gid3an.com,jordanforum.net,yoo7.com,forumalgerie.net,own0.com#$#abort-on-property-read atob +! #CV-685 +arabseed.co,arabseed.com,arabseed.me,arabseed.net,arabseed.tv#$#abort-on-property-read atob; abort-on-property-read decodeURI; abort-on-property-read decodeURIComponent +hawak.net,hawak.tv,rotana.video#$#abort-on-property-read atob +! #CV-667 +beinconnect.us,coroot.blogspot.com,ktarab.com,shofnow.com,actionz.tv,brstej.com,jaewinter.co,movs4u.live,mvs4u.tv,kora-online.tv,filmey.tv,animetak.net,arabseed.tv,arabseed.co,arabseed.com,arabseed.me,arabseed.net,shahid4u.com,shahid4u.net#$#abort-current-inline-script Math zfgloaded +! Popup/Popunder/Clickunder +egyanime.com,egydead.com,egydead.live#$#abort-on-property-write _pop +actionz.tv,cimaclub.com,cimaclub.in,elmstba.com,hawak.net,hawak.tv,lodynet.co,lodynet.dev,lodynet.ink,lodynet.tv,rotana.video#$#abort-on-property-read decodeURIComponent +egy.best,egybest.asia,egybest.bid,egybest.biz,egybest.cheap,egybest.co,egybest.com,egybest.cool,egybest.fail,egybest.life,egybest.ltd,egybest.ist,egybest.name,egybest.net,egybest.network,egybest.ninja,egybest.nl,egybest.online,egybest.org,egybest.pw,egybest.rocks,egybest.site,egybest.xyz,egybest.zone,egybest2.com,iegy.best#$#abort-on-property-read open +akhbara24.news,anime4up.art,anime4up.com,arabseed.me,asia2tv.cn,asia2tv.com,baramjak.com,cima-club.cc,cima-club.in,cima-club.io,cima-club.lol,cima-club.vip,cima4u.cloud,cima4u.film,cima4u.ink,cima4u.tv,cima4u.ws,cimalina.me,cimalina.net,egy-live.online,egynow.cam,egynow.live,hawak.net,iegybest.co,lodynet.co,lodynet.dev,lodynet.ink,lodynet.tv,manga.ae,moshahda.net,movizland.com,movizland.cyou,movizland.online,egyanime.com,egydead.com,egydead.live,shahed4u.cafe,shahed4u.casa,shahed4u.cloud,shahed4u.mba,shahed4u.red,shahed4u.tips,shahed4u.ws,tuktukcinema.co,tuktukcinema.net,witanime.com,yalla-shoot.today#$#abort-current-inline-script Math /atob|break/; abort-current-inline-script String.fromCharCode /atob|break/; abort-current-inline-script document.documentElement /atob|break|JSON.parse/; abort-on-property-write JSON.parse +arabxd.com#$#abort-current-inline-script document.querySelectorAll popMagic +! #CV-754 +akwam.cc,akoam.com,akoam.net,akwam.co,akwam.cx,akwam.net,akwam.org,gateanime.com,gocoo.co#$#abort-on-property-read String.fromCharCode +! *** abp-filters-anti-cv:bulgarian.txt *** +! #CV-667 +gledaiseriali.net#$#abort-current-inline-script Math zfgloaded +! *** abp-filters-anti-cv:chinese.txt *** +! #CV-767 +ipv6.baidu.com,xueshu.baidu.com,www.baidu.com,www1.baidu.com#$#hide-if-contains 广告 .c-container '.f13 > .m'; hide-if-contains 广告 #content_right>[class] span[data-tuiguang] +1111.baidu.com,bdimg.com,tieba.baidu.com,tieba.com,xingqu.baidu.com#$#abort-on-property-read Object.prototype.loadImage +baidu.com#$#hide-if-contains 广告 #content_right>div .ec-tuiguang +baidu.com#$#hide-if-contains 广告 #content_left>div .ec-tuiguang +! MISC +torrentkitty.tv#$#abort-on-property-read _fupfgk;abort-on-property-read _nyjdy +178.com,nga.cn#$#abort-on-property-write __LOAD_BBS_ADS_12 +cn.bing.com#$#hide-if-contains 360 #b_results>li .b_adProvider +2345.com#$#abort-current-inline-script setDefaultTheme +ahri8.top#$#abort-current-inline-script document.querySelectorAll popMagic +ifenpaidy.com#$#abort-on-property-read localStorage +! Popups & Popunders +cocomanga.com#$#abort-on-property-read __cad.cpm_popunder; abort-on-property-read __ad +madouqu.com,madouqu.tk#$#abort-current-inline-script document.querySelectorAll popMagic +editcode.net#$#abort-current-inline-script setTimeout openAd +theporn.cc#$#abort-on-property-read is_show_alert_window +! Video ads +iyingshi9.tv#$#override-property-read YZM.ads.state false +! #CV-667 +hdzone.org#$#abort-current-inline-script Math zfgloaded +! *** abp-filters-anti-cv:czech.txt *** +! #CV-655 +iprima.cz,www.seznam.cz,novinky.cz,super.cz,ahaonline.cz,expres.cz,kinobox.cz,horoskopy.cz#$#json-override ads '' +kinobox.cz,novinky.cz,expres.cz,fights.cz,tiscali.cz,hudebniskupiny.cz,osobnosti.cz,ahaonline.cz,super.cz#$#prevent-listener beforeunload (); cookie-remover /^_?adb/; +sauto.cz#$#override-property-read sssp undefined +super.cz#$#override-property-read sspPositions null +iprima.cz##.sas_center, .px-ad, .sas_mone, .mone_box, .ifr-passback, [data-sas_status], div[id^="sas_"], div[class^="mas_mone_"], [data-alter_area="leaderboardpremium-1"], [data-alter_area="boardbottom-1"], .ifr-masshack, .px-zone, .sas_megaboard, .ifr-classflak, [data-sas-creative], #cnn_reklama, div[class^="mas_"], ._sasia_fcid, [class^="mas"][class$="_clue"] +iprima.cz#?#div:-abp-has(>.mone_header) +iprima.cz##.px-type-banner +iprima.cz##[class$="_value"], [id^="px-id-"] +iprima.cz##[class$="_fcid"], [data-mashiatus] +iprima.cz##div[data-d-area] +iprima.cz##[class*="sas"] +iprima.cz##a[href*="/area=branding"] +iprima.cz##[id*="-ad-"], .ifr-claassflak, a[href*="/posid=sas_"] +iprima.cz##.dekes_reblika +/area=*/posid=*$subdocument,xmlhttprequest,script,domain=iprima.cz +/keyword*/area=$xmlhttprequest,domain=iprima.cz +/section=adblock_desktop^$domain=iprima.cz +?format=js|$script,domain=iprima.cz +?guci=$subdocument,domain=iprima.cz +?v127|$script,domain=iprima.cz +/area=halfpagead$xmlhttprequest,domain=iprima.cz +/area=branding$xmlhttprequest,domain=iprima.cz +auto.cz,autorevue.cz,maminka.cz,reflex.cz,ahaonline.cz,blesk.cz,dama.cz,e15.cz,info.cz,mojezdravi.cz,onetv.cz,zeny.cz,zive.cz##.inserted_rtb diff --git a/samples/Adblock Filter List/anti-facebook.txt b/samples/Adblock Filter List/anti-facebook.txt new file mode 100644 index 0000000000..deed7aa625 --- /dev/null +++ b/samples/Adblock Filter List/anti-facebook.txt @@ -0,0 +1,99 @@ +[Adblock Plus 2.0] +! Checksum: Ea7JI8rmiGKaIOR604if2A +! Title: Anti-Facebook List +! Updated: 2021-09-19 08:57 UTC +! Expires: 9 days +! License: http://creativecommons.org/licenses/by/3.0/ +! Homepage: http://www.fanboy.co.nz/ +! Reporting Issues: https://github.com/ryanbr/fanboy-adblock/issues +! +! Legal stuff (T&C's) . +! In no event shall Fanboy List, or the list author be liable for any indirect, direct, punitive, special, incidental, or consequential damages whatsoever. +! By downloading or viewing, or using this list, you are accepting these terms and the license. +! +! +! Warning, will break on facebook-based comment sites and may also break on some facebook apps or games. +! +! Thirdparty Filters +! +||api-read.facebook.com/restserver.php?api_key=$third-party +||api.facebook.com^$third-party +||badge.facebook.com^$third-party +||connect.facebook.com^$third-party,domain=~facebook.net|~fb.com +||connect.facebook.net^$third-party,domain=~facebook.com|~fb.com +||facebook.com/connect/$third-party +||facebook.com/dialog/oauth?display=popup$popup,domain=humorhub.org +||facebook.com/plugins/activity.php?$third-party +||facebook.com/plugins/comments.php?$third-party +||facebook.com/plugins/facepile.php?$third-party +||facebook.com/plugins/fan.php?$third-party +||facebook.com/plugins/follow.php$third-party +||facebook.com/plugins/like.php?$third-party +||facebook.com/plugins/like_box.php$third-party +||facebook.com/plugins/likebox.php?$third-party +||facebook.com/plugins/post.php?$third-party +||facebook.com/plugins/recommendations.php?$third-party +||facebook.com/plugins/recommendations_bar.php?$third-party +||facebook.com/plugins/send.php?$third-party +||facebook.com/plugins/share_button.php?$third-party +||facebook.com/plugins/subscribe.php$third-party +||facebook.com/plugins/subscribe?$third-party +||facebook.com/restserver.php?*.getStats&$third-party +||facebook.com/whitepages/wpminiprofile.php$third-party +||facebook.com/widgets/activity.php?$third-party +||facebook.com/widgets/fan.php?$third-party +||facebook.com/widgets/like.php?$third-party +||facebook.com/widgets/recommendations.php?$third-party +||fbcdn-profile-a.akamaihd.net^$third-party,domain=~facebook.com +||google.com/js/client:plusone.js$third-party +||google.com/js/plusone.js$third-party +||graph.facebook.com/?id=$third-party +||graph.facebook.com^$third-party,xmlhttprequest +||profile.ak.fbcdn.net^$third-party,domain=~facebook.com +||scontent-a.*.fbcdn.net^$third-party,domain=~facebook.com +||spot.im/embed/scripts/launcher.js$third-party +||static.ak.fbcdn.net^$third-party,domain=~facebook.com +! +! Test Filters (For Gannett sites, which don't work anyways with Facebook blocked) +! +##.util-bar-module-firefly-visible +! +! Whitelist Filters +! +@@/cdn-cgi/pe/bag2?*connect.facebook.net$domain=forwardprogressives.com|onhax.net|opensubtitles.org|viralthread.com|youngcons.com +@@||akamaihd.net/rsrc.php/$domain=facebook.com +@@||channel.facebook.com^$domain=facebook.com +@@||connect.facebook.com^*/AudienceNetworkPrebid.js$domain=vice.com +@@||facebook.com/ajax/browse/$domain=facebook.com +@@||facebook.com/ajax/bz$domain=facebook.com +@@||facebook.com/ajax/chat/buddy_list.php$domain=facebook.com +@@||facebook.com/ajax/chat/hovercard/$domain=facebook.com +@@||facebook.com/ajax/hovercard/$domain=facebook.com +@@||facebook.com/ajax/litestand/$domain=facebook.com +@@||facebook.com/ajax/notifications/$domain=facebook.com +@@||facebook.com/ajax/pagelet/$domain=facebook.com +@@||facebook.com/ajax/photos/$domain=facebook.com +@@||facebook.com/ajax/presence/$domain=facebook.com +@@||facebook.com/ajax/typeahead/$domain=facebook.com +@@||facebook.com/ajax/webstorage/$domain=facebook.com +@@||facebook.com/chat/$domain=facebook.com +@@||facebook.com/images/$domain=facebook.com +@@||fbcdn-photos-*.akamaihd.net^$domain=facebook.com +@@||fbcdn-profile-*.akamaihd.net^$domain=facebook.com +@@||fbcdn-sphotos-*.akamaihd.net^$domain=facebook.com +@@||fbexternal-*.akamaihd.net^$domain=facebook.com +@@||scontent-*.fbcdn.net^$domain=facebook.com +! +! Problematic sites +! +@@||cloudfront.net^$font,domain=magicseaweed.com +@@||connect.facebook.com^*/audiencenetworkprebid.js$script,domain=screenrant.com +@@||connect.facebook.net^$script,domain=id.logi.com|tinder.com|abc.go.com|adultswim.com|contv.com|damnyouautocorrect.com|embedly.com|fitbit.com|instagram.com|interviewmagazine.com|noovo.ca|pogo.com|reddit.com|salon.com|sci2.tv|southpark.cc.com|southpark.de|upi.com +@@||google.com/js/plusone.js$domain=abcnews.go.com|watch.nba.com +@@||graph.facebook.com^$xmlhttprequest,domain=theguardian.com +@@||staticxx.facebook.com/connect/$domain=embedly.com +! +! Cloudflare CDN +! +/cdn-cgi/pe/bag2?*connect.facebook.com +/cdn-cgi/pe/bag2?*connect.facebook.net diff --git a/samples/Adblock Filter List/fake-news.txt b/samples/Adblock Filter List/fake-news.txt new file mode 100644 index 0000000000..5e91d74e63 --- /dev/null +++ b/samples/Adblock Filter List/fake-news.txt @@ -0,0 +1,45 @@ +[Adblock Plus 2.0] +! Title: Fake-News List +! Updated: 10 Mar 2018 +! License: http://creativecommons.org/licenses/by/3.0/ +! Homepage: http://www.fanboy.co.nz/ +! Reporting Issues: https://github.com/ryanbr/fanboy-adblock/issues +! +! Legal stuff (T&C's) . +! In no event shall Fanboy List, or the list author be liable for any indirect, direct, punitive, special, incidental, or consequential damages whatsoever. +! By downloading or viewing, or using this list, you are accepting these terms and the license. +! +! (Truncated from original list, which is ~30 KBs) + +! infowarsstore.com +##a[href^="http://infowarsstore.com"] +##a[href^="http://www.infowarsstore.com"] +##a[href^="https://www.infowarsstore.com"] +infowarsstore.com#@#a[href^="http://infowarsstore.com"] +infowarsstore.com#@#a[href^="http://www.infowarsstore.com"] +infowarsstore.com#@#a[href^="https://www.infowarsstore.com"] +||infowarsstore.com^$popup,third-party + +! infowars.com +##a[href^="http://infowars.com"] +##a[href^="http://www.infowars.com"] +infowars.com#@#a[href^="http://www.infowars.com"] +||infowars.com^$popup,third-party + +! abcnews.com.co +##a[href^="http://abcnews.com.co"] +##a[href^="http://www.abcnews.com.co"] +abcnews.com.co#@#a[href^="http://abcnews.com.co"] +abcnews.com.co#@#a[href^="http://www.abcnews.com.co"] +||abcnews.com.co^$popup,third-party + +! 82.221.129.208 +##a[href^="http://82.221.129.208"] +82.221.129.208#@#a[href^="http://82.221.129.208"] + +! angrypatriotmovement.com +##a[href^="http://angrypatriotmovement.com"] +##a[href^="http://www.angrypatriotmovement.com"] +angrypatriotmovement.com#@#a[href^="http://angrypatriotmovement.com"] +angrypatriotmovement.com#@#a[href^="http://www.angrypatriotmovement.com"] +||angrypatriotmovement.com^$popup,third-party diff --git a/samples/Adblock Filter List/test_rules.txt b/samples/Adblock Filter List/test_rules.txt new file mode 100644 index 0000000000..b65a9e7550 --- /dev/null +++ b/samples/Adblock Filter List/test_rules.txt @@ -0,0 +1,314 @@ +[AdGuard] +! Title: Test rules for the syntax highlighter +! License: MIT (see https://github.com/ameshkov/VscodeAdblockSyntax/blob/master/LICENSE.md) +! Homepage: https://github.com/ameshkov/VscodeAdblockSyntax/blob/master/test_rules.txt +! Author: Andrey Meshkov (Adguard Software Ltd.) +! + +# Some comments (should be all green) +! +# + +! +! Pre-processor directives and hints +! +!#if (adguard && !adguard_ext_safari) +!#include https://example.org/ +!#endif +!+ NOT_OPTIMIZED PLATFORM(android) +||example.org^ +!#invalidpreprocessor +!#if (invalid_platform) +!#safari_cb_affinity(general,privacy) +!#safari_cb_affinity +!#safari_cb_affinity(invalid) + +! +! Basic rules (valid) +! +example.org +@@||example.org^ +||example.org^ +|https://www.example.org/| +/banner +||example.org^$third-party +||example.org^$~object-subrequest + +! Domain +||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.* +*$3p,script,denyallow=hello.com|service.me,domain=example.*|test.org + +! Domain invalid: https://github.com/ameshkov/VscodeAdblockSyntax/issues/26 +||parajumpersnettbutikk.com^$document,domain=~ Advarselen vises grunnet: En grovt falsk nettbutikksvindel som er svartelistet av Forbrukertilsynet. + +! No URL +$websocket,domain=example.org + +! App +||testwinapp.org^$app=Skype.exe +||testapp.org^$app=com.adguard.android|~com.example +||testws.org^$websocket,xmlhttprequest +||testws.org^$~websocket,~xmlhttprequest + +! ------------------------- +! Modifiers +! ------------------------- + +! Csp +||example.org^$csp=frame-src 'none' +@@||example.org^$csp + +! Badfilter +@@||example.org^$badfilter + +! Redirect +||example.org^$redirect=google-analytics.com/ga.js +||example.org/$script,redirect-rule=noop.txt + +! Rewrite +||example.org^$rewrite=abp-resource:blank-html + +! Helper modifiers: #23 +||example.org^$first-party +||example.org^$xhr +||example.org^$inline-script +||example.org^$inline-font +||example.org^$popunder + +! extension modifier: #31 +@@||taxes.hrblock.com^$extension + +! more modifiers aliases: #34 +||example.org^$all +||example.org^$3p +||example.org^$1p +||example.org^$css +||example.org^$frame +||example.org^$ghide +||example.org^$ehide +||example.org^$shide +||example.org^$specifichide + +! +! Basic rules (invalid) +! +||example.org$domain=~example.org,~test.org +||example.org$domain=~example.org.~test.org +||testwinapp.org^$app=Skype.exe,~test.com +||testwinapp.org^$app=Skype.exe.~com.adguard + +! +! Basic rules (regex) +! +/banner/ +@@/banner\d+/$third-party + +! +! Basic rules ($replace) +! +||example.org^$replace=/(<VAST[\s\S]*?>)[\s\S]*<\/VAST>\/\$1<\/VAST>/gi,third-party +||example.org^$important,replace=/(<VAST[\s\S]*?>)[\s\S]*<\/VAST>\/\$1<\/VAST>/gi,third-party +||example.net^$replace=/[\s\S]+//,important,domain=example.org|example.com +@@||example.org^$replace + +! +! Elemhide rules (valid) +! +##.valid_selector +j.gs,46.166.167.16,example.org##banner +example.org##valid_selector +~example.org##valid_selector +example.org,~hello.com##valid_selector +example.org#@#valid_selector +example.org#@#valid_selector +example.org,example.com##valid_selector +example.org,example.com,test.com##valid_selector +business-service.me#@##banner_ad +q.gs#@##bottom +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 +4pda.ru##body > * > * > div > * > :not(div) > :not(div) > :not(div) > div:has(> h2:contains(/[APprmoАрРо]{8}/)) +! TLD +google.*###center_col > #main > .dfrd > .mnr-c > .c._oc._zs +google.*###center_col > #res > #topstuff + #search > div > #ires > #rso > #flun + +! +! Elemhide rules (invalid) +! +! TODO: Make it invalid +##invalid_selector { invalid part of it } +example.org,example.com|test.com##valid_selector +example.org,123,test.com##valid_selector +пример.рф##banner +|example.org##banner + +! +! ExtCss rules (valid) +! +example.org#?#banner +example.org,example.com#@?#banner +example.org#$?#banner { display: none!important; } +example.org#@$?#banner { display: none!important; } + +! +! ExtCss rules (invalid) +! +example.org#?#banner { invalid part of it } +example.org,example.com|test.com#@?#banner +|example.org#?#banner + +! +! CSS rules (valid) +! +#$#valid_style { position: absolute!important; } +example.org#$#some_style { visibitility: hidden; } +example.org,example.com,test.com#@$#valid_selector { visibitility: hidden; } +aternos.org#$##detect { height: 1px!important; } + +! +! CSS rules (invalid) +! +#$#invalid_style +dayt.se#$##synpit { height:1px!important; } +example.org,example.com,test.com#$@#wrong_syntax { visibitility: hidden; } +|example.org#$#banner { } + +! +! Content-filtering rules (valid) +! +$$script[id="hello"] +example.org$$script[id="hello"][tag-content="hello"][max-length="hi"] +example.org,example.com$@$script[id="hello"][tag-content="something"] +example.org$$script + +! +! Content-filtering rules (invalid) +! +exam$$script[id="hello"] +$$tag-name[id=value] +$$tag-name[id=value +$$div[id="value"]["val"="val"] + +! +! JS rules rules (valid) +! +#%#window.adblock = 1; +example.org#@%#window.adblock = 1; +example.org,hello.com#%#window.adblock = 1; +nj.com#%#window.hello = 1; +southwalesargus.co.uk#%#window.hello = 1; + +! +! Scriptlets (AdGuard) +! +example.org#%#//scriptlet('name') +example.org#%#//scriptlet('name', '') +example.org#%#//scriptlet('name', "") +example.org#%#//scriptlet('name', 'param') +example.org#%#//scriptlet("abort-on-property-read", "alert") +example.com#%#//scriptlet('abort-current-inline-script', 'document.addEventListener', '/example|test/') +example.com#%#//scriptlet("remove-class", 'branding', "div[class^=\"inner\"]") + +! +! Scriptlets (uBO) +! +example.org##+js(goyavelab-defuser.js) +ze.tt##+js(addEventListener-defuser.js, /^(?:DOMContentLoaded|load)$/, =!0) +lablue.*##+js(setTimeout-defuser.js, r(), 500) + +! +! ABP snippets +! +reuters.com#$#abort-current-inline-script String.fromCharCode 69bfbfdbe821fab7200e9613cab94c8b +yandex.com#$#hide-if-contains ad li.serp-item 'li.serp-item div.label' +zhlednito.cz#$#abort-on-property-read Aloader; abort-on-property-read ExoLoader; abort-on-property-read ExoLoader.serve +facebook.com#$#hide-if-has-and-matches-style 'abbr .timestampContent' 'div[id^="hyperfeed_story_id_"]' 'div[id*="feed_subtitle_"] > span, div[id*="feed_subtitle_"] > s' '' 'display: none'; hide-if-contains /.*/ .ego_section 'a[href^="/ad__campaign/landing.php?"]'; hide-if-contains /.*/ .ego_section 'a[href^="/ad_campaign/landing.php?"]'; hide-if-contains /.*/ .ego_section 'a[href^="/ad___campaign/landing.php?"]' + +! +! HTML filtering (uBO) +! +express.de,giga.de,kicker.de##^script:has-text((window);) +wetteronline.de##^script:has-text(runCount) +finanzen.*##^script:has-text(Inject=!) + +! +! $cookie rules +! +$cookie=__cfduid +$cookie=test,domain=example.org +||example.org^$cookie +||facebook.com^$third-party,cookie=c_user +@@||example.org^$cookie=/regular_expression/ +||example.org^$cookie=NAME;maxAge=3600;sameSite=lax +@@||example.org^$cookie + +! +! $removeparam and $queryprune rules +! +||example.org^$removeparam +||example.org^$removeparam=test +||example.org^$removeparam=~test +||example.org^$removeparam=/^(test|test2)=/i +||example.org^$queryprune +||example.org^$queryprune=test +||example.org^$queryprune=~test +||example.org^$queryprune=/^(test|test2)=/i + +! +! $removeheader rules +! +||destyy.com^$removeheader=request:user-agent +||utarget.ru/ranging/*/click/$removeheader=location +$removeheader=location,domain=zannn.top|innal.top +/games-pc.top\/forum\/(?!login.php)/$removeheader=location + +! +! $stealth rules +! +@@||example.org^$stealth +@@||example.org^$stealth,domain=example.org + +! +! DNS filtering modifiers +! +! $client +@@||*^$client=127.0.0.1 +||example.org^$client=192.168.0.0/24 +||example.org^$client=~'Mary\'s\, John\'s\, and Boris\'s laptops',denyallow=example.org +||example.org^$client=~Mom|~Dad|Kids +! $ctag +||example.org^$ctag=device_pc|device_phone +||example.org^$ctag=~device_phone +! $dnstype +||example.org^$dnstype=AAAA +||example.org^$dnstype=~A|~CNAME +! $dnsrewrite +||example.com^$dnsrewrite=example.net +||example.com^$dnsrewrite=NOERROR;CNAME;example.net +||example.com^$dnsrewrite=NOERROR;A;1.2.3.4 +||example.com^$dnsrewrite=NOERROR;SVCB;32 example.com alpn=h3 +||example.com^$dnsrewrite=NXDOMAIN;; + +! +! Cosmetic rules modifiers +! +[$path=/test]##banner +[$path=/test]#@#banner +[$path=/test]#?#.banner +[$path=/test]#@?#.banner +[$path=/test]#$#banner { style: display: none!important; } +[$path=/test]#@$#banner { style: display: none!important; } +[$path=/test,app=com.google.search]##banner +[$path=/test,domain=example.org]##banner +[$path=/test]$$banner +[$path=/test]example.org#%#//scriptlet('name', '') + +! +! Cosmetic rules modifiers, invalid modifiers +! +[$randommodifier=test]##banner \ No newline at end of file diff --git a/test/test_heuristics.rb b/test/test_heuristics.rb index dd8fe3ec99..8431f7a3c3 100755 --- a/test/test_heuristics.rb +++ b/test/test_heuristics.rb @@ -889,6 +889,7 @@ def test_tsx_by_heuristics def test_txt_by_heuristics assert_heuristics({ + "Adblock Filter List" => all_fixtures("Adblock Filter List", "*.txt"), "Vim Help File" => all_fixtures("Vim Help File", "*.txt"), "Text" => all_fixtures("Text", "*.txt") }) diff --git a/vendor/README.md b/vendor/README.md index fbb4436216..5363539d9b 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -25,6 +25,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting - **ATS:** [steinwaywhw/ats-mode-sublimetext](https://github.com/steinwaywhw/ats-mode-sublimetext) - **ActionScript:** [simongregory/actionscript3-tmbundle](https://github.com/simongregory/actionscript3-tmbundle) - **Ada:** [textmate/ada.tmbundle](https://github.com/textmate/ada.tmbundle) +- **Adblock Filter List:** [ameshkov/VscodeAdblockSyntax](https://github.com/ameshkov/VscodeAdblockSyntax) - **Adobe Font Metrics:** [Alhadis/language-fontforge](https://github.com/Alhadis/language-fontforge) - **Agda:** [agda/agda-github-syntax-highlighting](https://github.com/agda/agda-github-syntax-highlighting) - **Alloy:** [macekond/Alloy.tmbundle](https://github.com/macekond/Alloy.tmbundle) diff --git a/vendor/grammars/VscodeAdblockSyntax b/vendor/grammars/VscodeAdblockSyntax new file mode 160000 index 0000000000..6e56ca195b --- /dev/null +++ b/vendor/grammars/VscodeAdblockSyntax @@ -0,0 +1 @@ +Subproject commit 6e56ca195b594789e5e3f964dbf0bf264f656566 diff --git a/vendor/licenses/git_submodule/VscodeAdblockSyntax.dep.yml b/vendor/licenses/git_submodule/VscodeAdblockSyntax.dep.yml new file mode 100644 index 0000000000..610d185d25 --- /dev/null +++ b/vendor/licenses/git_submodule/VscodeAdblockSyntax.dep.yml @@ -0,0 +1,31 @@ +--- +name: VscodeAdblockSyntax +version: 6e56ca195b594789e5e3f964dbf0bf264f656566 +type: git_submodule +homepage: https://github.com/ameshkov/VscodeAdblockSyntax.git +license: mit +licenses: +- sources: LICENSE.md + text: |- + MIT License + + Copyright (c) 2017 Adguard Software Ltd. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +notices: []