Tradingview Chatroom Premium

Modify the "P" to pro/pro+/premium according to the title

// ==UserScript==
// @name         Tradingview Chatroom Premium
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Modify the "P" to pro/pro+/premium according to the title
// @author       Simonfoobar
// @match        https://*.tradingview.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    function modifyP() {
        // Find all "a" elements with a title attribute
        var aElems = document.querySelectorAll('a[title]');
        aElems.forEach(function(aElem) {
            // Check if the title is "Premium", "Pro" or "Pro+"
            var title = aElem.title;
            if (title === 'Premium' || title === 'Pro' || title === 'Pro+') {
                // Find the span inside this "a" element
                var spanElem = aElem.querySelector('span');
                // Change the text of the span to the value of the title
                if (spanElem) {
                    spanElem.textContent = title;
                }
            }
        });
    }

    // Run the function every time the page loads or changes
    modifyP();
    var observer = new MutationObserver(modifyP);
    observer.observe(document.body, { childList: true, subtree: true });
})();