SQLのテーブルにあるゲームIDをリンク化(ページ遷移後も対応)
// ==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 });
})();