DandelionSprout / adfilt

The place where I, DandelionSprout, store my web filter lists for countless topics, including my Nordic adblock list. As simple as that, really.
Other
1.3k stars 143 forks source link

Facebook sponsored posts #258

Closed peace2000 closed 2 years ago

peace2000 commented 2 years ago

Which things do they block, hide, or unbreak?

Sponsored posts in Facebook. Each language interface has different "tag" for sponsored posts, making it mandatory to hide them via regional lists, instead of the main Easylist.

kuva

(Censored private information)

Which of my lists are you submitting it to?

Nordic filters

Which adblocker(s) and version did you use when writing and testing the entries?

Other(s):

Adblocker version(s): 1.37.3b20

Which filterlists did you use? Failing to tell this will temporarily close the report until it has been told.

Easylist (English) Nordic filters

Filters:

facebook.com#?#div[data-pagelet^=FeedUnit_]:-abp-has(div[role=article] div[style^=border-radius] span[dir=auto] a[aria-label=Sponset]) Bokmål facebook.com#?#div[data-pagelet^=FeedUnit_]:-abp-has(div[role=article] div[style^=border-radius] span[dir=auto] a[aria-label=Sponsa]) Nynorsk facebook.com#?#div[data-pagelet^=FeedUnit_]:-abp-has(div[role=article] div[style^=border-radius] span[dir=auto] a[aria-label=Sponsoreret]) Dansk facebook.com#?#div[data-pagelet^=FeedUnit_]:-abp-has(div[role=article] div[style^=border-radius] span[dir=auto] a[aria-label=Stuðlað]) Føroyskt facebook.com#?#div[data-pagelet^=FeedUnit_]:-abp-has(div[role=article] div[style^=border-radius] span[dir=auto] a[aria-label=Kostað]) Íslenska facebook.com#?#div[data-pagelet^=FeedUnit_]:-abp-has(div[role=article] div[style^=border-radius] span[dir=auto] a[aria-label=Sponsrad]) Svenska

I use this one in the Finnish list for Finnish sponsored posts:

facebook.com#?#div[data-pagelet^=FeedUnit_]:-abp-has(div[role=article] div[style^=border-radius] span[dir=auto] a[aria-label=Sponsoroitu])

DandelionSprout commented 2 years ago

I think this should be re-delegated to uAssets, who in addition to being able to find a properly language-neutral fix somehow, probably have Facebook accounts, which I don't.

Moreover, Facebook is kind-of a global website.

peace2000 commented 2 years ago

I'm afraid there isn't a language neutral version that works properly (or at least with good performance).

This would be a language neutral version:

facebook.com#?#div[data-pagelet^=FeedUnit_]:-abp-has(div[role=article] div[style^=border-radius] span[dir=auto] a[href^="/ads/about/"])

But it doesn't work well, it will just hide posts that are visible on-screen, others won't be hid even though that rule would match them. That's because there are attribute changes in that value (which confuses uBO). I recently faced the same phenomenon https://github.com/uBlockOrigin/uBlock-issues/issues/1686 and though that it's just a bug... :D

My rule suggestion uses only one procedural, but the language neutral rule would need to be combined with another, experimental procedural: https://github.com/gorhill/uBlock/wiki/Procedural-cosmetic-filters#subjectwatch-attrarg

I btw once asked if a Finnish list entry for Facebook ads would be added to the Easylist https://github.com/easylist/easylist/pull/5456 but ryanbr said that FInnish Easylist should handle it. After that I have taken a policy that If there's an international site that has a Finnish UI and it has Finnish ad elements, I'll add it to the Finnish list.

peace2000 commented 2 years ago

kuva

Screenshot from FB's DOM tree... :D

peace2000 commented 2 years ago

I think this should be re-delegated to uAssets,

Btw, why uAssets instead of Easylist?

DandelionSprout commented 2 years ago

How about facebook.com#?#div[data-pagelet^=FeedUnit_]:-abp-has(div[class*=" "] > span[class][dir] > span[id]:not([class] > span[class]:not([id]):first-of-type + a[aria-label]:last-of-type)?

peace2000 commented 2 years ago

Unfortunately that rule matches to all posts, not just ad ones.

DandelionSprout commented 2 years ago

In that case I'm not sure what to do, other than to ask uAssets and AdGuard Filters about this instead. Especially since Ryan must've lied to you about where the entry should go, as global websites should always be in English-language lists.

peace2000 commented 2 years ago

Well, I was told no in that occasion which I linked, so I don't know other solutions than to add it to the Finnish list.

btw, here is a DOM tree from non-sponsored post:

kuva

Yuki2718 commented 2 years ago

uAssets members keep asking user to reference this: https://old.reddit.com/r/uBlockOrigin/wiki/solutions. But I found FP by facebook.com##div[role="feed"] div > span > span > a > span:upward(div[role="feed"] > div:not([data-pagelet*="group" i])) in 3p frame (FB widget) so replaced this with facebook.com##[role=feed] div > span > span > a > span >:not(:has-text(/^[^A-z]$/)):upward(div[role=feed] > div), an another idea of RraaLL.

@krystian3w Can you check if JP version of @peace2000 's filter is facebook.com#?#div[data-pagelet^=FeedUnit_]:-abp-has(div[role=article] div[style^=border-radius] span[dir=auto] a[aria-label=広告])?

probably have Facebook accounts, which I don't.

They, unlike any other social media I've tested, can somehow detect test accounts and is very quick to ban them.

peace2000 commented 2 years ago

@Yuki2718 I checked and that filter works for JP FB. For both "generic" JP and "kansai" dialect. They have a different switch but filter works for both of them.

kuva

Facebook has lots of scammers. For that reason they delete accounts that don't look real. Have no friends, no profile pic etc...

