JavaScript How do I replace all the blocked google ads (with an image) on my page instead of just the first one? Trouble with CSS selectors

I'd like to replace all blocked ads (for users with adblock) with an image politely asking to have the site white-listed.

This code wasn't written by me at all- it's taken from a site that I can't seem to track down again. I'm a little embarrassed to post here, but I've wasted hours on what seems like a simple fix.

    <script> 

  window.onload = function(){ 

    setTimeout(function() { 

      var ad = document.querySelector("ins.adsbygoogle");

      if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {

        ad.style.cssText = 'display:block !important'; 

        ad.innerHTML = '<img src="image here"></img>';

      }

    }, 2000);
  }; 

</script>

I've tried something like this:

var ad = document.querySelectorAll("ins.adsbygoogle");

But it didn't seem to help.

Answer:1

async function test() { const res = await fetch('https://www.easy-mock.com/mock/5c6d317e8d040716434d0a5b/reading/category/homeSmallCategory'); console.log(res) // data return res; } ...

async function test() { const res = await fetch('https://www.easy-mock.com/mock/5c6d317e8d040716434d0a5b/reading/category/homeSmallCategory'); console.log(res) // data return res; } ...

I am using the Google Custom Search in my web page and want to filter the results before displaying the results. I cannot find any callback in Google's documenation where I can access the results so ...

I am using the Google Custom Search in my web page and want to filter the results before displaying the results. I cannot find any callback in Google's documenation where I can access the results so ...

  1. access google search history
  2. access google search console
  3. access google search data
  4. access google search api
  5. access google search box
  6. access my google search history
  7. can't access google search
  8. cannot access google search engine
  9. python access google search
  10. access vba google search
  11. access google voice search
  12. how to access google search settings
  13. how to access google search trends
  14. how to access google search
  15. cbs all access - google search
  16. how to access google search history on ipad
  17. how to access google search results
  18. google access music search history
  19. give access to google search console
  20. grant access to google search console

Is it possible to query firebase for documents in a collection where the number of elements in an array of a particular field is greater than 0 For my example, each document has-a field called '...

Is it possible to query firebase for documents in a collection where the number of elements in an array of a particular field is greater than 0 For my example, each document has-a field called '...

  1. firebase query documents

Introduction Hello, I'm trying to build a counter component for my online store, but I'm having trouble getting with it to function correctly. Problem From my understanding is that the count value ...

Introduction Hello, I'm trying to build a counter component for my online store, but I'm having trouble getting with it to function correctly. Problem From my understanding is that the count value ...

  1. react increment state property