I have a tampermonkey script which needs a bug fix.  

// ==UserScript==
// @name         JKForum Highlight Usernames
// @namespace    http://tampermonkey.net/
// @version      2.4
// @description  Highlight usernames from the ratings in thread replies on JKForum when a specified title is present
// @author       Your Name
// @match        https://www.jkforum.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function highlightUsernames() {
        const storedNames = JSON.parse(localStorage.getItem('jkforumUsernames') || '[]');

        if (storedNames.length > 0) {
            const replyNames = document.querySelectorAll('a.name.xi2 span');
            replyNames.forEach(replyName => {
                if (storedNames.includes(replyName.textContent.trim())) {
                    replyName.style.backgroundColor = '#FFFF00'; // Highlight with yellow
                }
            });
        }
    }

    function extractUsernames() {
        const names = [];
        const ratingWindow = document.querySelector('#fwin_viewratings .floatwrap .list');

        if (ratingWindow) {
            ratingWindow.querySelectorAll('tbody tr > td:nth-child(2) a').forEach(nameCell => {
                const username = nameCell.textContent.trim();
                names.push(username);
                console.log('Captured username:', username);
            });
        } else {
            console.log('Rating window or list not found.');
        }

        if (names.length > 0) {
            localStorage.setItem('jkforumUsernames', JSON.stringify(names));
            highlightUsernames();
        } else {
            console.log('No Usernames Captured.');
        }
    }

    function getThreadIdFromUrl() {
        const urlMatches = window.location.href.match(/thread-(\d+)-\d+-\d+\.html/);
        if (urlMatches) {
            return urlMatches[1];
        }
        const urlParams = new URLSearchParams(window.location.search);
        return urlParams.get('tid');
    }

    window.addEventListener('load', function() {
        const maestroFound = localStorage.getItem('maestroFound');

        if (!maestroFound) {
            const maestroElement = document.querySelector('a.name.xi2[title="maestro"]');
            if (maestroElement) {
                localStorage.setItem('maestroFound', true);
                console.log('Maestro found, proceeding to capture usernames.');
            }
        }

        if (localStorage.getItem('maestroFound')) {
            const currentThreadId = getThreadIdFromUrl();
            const storedThreadId = localStorage.getItem('jkforumThreadId');

            if (currentThreadId && currentThreadId !== storedThreadId) {
                const ratingsLink = document.querySelector('a[title="查看全部評分"]');

                if (ratingsLink && window.location.href.includes('thread-')) {
                    ratingsLink.addEventListener('click', function(event) {
                        event.preventDefault();

                        const observer = new MutationObserver((mutations, obs) => {
                            const modal = document.getElementById('fwin_viewratings');
                            if (modal && modal.style.display !== 'none') {
                                obs.disconnect();
                                setTimeout(() => {
                                    extractUsernames();

                                    const closeButton = modal.querySelector('a.flbc[title="關閉"]');
                                    if (closeButton) {
                                        console.log('Attempting to close popup window.');
                                        closeButton.click();
                                    } else {
                                        console.log('Close button not found.');
                                    }
                                }, 500); // Reduce delay to 0.5 seconds
                            }
                        });

                        observer.observe(document.body, { childList: true, subtree: true });

                        if (typeof window.showWindow === 'function') {
                            window.showWindow('viewratings', ratingsLink.href);
                        } else {
                            console.log('showWindow function is not available.');
                        }
                    });

                    ratingsLink.click();
                } else {
                    highlightUsernames();
                }
            } else {
                highlightUsernames();
            }
        }
    });
})();

It seems like the script doesn't check if a.name.xi2 equals to maestro.

This is part the element of where the name maestro is located.

<div class=" u-avatar link0">
<a href="home.php?mod=space&amp;uid=1698412" class="a-img" target="_blank" onmouseover="showauthor(this, 'userinfo168704056')"><span><img src="https://www.mymyuc.net/data/avatar/001/69/84/12_avatar_middle.jpg?ba722014" onerror="this.onerror=null;this.src='https://www.mymyuc.net/images/noavatar_middle.gif'"></span></a>
<a name="newpost"></a> <a class="name xi2" rel="nofollow" target="_blank" href="home.php?mod=space&amp;uid=1698412" title="maestro"><span>maestro</span></a>
<div class="p_pop blk bui card_gender_1" id="userinfo168704056" style="display: none; font-size: 13px; margin-top: -11px;">

It only needs to be check once at the beginning.  Please help!