peace2000 commented 2 years ago

I btw also use this one for ads that have appeared at the of right rail:

facebook.com#?#div[data-pagelet=RightRail] > div:-abp-has( div h3 > span:-abp-contains(Sponsoroitu)) but currently that ad is not appearing, at least not for me so I'm not sure if that filter is still relevant.

But the filter that I previously posted, is relevant for Sponsored posts that appear all the time in you feed.

ryanbr commented 2 years ago

In that case I'm not sure what to do, other than to ask uAssets and AdGuard Filters about this instead. Especially since Ryan must've lied to you about where the entry should go, as global websites should always be in English-language lists.

Lied about what, when?

Yuki2718 commented 2 years ago

Does facebook.com##div[data-pagelet^="FeedUnit_"] div[role="article"] div[style^="border-radius"] span[dir="auto"] > span[id]:watch-attr(href) > a[href^="/ads/about/"]:upward(div[data-pagelet^="FeedUnit_"]) work for uBO? AG doesn't support watch-attr but :matches-attr can be used to unite all the language-specific filters into one.

krystian3w commented 2 years ago

@ryanbr you closed in the past a PR created by @peace2000 where he added Finland/Norawy/Sweeden version of word.

DandelionSprout commented 2 years ago

Lied about what, when?

peace2000 claimed you told him that entries for Facebook with Finnish GUI had to be in the Finnish list.

krystian3w commented 2 years ago

Also AdGuard use own PureJS filter to hide self-promo so no need create filter based on ExtendedCSS aka Procedural cosmetic filter.

! https://forum.adguard.com/index.php?threads/mac-adguard-2-4-3-718-facebook-sponsored-ads-are-not-blocked.37861
! update: 05.06.2020 (full rule)
facebook.com,facebookcorewwi.onion#%#!function(){var e=new MutationObserver(function(){var m=document.querySelectorAll("div[id^='mount_']");{var e;e=0<m.length?document.querySelectorAll('div[role="feed"] > div[data-pagelet^="FeedUnit"] > div[class]:not([style*="height"])'):document.querySelectorAll('[id^="substream"] > div:not(.hidden_elem) div[id^="hyperfeed_story_id"]')}e.forEach(function(e){function n(e,n){for(0<m.length?"0"==(h=e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span > span > span[data-content]')).length&&(h=e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span[aria-label]')):h=e.querySelectorAll(".userContentWrapper h5 + div[data-testid] a [class] [class]"),socheck=0;socheck<h.length;socheck++)h[socheck].innerText.contains(n)&&(p=["1"],d=["1"],u=["1"],i=r=l=1,socheck=h.length)}function t(e,n,t,c,a){for(0<m.length?"0"==(h=e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span > span > span[data-content]')).length&&(h=e.querySelectorAll('div[role="article"] span[dir="auto"] div[role="button"][tabindex]')):h=e.querySelectorAll(".userContentWrapper h5 + div[data-testid] > span a > [class] [class]"),"0"==h.length&&(h=e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span[aria-label]')),socheck=0;socheck<h.length;socheck++){spancheck=0,1<h.length?(spancheck=h[socheck].querySelectorAll("span")[0],0==spancheck&&(spancheck=h[socheck].querySelectorAll("b")[0])):(spancheck=h[0].querySelectorAll("span")[socheck],0==spancheck&&(spancheck=h[0].querySelectorAll("b")[socheck]));var o=h[0];if(0!=spancheck&&spancheck){if(2==spancheck.children.length&&0<m.length)for(spancheck=spancheck.querySelectorAll("span:not([style])"),spcheck=0;spcheck<spancheck.length;spcheck++)spancheck[spcheck].innerText.contains(n)?s=1:!spancheck[spcheck].innerText.contains(t)||0!=spancheck[spcheck].offsetTop||spancheck[spcheck].innerText.contains(n)||spancheck[spcheck].innerText.contains(c)||spancheck[spcheck].innerText.contains(a)?!spancheck[spcheck].innerText.contains(c)||0!=spancheck[spcheck].offsetTop||spancheck[spcheck].innerText.contains(t)||spancheck[spcheck].innerText.contains(n)||spancheck[spcheck].innerText.contains(a)?!spancheck[spcheck].innerText.contains(a)||0!=spancheck[spcheck].offsetTop||spancheck[spcheck].innerText.contains(t)||spancheck[spcheck].innerText.contains(c)||spancheck[spcheck].innerText.contains(n)||(u=["1"],i=1):(d=["1"],r=1):(p=["1"],l=1);0==m.length&&((!(spancheck.innerText.contains(n)&&0==spancheck.offsetTop||h[0].innerText.contains(n)&&0==h[0].offsetTop)||spancheck.innerText.contains(t)&&!h[0].innerText.contains(t)||spancheck.innerText.contains(c)&&!h[0].innerText.contains(c)||spancheck.innerText.contains(a)&&!h[0].innerText.contains(a))&&(!o.innerText.contains(n)||0!=o.offsetTop||o.innerText.contains(t)||o.innerText.contains(c)||o.innerText.contains(a))?!spancheck.innerText.contains(t)||0!=spancheck.offsetTop||spancheck.innerText.contains(n)||spancheck.innerText.contains(c)||spancheck.innerText.contains(a)?!spancheck.innerText.contains(c)||0!=spancheck.offsetTop||spancheck.innerText.contains(t)||spancheck.innerText.contains(n)||spancheck.innerText.contains(a)?!spancheck.innerText.contains(a)||0!=spancheck.offsetTop||spancheck.innerText.contains(t)||spancheck.innerText.contains(c)||spancheck.innerText.contains(n)||(u=["1"],i=1):(d=["1"],r=1):(p=["1"],l=1):s=1)}}}function c(e,n,t,c,a){u=0<m.length?(h=e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span span[data-content='+n+"]"),p=e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span span[data-content='+t+"]"),d=e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span span[data-content='+c+"]"),e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span span[data-content='+a+"]")):(h=e.querySelectorAll(".userContentWrapper h5 + div[data-testid] a [data-content="+n+"]"),p=e.querySelectorAll(".userContentWrapper h5 + div[data-testid] a [data-content="+t+"]"),d=e.querySelectorAll(".userContentWrapper h5 + div[data-testid] a [data-content="+c+"]"),e.querySelectorAll(".userContentWrapper h5 + div[data-testid] a [data-content="+a+"]"))}var s=0,l=0,r=0,i=0,h=0,p=0,d=0,u=0,a=e.querySelectorAll("div[style='width: 100%'] > a[href*='oculus.com/quest'] > div"),o=document.querySelector("[lang]"),k=document.querySelectorAll("link[rel='preload'][href*='/l/']");o=o?document.querySelector("[lang]").lang:"en";var y,g=e.querySelectorAll('a[ajaxify*="ad_id"] > span'),f=e.querySelectorAll('a[href*="ads/about"]'),S=e.querySelectorAll('a[href*="https://www.facebook.com/business/help"]');if("display: none !important;"!=e.getAttribute("style")&&!e.classList.contains("hidden_elem")&&(0<g.length||0<f.length||0<S.length?(T+=1,0<m.length?(""==(y=e.querySelectorAll("a[href]")[0].innerText)&&(y=e.querySelectorAll("a[href]")[1].innerText),""==y&&(y=e.querySelectorAll("a[href]")[0].querySelectorAll("a[aria-label]")[0].getAttribute("aria-label"))):y=e.querySelectorAll("a[href]")[2].innerText,console.log("--------"),console.log("Ad hidden from: "+y),console.log("Total ads hidden: "+T),console.log("F length: "+g.length),console.log("H length: "+f.length),console.log("I length (Paid partnership): "+S.length),console.log("--------"),e.style="display:none!important;"):0<a.length?(T+=1,y="Facebook",console.log("--------"),console.log("Ad hidden from: "+y),console.log("Total ads hidden: "+T),console.log("Non-declared ad"),console.log("--------"),e.style="display:none!important;"):"af"==o?n(e,"Geborg"):"de"==o||"nl"==o?c(e,"G","e","s","n"):"am"==o?n(e,"የተከፈለበት ማስታወቂያ"):"ar"==o?n(e,"مُموَّل"):"as"==o?n(e,"পৃষ্ঠপোষকতা কৰা"):"az"==o?n(e,"Sponsor dəstəkli"):"co"==o?n(e,"Spunsurizatu"):"bs"==o||"sl"==o||"cs"==o?c(e,"S","p","z","n"):"da"==o||"en"==o||"et"==o||"fy"==o||"it"==o||"ku"==o||"nb"==o||"nn"==o||"pl"==o||"sq"==o||"sv"==o||"zz"==o?0<m.length?k[0].href.contains("en_UD")?n(e,"pəɹosuodS"):k[0].href.contains("ja_KS")?n(e,"広告"):k[0].href.contains("tz_MA")?n(e,"ⵉⴷⵍ"):k[0].href.contains("sy_SY")?n(e,"ܒܘܕܩܐ ܡܡܘܘܢܐ"):k[0].href.contains("cb_IQ")?n(e,"پاڵپشتیکراو"):k[0].href.contains("ar_AR")?n(e,"مُموَّل"):k[0].href.contains("sz_PL")?n(e,"Szpōnzorowane"):k[0].href.contains("eo_EO")?n(e,"Reklamo"):k[0].href.contains("es_LA")?c(e,"P","u","c","d"):(c(e,"S","p","s","n"),"0"==h.length&&t(e,"S","p","s","n"),"0"==h.length&&n(e,"Sponsored")):document.querySelector("body").className.includes("Locale_en_UD")?n(e,"pəɹosuodS"):document.querySelector("body").className.includes("ja_KS")?n(e,"広告"):document.querySelector("body").className.includes("tz_MA")?n(e,"ⵉⴷⵍ"):document.querySelector("body").className.includes("sy_SY")?n(e,"ܒܘܕܩܐ ܡܡܘܘܢܐ"):document.querySelector("body").className.includes("cb_IQ")?n(e,"پاڵپشتیکراو"):document.querySelector("body").className.includes("ar_AR")?n(e,"مُموَّل"):document.querySelector("body").className.includes("sz_PL")?n(e,"Szpōnzorowane"):document.querySelector("body").className.includes("eo_EO")?n(e,"Reklamo"):document.querySelector("body").className.includes("es_LA")?c(e,"P","u","c","d"):(c(e,"S","p","s","n"),"0"==h.length&&t(e,"S","p","s","n")):"be"==o?n(e,"Рэклама"):"bg"==o?n(e,"Спонсорирано"):"mk"==o?n(e,"Спонзорирано"):"br"==o?n(e,"Paeroniet"):"ca"==o?n(e,"Patrocinat"):"gl"==o||"pt"==o?(n(e,"Patrocinado"),"0"==l&&c(e,"P","a","c","o")):"bn"==o?n(e,"সৌজন্যে"):"cb"==o?n(e,"پاڵپشتیکراو"):"cx"==o?c(e,"G","i","s","n"):"cy"==o?n(e,"Noddwyd"):"el"==o?n(e,"Χορηγούμενη"):"eo"==o?n(e,"Reklamo"):"es"==o?c(e,"P","u","c","d"):"eu"==o?n(e,"Babestua"):"fa"==o?n(e,"دارای پشتیبانی مالی"):"ff"==o?n(e,"Yoɓanaama"):"fi"==o?n(e,"Sponsoroitu"):"fo"==o?n(e,"Stuðlað"):"fr"==o?0<m.length?k[0].href.contains("fr_FR")?c(e,"S","p","s","n"):c(e,"C","o","m","n"):document.querySelector("body").className.includes("Locale_fr_FR")?c(e,"S","p","s","n"):c(e,"C","o","m","n"):"ga"==o?n(e,"Urraithe"):"gn"==o?n(e,"Oñepatrosinapyre"):"gu"==o?n(e,"પ્રાયોજિત"):"ha"==o?n(e,"Daukar Nauyi"):"he"==o?n(e,"ממומן"):"hr"==o?n(e,"Plaćeni oglas"):"ht"==o?n(e,"Peye"):"ne"==o||"mr"==o||"hi"==o?n(e,"प्रायोजित"):"hu"==o?c(e,"H","i","r","d"):"hy"==o?n(e,"Գովազդային"):"id"==o?c(e,"B","e","p","n"):"is"==o?n(e,"Kostað"):"ja"==o?n(e,"広告"):"ms"==o?n(e,"Ditaja"):"jv"==o?n(e,"Disponsori"):"ka"==o?n(e,"რეკლამა"):"kk"==o?n(e,"Демеушілік көрсеткен"):"km"==o?n(e,"បានឧបត្ថម្ភ"):"kn"==o?n(e,"ಪ್ರಾಯೋಜಿತ"):"ko"==o?n(e,"Sponsored"):"ky"==o?n(e,"Демөөрчүлөнгөн"):"lo"==o?n(e,"ຜູ້ສະໜັບສະໜູນ"):"lt"==o?n(e,"Remiama"):"lv"==o?n(e,"Apmaksāta reklāma"):"mg"==o?n(e,"Misy Mpiantoka"):"ml"==o?n(e,"സ്പോൺസർ ചെയ്തത്"):"mn"==o?n(e,"Ивээн тэтгэсэн"):"mt"==o?n(e,"Sponsorjat"):"my"==o?(n(e,"ပံ့ပိုးထားသည်"),"0"==l&&n(e,"အခပေးကြော်ငြာ")):"or"==o?n(e,"ପ୍ରଯୋଜିତ"):"pa"==o?n(e,"ਸਰਪ੍ਰਸਤੀ ਪ੍ਰਾਪਤ"):"ps"==o?n(e,"تمويل شوي"):"ro"==o?n(e,"Sponsorizat"):"ru"==o||"uk"==o?n(e,"Реклама"):"rw"==o?n(e,"Icyamamaza ndasukirwaho"):"sc"==o?n(e,"Patronadu de"):"si"==o?n(e,"අනුග්රාහක"):"sk"==o?n(e,"Sponzorované"):"sn"==o?n(e,"Zvabhadharirwa"):"so"==o?n(e,"La maalgeliyey"):"sr"==o?n(e,"Спонзорисано"):"sw"==o?n(e,"Imedhaminiwa"):"sy"==o?n(e,"ܒܘܕܩܐ ܡܡܘܘܢܐ"):"sz"==o?n(e,"Szpōnzorowane"):"ta"==o?n(e,"விளம்பரம்"):"te"==o?n(e,"ప్రాయోజితం చేయబడింది"):"tg"==o?n(e,"Бо сарпарастӣ"):"th"==o?n(e,"ได้รับการสนับสนุน"):"tl"==o?n(e,"May Sponsor"):"tr"==o?n(e,"Sponsorlu"):"tt"==o?n(e,"Хәйрияче"):"tz"==o?n(e,"ⵉⴷⵍ"):"ur"==o?n(e,"سپانسرڈ"):"uz"==o?n(e,"Reklama"):"vi"==o?n(e,"Được tài trợ"):"zh-Hans"==o?n(e,"赞助内容"):"zh-Hant"==o&&n(e,"贊助"),0<h.length&&0<p.length&&0<d.length&&0<u.length)){for(cont=0;cont<h.length;cont++)0<h[cont].offsetHeight&&(cont=h.length,s=1);for(cont1=0;cont1<p.length;cont1++)0<p[cont1].offsetHeight&&(cont1=p.length,l=1);for(cont2=0;cont2<d.length;cont2++)0<d[cont2].offsetHeight&&(cont2=d.length,r=1);for(cont3=0;cont3<u.length;cont3++)0<u[cont3].offsetHeight&&(cont3=u.length,i=1);1==s&&1==l&&1==r&&1==i&&(0<m.length&&""!=(y=e.querySelectorAll("a[href]")[1].innerText)||(y=e.querySelectorAll("a[href]")[2].innerText),T+=1,console.log("--------"),console.log("Ad hidden from: "+y),console.log("Total ads hidden: "+T),console.log("--------"),e.style="display:none!important;")}})}),T=0;e.observe(document,{childList:!0,subtree:!0})}();

