您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Extract AV codes on M-Team and display cover images
// ==UserScript== // @name M-Team AV Cover Display // @namespace http://tampermonkey.net/ // @version 0.4 // @description Extract AV codes on M-Team and display cover images // @author winnie // @match https://*.m-team.cc/browse/adult* // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; /** * Extracts the first AV code from a string. * Matches formats like ABC-123, ABCD-123, etc. * @param {string} text * @returns {string|null} */ function extractFirstAvCode(text) { const avRegex = /([A-Z]{2,5})-(\d{2,5})/; const match = text.match(avRegex); return match ? match[0] : null; } /** * Processes a <span> element to check and insert AV cover image. * @param {HTMLElement} span */ function processSpan(span) { const avCode = extractFirstAvCode(span.textContent); if (!avCode) return; const lowerCode = avCode.toLowerCase(); const img = document.createElement('img'); img.src = `http://fourhoi.com/${lowerCode}/cover-n.jpg`; img.style.maxWidth = '280px'; img.style.marginRight = '5px'; img.style.verticalAlign = 'middle'; img.style.transition = 'transform 0.3s ease'; img.onerror = () => img.remove(); span.parentNode.insertBefore(img, span); } /** * Initializes the script by processing current spans * and observing dynamic DOM changes. */ function initAvCoverDisplay() { const spans = document.querySelectorAll('span[aria-describedby]'); spans.forEach(processSpan); const observer = new MutationObserver(mutations => { for (const mutation of mutations) { for (const node of mutation.addedNodes) { if (node.nodeType === Node.ELEMENT_NODE) { const newSpans = node.querySelectorAll('span[aria-describedby]'); newSpans.forEach(processSpan); } } } }); observer.observe(document.body, { childList: true, subtree: true }); } window.addEventListener('load', initAvCoverDisplay); })();