Facebook comments tag cleaner

Deletes Facebook comments someone is tagged in, as these are usually of no interest whatsoever

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Facebook comments tag cleaner
// @namespace    http://mutux.org/
// @version      0.1
// @description  Deletes Facebook comments someone is tagged in, as these are usually of no interest whatsoever
// @author       Joakim
// @match http://*.facebook.com/*
// @match https://*.facebook.com/*
// @grant        none
// ==/UserScript==

do {
	var someRemoved = false;

	comments = document.getElementsByClassName("UFIComment");

	for (var i = 0; i < comments.length; i++) {

		comment = comments[i];
		text = comment.getElementsByClassName("UFICommentBody")[0];

		/* if (text.firstChild.className == "profileLink") { */
		if (text.getElementsByClassName("profileLink").length > 0) {

			comment.parentNode.removeChild(comment);
			someRemoved = true;
		}
	}
} while(someRemoved);