removeFacebookSuggestedPosts

Remove facebook suggested posts and games

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        removeFacebookSuggestedPosts
// @namespace   DT
// @description Remove facebook suggested posts and games
// @include     https://www.facebook.com/
// @version     2
// @grant       none
// ==/UserScript==

var DT = {};

DT._ticking = false;
DT._unwanted = ['Suggested Post', 'Suggested Game'];

DT.main = function(){
	var spans = document.getElementsByTagName("SPAN");
	var totalSpans = spans.length;
	for(var i = 0; i < totalSpans; i++){
		var item = spans.item(i);
		if(item && DT._unwanted.indexOf(item.textContent) > -1){
			var parent = item.parentNode.parentNode.parentNode.parentNode.parentNode;
			if(parent){
				parent.parentNode.removeChild(parent);
				console.log('Removed suggested post');
			}
		}
	}
};

DT._tick = function(){
	if(!DT._ticking){
		window.setTimeout(function(){
			DT.main();
			DT._ticking = false;
		}, 3000);
	}
	DT._ticking = true;
};

document.addEventListener("DOMContentLoaded", DT._tick);
window.addEventListener('scroll', DT._tick);