// ==UserScript== // @name 搜狗翻译复制 // @namespace vurses // @license Mit // @author layenh // @match https://fanyi.sogou.com/* // @grant none // @version 1.2 // @run-at document-end // @description 2025/5/5 10:24:24 // @downloadURL https://update.greasyfork.icu/scripts/534976/%E6%90%9C%E7%8B%97%E7%BF%BB%E8%AF%91%E5%A4%8D%E5%88%B6.user.js // @updateURL https://update.greasyfork.icu/scripts/534976/%E6%90%9C%E7%8B%97%E7%BF%BB%E8%AF%91%E5%A4%8D%E5%88%B6.meta.js // ==/UserScript== const target = document.querySelector('.output') const observer = new MutationObserver((mutationsList) => { let text = ''; for (const mutation of mutationsList) { if (mutation.type === 'characterData' || mutation.type === 'childList') { text = target.querySelector('p')?.textContent; } } navigator.clipboard.writeText(text) }); observer.observe(target, { characterData: true, childList: true, subtree: true, });