Skip to content

Instantly share code, notes, and snippets.

@lukethacoder lukethacoder/large.js Secret
Last active Oct 6, 2019

Embed
What would you like to do?
remove all premium/starred articles from Medium
// 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
You can’t perform that action at this time.