ErogameScape SQL Table Linker

SQLのテーブルにあるゲームIDをリンク化(ページ遷移後も対応)

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         ErogameScape SQL Table Linker
// @namespace    https://erogamescape.dyndns.org/
// @version      1.3
// @description  SQLのテーブルにあるゲームIDをリンク化(ページ遷移後も対応)
// @author       Kdroidwin
// @match        https://erogamescape.dyndns.org/~ap2/ero/toukei_kaiseki/usersql_exec.php?sql_id=*
// @match        https://erogamescape.org/~ap2/ero/toukei_kaiseki/usersql_exec.php?sql_id=*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function linkifyGameIDs() {
        document.querySelectorAll('td').forEach(td => {
            const text = td.textContent.trim();
            const match = text.match(/^\d+$/); // 数字のみのセルを探す
            if (match) {
                const gameId = match[0];
                if (!td.querySelector('a')) { // 既にリンクがない場合のみ処理
                    const link = document.createElement('a');
                    link.href = `https://erogamescape.dyndns.org/~ap2/ero/toukei_kaiseki/game.php?game=${gameId}`;
                    link.textContent = gameId;
                    link.style.color = 'blue'; // 視認しやすいように色を変更
                    link.style.textDecoration = 'underline';
                    td.textContent = '';
                    td.appendChild(link);
                }
                td.id = `game-${gameId}`; // ID を設定
            }
        });
    }

    // 初回実行
    linkifyGameIDs();

    // MutationObserverで動的な変更を監視し、ページ遷移後も適用
    const observer = new MutationObserver(linkifyGameIDs);
    observer.observe(document.body, { childList: true, subtree: true });
})();