您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
This userscript extracts text content from story scenes in Granblue Fantasy and copies it to the clipboard. It monitors changes in the story interface and triggers text extraction when all dialogue or narration becomes visible.
当前为
// ==UserScript== // @name Granblue Fantasy scene text Extractor // @namespace Tampermonkey Scripts // @match *://game.granbluefantasy.jp/* // @match *://gbf.game.mbga.jp/* // @grant GM_log // @grant GM_setClipboard // @version 1.0 // @author MEE // @description This userscript extracts text content from story scenes in Granblue Fantasy and copies it to the clipboard. It monitors changes in the story interface and triggers text extraction when all dialogue or narration becomes visible. // ==/UserScript== (function() { 'use strict'; // Function to copy text to clipboard function copyToClipboard(text) { GM_setClipboard(text); GM_log("Text copied to clipboard:", text); } // Function to extract text content from the specific block function extractText() { var messageBlock = document.querySelector('.prt-message-area .txt-message'); if (messageBlock) { var textContent = messageBlock.textContent.trim(); copyToClipboard(textContent); } } // Function to be called after DOMContentLoaded event function main() { GM_log('Page loaded, initializing observer...'); var style = document.querySelector('.ico-cursor-talk').style.display; extractText(); const targetNode = document.querySelector('.ico-cursor-talk'); const config = { attributes: true, attributeFilter: ['style'] }; var callback = function(mutationsList, observer) { for(var mutation of mutationsList) { const currentStyle = document.querySelector('.ico-cursor-talk').style.display; if (currentStyle === 'block') { extractText(); } } }; // Create a new observer const observer = new MutationObserver(callback); // Start observing changes in the message block if (targetNode) { observer.observe(targetNode, config); } } window.addEventListener('load', main); })();