SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # url encoded:
  2.  
  3. ```javascript
  4. javascript:function%20markAds%28%29%20%7B%0Avar%20adsFound%20%3D%200%3B%0Avar%20nonAdsFound%20%3D%200%3B%0AarticleList%20%3D%20document.querySelectorAll%28%22article%22%29%0AarticleList.forEach%28%0Afunction%28someArticle%29%20%7B%0AsomeArticle.querySelectorAll%28%22span%22%29.forEach%28%0Afunction%28someNode%29%20%7B%0Aif%20%28someNode.textContent.indexOf%28%22Promoted%22%29%20%21%3D%3D%20-1%29%20%7B%0AadsFound%20%2B%3D%201%3B%0Aif%20%28someArticle%20%21%3D%3D%20null%20%26%26%20someArticle.parentNode%29%20%7B%20someArticle.style.background%20%3D%20%22lime%22%20%7D%0A%7D%20else%20%7B%0AnonAdsFound%20%2B%3D%201%3B%0A%7D%0A%7D%29%0A%7D%29%0Aconsole.log%28%22nonAdsFound%3A%20%22%20%2B%20nonAdsFound%20%2B%20%22%2C%20adsFound%3A%20%22%20%2B%20adsFound%29%3B%0A%7D%0AmarkAds%28%29%3B
  5. ```
  6.  
  7. # url decoded & jspretty'd:
  8.  
  9. ```javascript
  10. javascript: function markAds() {
  11.     var adsFound = 0;
  12.     var nonAdsFound = 0;
  13.     articleList = document.querySelectorAll("article")
  14.     articleList.forEach(
  15.         function(someArticle) {
  16.             someArticle.querySelectorAll("span").forEach(
  17.                 function(someNode) {
  18.                     if (someNode.textContent.indexOf("Promoted") !== -1) {
  19.                         adsFound += 1;
  20.                         if (someArticle !== null && someArticle.parentNode) { someArticle.style.background = "lime" }
  21.                     } else {
  22.                         nonAdsFound += 1;
  23.                     }
  24.                 })
  25.         })
  26.     console.log("nonAdsFound: " + nonAdsFound + ", adsFound: " + adsFound);
  27. }
  28. markAds();
  29. ```
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top