Skip to content

Instantly share code, notes, and snippets.

@lukethacoder
Last active October 6, 2019 06:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukethacoder/252dce48f21fb4a99e21bc6c3d4fda88 to your computer and use it in GitHub Desktop.
Save lukethacoder/252dce48f21fb4a99e21bc6c3d4fda88 to your computer and use it in GitHub Desktop.
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