您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world! OVER WORLD!
// ==UserScript== // @name Litnet copy text // @namespace http://eldor.besaba.com // @version 0.1 // @description try to take over the world! OVER WORLD! // @author KoctrX // @match https://litnet.com/* // @grant none // ==/UserScript== getTextPage = () => { let text = ''; let title = null; b = document.getElementsByClassName('reader-text')[0].children; for(let a of b) { if(a.tagName.toLowerCase() === 'p' && a.innerHTML) { text+=`<p>${a.innerHTML}</p>`; } if(a.tagName.toLowerCase() === 'h2') { title = a.innerHTML; } } return openWindow(text? text : getTextInDiv(b), title); }; openWindow = (text, title) => { let html = `<h2>${title? title: ''}</h2>${text}`; window.open('','','width=800, height=500') .document.write(html); }; getTextInDiv = (elements) => { let text = ''; for(let el of elements) { if(el.tagName.toLowerCase() === 'div' && !el.getAttribute('class')) { text += `<p>${el.children[0].innerHTML.replace(/(<span).*?(span>)/g, '')}</p>`; } } return text; }; function createElement() { let d = document.getElementsByClassName('topbar-nav')[0], li = document.createElement('li'), a = document.createElement('a'); a.innerHTML = 'Copy Text'; a.setAttribute('href', '#'); a.setAttribute('onclick', 'getTextPage();'); li.appendChild(a); d.appendChild(li); } (function(){ createElement(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址