-
-
Save lukethacoder/252dce48f21fb4a99e21bc6c3d4fda88 to your computer and use it in GitHub Desktop.
remove all premium/starred articles from Medium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// not just giving you medium content, giving you the largest content | |
// remove all premium/starred articles from Medium | |
let container = document.querySelector('.js-mainfeed'); | |
let currentPostCount = 0; | |
let totalRemoved = 0; | |
const body = document.querySelector('body'); | |
const totalRemovedEl = document.createElement('div'); | |
totalRemovedEl.classList.add('totalRemoved'); | |
body.appendChild(totalRemovedEl); | |
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;"); | |
const removeElement = (el) => { | |
el.remove(); | |
totalRemoved++ | |
totalRemovedEl.innerText = totalRemoved; | |
} | |
const removeThoseDamnStarPosts = () => { | |
if (container.childElementCount > currentPostCount) { | |
let inViewPosts = document.querySelectorAll('.streamItem'); | |
inViewPosts.forEach(el => { | |
el.querySelector('.svgIcon--star') ? removeElement(el) : console.log('FREE CONTENT - YEEEEW') | |
}); | |
currentPostCount = container.childElementCount; | |
} | |
}; | |
window.addEventListener('scroll', removeThoseDamnStarPosts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment