// ==UserScript== // @name Twitter L's // @namespace http://tampermonkey.net/ // @version 0.1 // @description Replace Twitter Verified badge with a fat L // @author You // @match https://twitter.com/* // @icon // @grant none // ==/UserScript== /** * @param {String} HTML representing a single element * @return {Element} */ function htmlToElement(html) { var template = document.createElement('template'); html = html.trim(); // Never return a text node of whitespace as the result template.innerHTML = html; return template.content.firstChild; } function check(changes, observer) { var list = document.querySelectorAll('[aria-label="Verified account"]'); for (var badge of list) { var altText = htmlToElement("L"); badge.parentNode.replaceChild(altText, badge); } var xpath = "//span[contains(text(),'subscribed to Twitter Blue')]"; var matchingElement = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; if (matchingElement) { matchingElement.innerText = 'This account takes a fat L because they paid for Twitter Blue.'; xpath = "//span[contains(text(),'Verified account')]"; matchingElement = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; if (matchingElement) { matchingElement.innerText = 'Verified L'; } } } (function() { 'use strict'; (new MutationObserver(check)).observe(document, {childList: true, subtree: true}); })();