TampermonkeyでTwitterのタイムラインから「...がフォローしています」を消します。
اعتبارا من
// ==UserScript==
// @name twitter-unrelated-remover
// @namespace twitter-unrelated-remover
// @version 0.1
// @description TampermonkeyでTwitterのタイムラインから「...がフォローしています」を消します。
// @author meguru
// @match https://twitter.com/*
// @match https://mobile.twitter.com/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
(function () {
const config = {
attributes: true,
childList: true,
subtree: true,
}
const unrelatedManIconPath = 'M12.225 12.165c-1.356 0-2.872-.15-3.84-1.256-.814-.93-1.077-2.368-.805-4.392.38-2.826 2.116-4.513 4.646-4.513s4.267 1.687 4.646 4.513c.272 2.024.008 3.46-.806 4.392-.97 1.106-2.485 1.255-3.84 1.255zm5.849 9.85H6.376c-.663 0-1.25-.28-1.65-.786-.422-.534-.576-1.27-.41-1.968.834-3.53 4.086-5.997 7.908-5.997s7.074 2.466 7.91 5.997c.164.698.01 1.434-.412 1.967-.4.505-.985.785-1.648.785z';
const observer = new MutationObserver(function () {
const articles = document.querySelectorAll('[tabindex="0"]');
for (let i = 0; i < articles.length; i++) {
const icons = articles[i].getElementsByTagName('path');
for (let j = 0; j < icons.length; j++) {
if (icons[j].getAttribute('d') === unrelatedManIconPath) {
articles[i].style.display = 'none';
// articles[i].style.backgroundColor = 'red';
}
}
}
})
observer.observe(document.body, config);
})();
})();