1
0
Fork 0
mirror of https://codeberg.org/kwiat/meowad.git synced 2025-04-20 06:54:09 +02:00

fix: images not being replaced until hovered, this time it actually works

This commit is contained in:
Mikołaj KwiatekMiki 2024-12-03 18:10:00 +01:00
parent 04ab0e31f7
commit ba2e3b4b70
No known key found for this signature in database
GPG key ID: FA929409FF1ED9AD

View file

@ -26,10 +26,10 @@ const ignoredAdvertisers = [
function getAds() { function getAds() {
const ads = []; const ads = [];
document.querySelectorAll("article[data-testid=tweet]:not(.meowified)").forEach((tweet) => { document.querySelectorAll("article[data-testid=tweet]").forEach((tweet) => {
// ads.push(tweet); return; // ads.push(tweet); return;
const span = tweet.querySelector("div.r-1kkk96v span.r-bcqeeo.r-1ttztb7.r-qvutc0.r-poiln3"); const span = tweet.querySelector("div.r-1kkk96v span.r-bcqeeo.r-1ttztb7.r-qvutc0.r-poiln3");
if (span && span.innerText === "Ad") { if (span && span.innerText === "Ad" && !span.innerHTML.includes(ad.image)) {
ads.push(tweet); ads.push(tweet);
} }
}); });
@ -38,8 +38,6 @@ function getAds() {
function replaceAds() { function replaceAds() {
getAds().forEach((tweet) => { getAds().forEach((tweet) => {
tweet.classList.add("meowified");
const pfp = tweet.querySelector("[style*=profile_images]"); const pfp = tweet.querySelector("[style*=profile_images]");
const tweetText = tweet.querySelector("[data-testid=tweetText]"); const tweetText = tweet.querySelector("[data-testid=tweetText]");