Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. // not just giving you medium content, giving you the largest content
  2. // remove all premium/starred articles from Medium
  3.  
  4. let container = document.querySelector('.js-mainfeed');
  5. let currentPostCount = 0;
  6. let totalRemoved = 0;
  7. const body = document.querySelector('body');
  8. const totalRemovedEl = document.createElement('div');
  9. totalRemovedEl.classList.add('totalRemoved');
  10. body.appendChild(totalRemovedEl);
  11. totalRemovedEl.setAttribute("style", "position: fixed; height: 50px; width: 50px; bottom: 0; right: 0; background-color: #fff; color: rgba(0,0,0,.84); box-shadow: 0px 0px 11px 0px rgba(140,140,140,0.2); display: flex; justify-content: center; align-items: center;");
  12.  
  13. const removeElement = (el) => {
  14. el.remove();
  15. totalRemoved++
  16. totalRemovedEl.innerText = totalRemoved;
  17. }
  18.  
  19. const removeThoseDamnStarPosts = () => {
  20. if (container.childElementCount > currentPostCount) {
  21. let inViewPosts = document.querySelectorAll('.streamItem');
  22. inViewPosts.forEach(el => {
  23. el.querySelector('.svgIcon--star') ? removeElement(el) : console.log('FREE CONTENT - YEEEEW')
  24. });
  25. currentPostCount = container.childElementCount;
  26. }
  27. };
  28.  
  29. window.addEventListener('scroll', removeThoseDamnStarPosts)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement