Skip to content

Instantly share code, notes, and snippets.

@lyatziv
Last active December 12, 2019 19:22
Show Gist options
  • Save lyatziv/06974a66f8402403be0d8a8298e66d3d to your computer and use it in GitHub Desktop.
Save lyatziv/06974a66f8402403be0d8a8298e66d3d to your computer and use it in GitHub Desktop.
// ==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