etaylib / Hide comments with tagged people in Facebook

// ==UserScript==
// @namespace     https://openuserjs.org/users/etaylib
// @name          Hide comments with tagged people in Facebook
// @copyright     2019, etaylib (https://openuserjs.org/users/etaylib)
// @match        https://www.facebook.com/*
// @license       MIT
// @version       0.0.2
// @grant none
// ==/UserScript==

// ==OpenUserJS==
// @author etaylib
// ==/OpenUserJS==

const maxWordsInPostWithTaggedPerson = 3; //not including the tagged name itself
const interval = 200; //ms
setTimeout(()=>{
document.querySelectorAll('.userContentWrapper ._3l3x  a').forEach((link)=>{
if (link.getAttribute('data-hovercard') && link.getAttribute('data-hovercard').includes('/ajax/hovercard/user.php?id=')){
const name = link.innerText;
const words = link.parentNode.parentNode.innerText.replace(name,'').split(/\s+/).filter(word=>{return word.length>0});
 if (words.length <= maxWordsInPostWithTaggedPerson){
	link.closest('li').style.display = 'none';
}
}
})
},interval);