Last active
December 12, 2019 19:22
-
-
Save lyatziv/06974a66f8402403be0d8a8298e66d3d to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name Never Mind | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Removes suggested and sponsord posts on scroll! | |
// @author Ofraggle | |
// @match https://www.facebook.com/ | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function neverMind(){ | |
document.querySelectorAll('.userContentWrapper').forEach(function (post, idx) { | |
post.hidden = post.querySelectorAll('[data-content="S"]').length > 1 | |
}); | |
} | |
function throttle(fn, wait) { | |
var time = Date.now(); | |
return function() { | |
if ((time + wait - Date.now()) < 0) { | |
fn(); | |
time = Date.now(); | |
} | |
}; | |
} | |
window.addEventListener('scroll', throttle(neverMind, 1000)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment