Open arye321 opened 2 years ago
This was not working for me, as it selects the entire div for where all the other posts live as well, I edited your selector to get the parent div the Sponsor post, it got dirty but it does the job, probably someone else can simplify it and integrate it with the extension:
document.querySelectorAll("use").forEach(element=>{
const link = element.getAttribute("xlink:href").substring(1)
if (document.querySelector(`text[id=${link}]`).innerHTML === "Sponsored"){
element.closest('div > div:not([class]) > div[class] > div:not([class]) > div[class]').style.borderStyle = 'solid'
element.closest('div > div:not([class]) > div[class] > div:not([class]) > div[class]').style.borderColor = 'red'
}
})
It manages to highlight just the Sponsored post (remember editing name of the text element depending on your language).
This was not working for me, as it selects the entire div for where all the other posts live as well, I edited your selector to get the parent div the Sponsor post, it got dirty but it does the job, probably someone else can simplify it and integrate it with the extension:
Right, they changed it a couple of days later, you can see my new method here:
https://github.com/arye321/fbab/blob/master/main.js
useElements[len].closest(`div[class=""]`).hidden = true
Hi, I wanted to make a pull request but the code is too complicated for me so I'll suggest code improvement for finding sponsored elemnts
run this in facebook webpage console:
this will mark all current ads in english interface .
the new Sponsor label is inside an SVG with a
<use>
element, inside theuse
element theres ashadow root (closed)
element.you cant extract that so you have to follow the
xlink:href
of theuse
, which is always a#gid(number)
, this leads to a<text>
elementthe
innerHTML
of thetext
element is the text inside the originalhope it helps