您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
펨코 댓글에 달린 이미지 링크를 임베드합니다.
// ==UserScript== // @name Fmkorea 댓글 이미지 삽입 // @namespace // @version 1.1 // @description 펨코 댓글에 달린 이미지 링크를 임베드합니다. // @author 아스마토키다이스키 // @match https://*.fmkorea.com/* // @license MIT // ==/UserScript== function replaceLinksWithImages() { const commentElements = document.querySelectorAll('[id^="comment"]'); commentElements.forEach(commentElement => { const links = commentElement.querySelectorAll('a[href*=".jpg"]:not(:has(img)), \ a[href*=".png"]:not(:has(img)), \ a[href$=".gif"]:not(:has(img)), \ a[href*=".jpeg"]:not(:has(img)), \ a[href*=".webp"]:not(:has(img)), \ a[href*="format=jpg"]:not(:has(img)), \ a[href*="format=jpeg"]:not(:has(img))'); links.forEach(link => { const imageUrl = link.href; const img = document.createElement('img'); img.src = imageUrl; img.alt = link.textContent || 'Embedded image'; if (link.className) { img.className = link.className; } img.style.maxWidth = '100%'; img.style.height = 'auto'; link.parentNode.replaceChild(img, link); }); }); } document.addEventListener('DOMContentLoaded', replaceLinksWithImages); const observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { if (mutation.addedNodes.length) { replaceLinksWithImages(); } }); }); observer.observe(document.body, { childList: true, subtree: true });