Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement