Highlight Text at GEVI

Highlights "Cock size:" and "Foreskin:" lines of text at gayeroticvideoindex.com/performer/* pages for quick overview if listed

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Highlight Text at GEVI
// @namespace    https://gayeroticvideoindex.com
// @version      1.0
// @description  Highlights "Cock size:" and "Foreskin:" lines of text at gayeroticvideoindex.com/performer/* pages for quick overview if listed
// @author       99X
// @license      MIT
// @match        https://gayeroticvideoindex.com/performer/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';
    
    // Configuration
    const text1 = "Dick Size:";
    const text2 = "Foreskin:";
    const color1 = "green";
    const color2 = "green";

    // Function to highlight text
    function highlightText(searchText, highlightColor) {
        const walker = document.createTreeWalker(
            document.body,
            NodeFilter.SHOW_TEXT,
            null,
            false
        );

        const nodesToReplace = [];
        let node;
        while (node = walker.nextNode()) {
            if (node.nodeValue && node.nodeValue.includes(searchText)) {
                nodesToReplace.push(node);
            }
        }

        nodesToReplace.forEach(node => {
            const text = node.nodeValue;
            const regex = new RegExp(searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g');

            if (regex.test(text)) {
                const span = document.createElement('span');
                span.innerHTML = text.replace(regex, `<mark style="background-color: ${highlightColor};">${searchText}</mark>`);
                node.parentNode.replaceChild(span, node);
            }
        });
    }
    
    // Execute highlighting
    highlightText(text1, color1);
    highlightText(text2, color2);
})();