Formatted:

! function() {
    var e = new MutationObserver(function() {
            var m = document.querySelectorAll("div[id^='mount_']"); {
                var e;
                e = 0 < m.length ? document.querySelectorAll('div[role="feed"] > div[data-pagelet^="FeedUnit"] > div[class]:not([style*="height"])') : document.querySelectorAll('[id^="substream"] > div:not(.hidden_elem) div[id^="hyperfeed_story_id"]')
            }
            e.forEach(function(e) {
                function n(e, n) {
                    for (0 < m.length ? "0" == (h = e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span > span > span[data-content]')).length && (h = e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span[aria-label]')) : h = e.querySelectorAll(".userContentWrapper h5 + div[data-testid] a [class] [class]"), socheck = 0; socheck < h.length; socheck++) h[socheck].innerText.contains(n) && (p = ["1"], d = ["1"], u = ["1"], i = r = l = 1, socheck = h.length)
                }

                function t(e, n, t, c, a) {
                    for (0 < m.length ? "0" == (h = e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span > span > span[data-content]')).length && (h = e.querySelectorAll('div[role="article"] span[dir="auto"] div[role="button"][tabindex]')) : h = e.querySelectorAll(".userContentWrapper h5 + div[data-testid] > span a > [class] [class]"), "0" == h.length && (h = e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span[aria-label]')), socheck = 0; socheck < h.length; socheck++) {
                        spancheck = 0, 1 < h.length ? (spancheck = h[socheck].querySelectorAll("span")[0], 0 == spancheck && (spancheck = h[socheck].querySelectorAll("b")[0])) : (spancheck = h[0].querySelectorAll("span")[socheck], 0 == spancheck && (spancheck = h[0].querySelectorAll("b")[socheck]));
                        var o = h[0];
                        if (0 != spancheck && spancheck) {
                            if (2 == spancheck.children.length && 0 < m.length)
                                for (spancheck = spancheck.querySelectorAll("span:not([style])"), spcheck = 0; spcheck < spancheck.length; spcheck++) spancheck[spcheck].innerText.contains(n) ? s = 1 : !spancheck[spcheck].innerText.contains(t) || 0 != spancheck[spcheck].offsetTop || spancheck[spcheck].innerText.contains(n) || spancheck[spcheck].innerText.contains(c) || spancheck[spcheck].innerText.contains(a) ? !spancheck[spcheck].innerText.contains(c) || 0 != spancheck[spcheck].offsetTop || spancheck[spcheck].innerText.contains(t) || spancheck[spcheck].innerText.contains(n) || spancheck[spcheck].innerText.contains(a) ? !spancheck[spcheck].innerText.contains(a) || 0 != spancheck[spcheck].offsetTop || spancheck[spcheck].innerText.contains(t) || spancheck[spcheck].innerText.contains(c) || spancheck[spcheck].innerText.contains(n) || (u = ["1"], i = 1) : (d = ["1"], r = 1) : (p = ["1"], l = 1);
                            0 == m.length && ((!(spancheck.innerText.contains(n) && 0 == spancheck.offsetTop || h[0].innerText.contains(n) && 0 == h[0].offsetTop) || spancheck.innerText.contains(t) && !h[0].innerText.contains(t) || spancheck.innerText.contains(c) && !h[0].innerText.contains(c) || spancheck.innerText.contains(a) && !h[0].innerText.contains(a)) && (!o.innerText.contains(n) || 0 != o.offsetTop || o.innerText.contains(t) || o.innerText.contains(c) || o.innerText.contains(a)) ? !spancheck.innerText.contains(t) || 0 != spancheck.offsetTop || spancheck.innerText.contains(n) || spancheck.innerText.contains(c) || spancheck.innerText.contains(a) ? !spancheck.innerText.contains(c) || 0 != spancheck.offsetTop || spancheck.innerText.contains(t) || spancheck.innerText.contains(n) || spancheck.innerText.contains(a) ? !spancheck.innerText.contains(a) || 0 != spancheck.offsetTop || spancheck.innerText.contains(t) || spancheck.innerText.contains(c) || spancheck.innerText.contains(n) || (u = ["1"], i = 1) : (d = ["1"], r = 1) : (p = ["1"], l = 1) : s = 1)
                        }
                    }
                }

                function c(e, n, t, c, a) {
                    u = 0 < m.length ? (h = e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span span[data-content=' + n + "]"), p = e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span span[data-content=' + t + "]"), d = e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span span[data-content=' + c + "]"), e.querySelectorAll('div[role="article"] span[dir="auto"] > a > span span[data-content=' + a + "]")) : (h = e.querySelectorAll(".userContentWrapper h5 + div[data-testid] a [data-content=" + n + "]"), p = e.querySelectorAll(".userContentWrapper h5 + div[data-testid] a [data-content=" + t + "]"), d = e.querySelectorAll(".userContentWrapper h5 + div[data-testid] a [data-content=" + c + "]"), e.querySelectorAll(".userContentWrapper h5 + div[data-testid] a [data-content=" + a + "]"))
                }
                var s = 0,
                    l = 0,
                    r = 0,
                    i = 0,
                    h = 0,
                    p = 0,
                    d = 0,
                    u = 0,
                    a = e.querySelectorAll("div[style='width: 100%'] > a[href*='oculus.com/quest'] > div"),
                    o = document.querySelector("[lang]"),
                    k = document.querySelectorAll("link[rel='preload'][href*='/l/']");
                o = o ? document.querySelector("[lang]").lang : "en";
                var y, g = e.querySelectorAll('a[ajaxify*="ad_id"] > span'),
                    f = e.querySelectorAll('a[href*="ads/about"]'),
                    S = e.querySelectorAll('a[href*="https://www.facebook.com/business/help"]');
                if ("display: none !important;" != e.getAttribute("style") && !e.classList.contains("hidden_elem") && (0 < g.length || 0 < f.length || 0 < S.length ? (T += 1, 0 < m.length ? ("" == (y = e.querySelectorAll("a[href]")[0].innerText) && (y = e.querySelectorAll("a[href]")[1].innerText), "" == y && (y = e.querySelectorAll("a[href]")[0].querySelectorAll("a[aria-label]")[0].getAttribute("aria-label"))) : y = e.querySelectorAll("a[href]")[2].innerText, console.log("--------"), console.log("Ad hidden from: " + y), console.log("Total ads hidden: " + T), console.log("F length: " + g.length), console.log("H length: " + f.length), console.log("I length (Paid partnership): " + S.length), console.log("--------"), e.style = "display:none!important;") : 0 < a.length ? (T += 1, y = "Facebook", console.log("--------"), console.log("Ad hidden from: " + y), console.log("Total ads hidden: " + T), console.log("Non-declared ad"), console.log("--------"), e.style = "display:none!important;") : "af" == o ? n(e, "Geborg") : "de" == o || "nl" == o ? c(e, "G", "e", "s", "n") : "am" == o ? n(e, "የተከፈለበት ማስታወቂያ") : "ar" == o ? n(e, "مُموَّل") : "as" == o ? n(e, "পৃষ্ঠপোষকতা কৰা") : "az" == o ? n(e, "Sponsor dəstəkli") : "co" == o ? n(e, "Spunsurizatu") : "bs" == o || "sl" == o || "cs" == o ? c(e, "S", "p", "z", "n") : "da" == o || "en" == o || "et" == o || "fy" == o || "it" == o || "ku" == o || "nb" == o || "nn" == o || "pl" == o || "sq" == o || "sv" == o || "zz" == o ? 0 < m.length ? k[0].href.contains("en_UD") ? n(e, "pəɹosuodS") : k[0].href.contains("ja_KS") ? n(e, "広告") : k[0].href.contains("tz_MA") ? n(e, "ⵉⴷⵍ") : k[0].href.contains("sy_SY") ? n(e, "ܒܘܕܩܐ ܡܡܘܘܢܐ") : k[0].href.contains("cb_IQ") ? n(e, "پاڵپشتیکراو") : k[0].href.contains("ar_AR") ? n(e, "مُموَّل") : k[0].href.contains("sz_PL") ? n(e, "Szpōnzorowane") : k[0].href.contains("eo_EO") ? n(e, "Reklamo") : k[0].href.contains("es_LA") ? c(e, "P", "u", "c", "d") : (c(e, "S", "p", "s", "n"), "0" == h.length && t(e, "S", "p", "s", "n"), "0" == h.length && n(e, "Sponsored")) : document.querySelector("body").className.includes("Locale_en_UD") ? n(e, "pəɹosuodS") : document.querySelector("body").className.includes("ja_KS") ? n(e, "広告") : document.querySelector("body").className.includes("tz_MA") ? n(e, "ⵉⴷⵍ") : document.querySelector("body").className.includes("sy_SY") ? n(e, "ܒܘܕܩܐ ܡܡܘܘܢܐ") : document.querySelector("body").className.includes("cb_IQ") ? n(e, "پاڵپشتیکراو") : document.querySelector("body").className.includes("ar_AR") ? n(e, "مُموَّل") : document.querySelector("body").className.includes("sz_PL") ? n(e, "Szpōnzorowane") : document.querySelector("body").className.includes("eo_EO") ? n(e, "Reklamo") : document.querySelector("body").className.includes("es_LA") ? c(e, "P", "u", "c", "d") : (c(e, "S", "p", "s", "n"), "0" == h.length && t(e, "S", "p", "s", "n")) : "be" == o ? n(e, "Рэклама") : "bg" == o ? n(e, "Спонсорирано") : "mk" == o ? n(e, "Спонзорирано") : "br" == o ? n(e, "Paeroniet") : "ca" == o ? n(e, "Patrocinat") : "gl" == o || "pt" == o ? (n(e, "Patrocinado"), "0" == l && c(e, "P", "a", "c", "o")) : "bn" == o ? n(e, "সৌজন্যে") : "cb" == o ? n(e, "پاڵپشتیکراو") : "cx" == o ? c(e, "G", "i", "s", "n") : "cy" == o ? n(e, "Noddwyd") : "el" == o ? n(e, "Χορηγούμενη") : "eo" == o ? n(e, "Reklamo") : "es" == o ? c(e, "P", "u", "c", "d") : "eu" == o ? n(e, "Babestua") : "fa" == o ? n(e, "دارای پشتیبانی مالی") : "ff" == o ? n(e, "Yoɓanaama") : "fi" == o ? n(e, "Sponsoroitu") : "fo" == o ? n(e, "Stuðlað") : "fr" == o ? 0 < m.length ? k[0].href.contains("fr_FR") ? c(e, "S", "p", "s", "n") : c(e, "C", "o", "m", "n") : document.querySelector("body").className.includes("Locale_fr_FR") ? c(e, "S", "p", "s", "n") : c(e, "C", "o", "m", "n") : "ga" == o ? n(e, "Urraithe") : "gn" == o ? n(e, "Oñepatrosinapyre") : "gu" == o ? n(e, "પ્રાયોજિત") : "ha" == o ? n(e, "Daukar Nauyi") : "he" == o ? n(e, "ממומן") : "hr" == o ? n(e, "Plaćeni oglas") : "ht" == o ? n(e, "Peye") : "ne" == o || "mr" == o || "hi" == o ? n(e, "प्रायोजित") : "hu" == o ? c(e, "H", "i", "r", "d") : "hy" == o ? n(e, "Գովազդային") : "id" == o ? c(e, "B", "e", "p", "n") : "is" == o ? n(e, "Kostað") : "ja" == o ? n(e, "広告") : "ms" == o ? n(e, "Ditaja") : "jv" == o ? n(e, "Disponsori") : "ka" == o ? n(e, "რეკლამა") : "kk" == o ? n(e, "Демеушілік көрсеткен") : "km" == o ? n(e, "បានឧបត្ថម្ភ") : "kn" == o ? n(e, "ಪ್ರಾಯೋಜಿತ") : "ko" == o ? n(e, "Sponsored") : "ky" == o ? n(e, "Демөөрчүлөнгөн") : "lo" == o ? n(e, "ຜູ້ສະໜັບສະໜູນ") : "lt" == o ? n(e, "Remiama") : "lv" == o ? n(e, "Apmaksāta reklāma") : "mg" == o ? n(e, "Misy Mpiantoka") : "ml" == o ? n(e, "സ്പോൺസർ ചെയ്തത്") : "mn" == o ? n(e, "Ивээн тэтгэсэн") : "mt" == o ? n(e, "Sponsorjat") : "my" == o ? (n(e, "ပံ့ပိုးထားသည်"), "0" == l && n(e, "အခပေးကြော်ငြာ")) : "or" == o ? n(e, "ପ୍ରଯୋଜିତ") : "pa" == o ? n(e, "ਸਰਪ੍ਰਸਤੀ ਪ੍ਰਾਪਤ") : "ps" == o ? n(e, "تمويل شوي") : "ro" == o ? n(e, "Sponsorizat") : "ru" == o || "uk" == o ? n(e, "Реклама") : "rw" == o ? n(e, "Icyamamaza ndasukirwaho") : "sc" == o ? n(e, "Patronadu de") : "si" == o ? n(e, "අනුග්රාහක") : "sk" == o ? n(e, "Sponzorované") : "sn" == o ? n(e, "Zvabhadharirwa") : "so" == o ? n(e, "La maalgeliyey") : "sr" == o ? n(e, "Спонзорисано") : "sw" == o ? n(e, "Imedhaminiwa") : "sy" == o ? n(e, "ܒܘܕܩܐ ܡܡܘܘܢܐ") : "sz" == o ? n(e, "Szpōnzorowane") : "ta" == o ? n(e, "விளம்பரம்") : "te" == o ? n(e, "ప్రాయోజితం చేయబడింది") : "tg" == o ? n(e, "Бо сарпарастӣ") : "th" == o ? n(e, "ได้รับการสนับสนุน") : "tl" == o ? n(e, "May Sponsor") : "tr" == o ? n(e, "Sponsorlu") : "tt" == o ? n(e, "Хәйрияче") : "tz" == o ? n(e, "ⵉⴷⵍ") : "ur" == o ? n(e, "سپانسرڈ") : "uz" == o ? n(e, "Reklama") : "vi" == o ? n(e, "Được tài trợ") : "zh-Hans" == o ? n(e, "赞助内容") : "zh-Hant" == o && n(e, "贊助"), 0 < h.length && 0 < p.length && 0 < d.length && 0 < u.length)) {
                    for (cont = 0; cont < h.length; cont++) 0 < h[cont].offsetHeight && (cont = h.length, s = 1);
                    for (cont1 = 0; cont1 < p.length; cont1++) 0 < p[cont1].offsetHeight && (cont1 = p.length, l = 1);
                    for (cont2 = 0; cont2 < d.length; cont2++) 0 < d[cont2].offsetHeight && (cont2 = d.length, r = 1);
                    for (cont3 = 0; cont3 < u.length; cont3++) 0 < u[cont3].offsetHeight && (cont3 = u.length, i = 1);
                    1 == s && 1 == l && 1 == r && 1 == i && (0 < m.length && "" != (y = e.querySelectorAll("a[href]")[1].innerText) || (y = e.querySelectorAll("a[href]")[2].innerText), T += 1, console.log("--------"), console.log("Ad hidden from: " + y), console.log("Total ads hidden: " + T), console.log("--------"), e.style = "display:none!important;")
                }
            })
        }),
        T = 0;
    e.observe(document, {
        childList: !0,
        subtree: !0
    })
}();
peace2000 commented 2 years ago

facebook.com##div[data-pagelet^="FeedUnit_"] div[role="article"] div[style^="border-radius"] span[dir="auto"] > span[id]:watch-attr(href) > a[href^="/ads/about/"]:upward(div[data-pagelet^="FeedUnit_"])

That rule has issues hiding some off-screen sponsored posts. Doesn't perform well. :( It still suffers from the same issues as the language generic filter I originally gave.

@Yuki2718

krystian3w commented 2 years ago

I'm more concerned about whether someone will update the filter 2 times a day as Facebook starts changing the post structure (e.g. adding a fake hidden date that only :matches-css could distinguish).

Yuki2718 commented 2 years ago

[Off-topic] @krystian3w @peace2000 If you have time, can you check JP translation of ##a[aria-label="Advertiser link"] and ##a[aria-label="Advertiser"] ?

DandelionSprout commented 2 years ago

For clarification: Is it still expected of me to have to log on to someone's Facebook timeline (Presumably that of my mom) and test all these entries?

Just need to make sure before I set off time to visit my parents for the sole purpose of doing that.

krystian3w commented 2 years ago

##a[aria-label="Advertiser link"] and ##a[aria-label="Advertiser"] ?

where found? I on homepage I have only translated: aria-label="Sponsored" into aria-label="広告". (広告),

Oh..., I see a few on 3-rd account (right top ad in sidebar):

Advertiser:

Advertiser Image Link:

krystian3w commented 2 years ago

Facebook timeline (Presumably that of my mom)

You try exclude any FP (hide good content post as paid ad "sponsored")?

krystian3w commented 2 years ago

Also in regional "tradictional" dialect (ślōnskŏ gŏdka) is used <span aria-label="Szpōnzorowane"></span>

Yuki2718 commented 2 years ago

@krystian3w Thank you very much! They're found in EL, but I don't see Advertiser Image Link in EL.

krystian3w commented 2 years ago

Maybe due parent:

A[Advertiser] > * object a[Advertiser image link]

Or badly remembered dom tree/node.

peace2000 commented 2 years ago

@krystian3w I remember seeing an ad on Facebook's right upper rail but it's appearance seems to be random for me, I don't currently see it. The only thing I see at the moment, are sponsored posts in newsfeed...

What this rule ##a[aria-label="Advertiser link"] (or it's language specific version) actually hides? If I recall correctly, it only hides a title of that right upper ad? Can you tell if this has changed?

I remember now that due to that shortcoming, I originally made this filter:

#?#div[data-pagelet=RightRail] > div:-abp-has( div h3 > span:-abp-contains(Sponsoroitu))

As it hid the whole thing.

peace2000 commented 2 years ago

For clarification: Is it still expected of me to have to log on to someone's Facebook timeline (Presumably that of my mom) and test all these entries?

Just need to make sure before I set off time to visit my parents for the sole purpose of doing that.

@DandelionSprout It's always up to a list maintainer what sites are supported, but personally I think that it'd be a pity if one of the most popular sites isn't covered in filterlists.

DandelionSprout commented 2 years ago

How about it reporting it to uAssets, then?

DandelionSprout commented 2 years ago

That being said, have anyone here tested this whole situation with uBlock Filters turned on? Would've been nice to know, before I'd have attempted to re-delegate this report to them.

peace2000 commented 2 years ago

That being said, have anyone here tested this whole situation with uBlock Filters turned on? Would've been nice to know, before I'd have attempted to re-delegate this report to them.

Yes, they don't hide / block them. I also double-checked by updating those lists. But no, they don't currently do anything to them. (At least not for sponsored posts in the feed.)

krystian3w commented 2 years ago

How about it reporting it to uAssets, then?

In mega thread (https://github.com/uBlockOrigin/uAssets/issues/3367) but may anybody generate commit in tribe "copy-paste".

Report in "uBlock-Isuess" about race condition in Procedural cosmetic filtering can by rejected if we create buggy/poor filter.

Yuki2718 commented 2 years ago

If I recall correctly, it only hides a title of that right upper ad? Can you tell if this has changed?

Oh, then I guess it's not worth blocked much.

peace2000 commented 2 years ago

@DandelionSprout That sound's fine, it's always the best if an universal solution is found :)

@krystian3w IMO that topic is a thread, instead of an issue report... :D I would open a new one concerning non-english filters or a language neutral filter.

DandelionSprout commented 2 years ago

I've received news that ABP Anti-Circumvention Filters now has entries that aim to remove those sponsored posts. I am awaiting permission to share a screenshot of the ABP Slack post where this was explained in detail.

krystian3w commented 2 years ago

Enough is wizmak/manuel commits.

https://github.com/abp-filters/abp-filters-anti-cv/commit/e40727362559d300e3c56f7ff93583dd1ced2c2f https://github.com/abp-filters/abp-filters-anti-cv/commit/59e3e7a00e318ee554453a18a8ee713b9120cad3 https://github.com/abp-filters/abp-filters-anti-cv/commit/c1af9c464c24c310848ab1b41252d1b45ea9ebbc https://github.com/abp-filters/abp-filters-anti-cv/commit/65d21798e206d3c9942a7192ad2d04f8965f2f0c https://github.com/abp-filters/abp-filters-anti-cv/commit/0b2a9d7334da986ef53d5fd0b9d991277083f5db (manuel-martinez-dev)

Yuki2718 commented 2 years ago

facebook.com##div[data-pagelet="RightRail"] a[aria-labelledby][target="_blank"][tabindex="0"] looks quite generic, but if it's really useful can be added to EL.

krystian3w commented 2 years ago

Blank may suggest 3-rd party object.

peace2000 commented 2 years ago

Now I finally got to see that rightrail ad :D not gonna refresh the page so that I won't "lose" it :D :D

kuva

Rule facebook.com##div[data-pagelet="RightRail"] a[aria-labelledby][target="_blank"][tabindex="0"] only blocks it partially. It removes the ad stuff under "Sponsoroitu" (Sponsored) label, but not the Sponsored label itself.. The filter that was provided by ABP works but If one wants to make it more specific for safety reasons, here's a picture of the DOM structure of that element which ABP rule targets:

kuva

(That's the element where a language specific ##a[aria-label="Mainostaja"] (or ##a[aria-label="Advertiser"]) is being used.

My language neutral version: facebook.com##div[data-pagelet=RightRail] a[aria-label][aria-labelledby][rel="nofollow noopener"][role=link][target=_blank][tabindex="0"]

"Sponsoroitu" (Sponsored) label:

kuva

That can't be hid in a reliably way without using procedurals as you'll have to target a div element that has no specifiers (other than random class names). If you target an element that's in a lower floor, there will be a leftover blank remnant space, and I don't consider it as a proper result... :D

The whole DOM tree for that freaking rightrail ad is just.. huge... :D

kuva

kuva

Imo, the best language neutral version to hide the whole thing with one rule: facebook.com##div[data-pagelet=RightRail] > div:has(a[aria-label][aria-labelledby][rel="nofollow noopener"][role=link][target=_blank][tabindex="0"])

For the time being, as uBO nor Easylist have that rule, I'm going to use this with the Finnish list:

facebook.com#?#div[data-pagelet=RightRail] > div:-abp-has(a[aria-label=Mainostaja])

DandelionSprout commented 2 years ago

I have now spent 40min browsing through my mom's Facebook timeline, and I somehow saw no sponsored posts at all despite scrolling 240 posts down.

So that leads to the following situation:

I'll actually have to be a bit harsh for this one time's sake, and declare this a closed and mostly-resolved case (Comments will remain open). The ball is now on the court of whoever who wish to forward their successful reproductions to https://github.com/uBlockOrigin/uAssets/issues/3367

peace2000 commented 2 years ago

@DandelionSprout Very strange that you didn't see any sponsored posts. It seems that Facebook sometimes shows ads and sometimes not. I see sponsored posts all the time.

But yeah, I understand your position. This issue report was mostly about adding Nordic specific filters. I'll see if EL will accept my rule.