Facebook Block Sponsored Section in Messenger

Removes the section titled "Sponsored" on the right side of Facebook in the messenger area

נכון ליום 26-02-2021. ראה הגרסה האחרונה.

// ==UserScript==
// @name         Facebook Block Sponsored Section in Messenger
// @version      0.1
// @description  Removes the section titled "Sponsored" on the right side of Facebook in the messenger area
// @author       asheroto
// @match        https://www.facebook.com/
// @namespace https://greasyfork.org/users/324776
// ==/UserScript==

(function () {
	var xpath = function (xpathToExecute) {
		var result = [];
		var nodesSnapshot = document.evaluate(xpathToExecute, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
		for (var i = 0; i < nodesSnapshot.snapshotLength; i++) {
			result.push(nodesSnapshot.snapshotItem(i));
		}
		return result;
	};

	var i;
	var thePath = "//div/div[1]/div/div[3]/div/div/div[1]/div[1]/div/div[3]/div/div/div[1]/div/div[1]/span/div";
	for (i = 0; i < 5; i++) {
		// Wait 1 second
		setTimeout(function () {
			// Remove section
			xpath(thePath)[0].children[0].remove();
		}, 1000);
	}
})();