您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
文本选中后点击复制按钮即可复制,主要用于 百度文库 道客巴巴 无忧考网 学习啦 蓬勃范文
当前为
// ==UserScript== // @name 文本选中复制 // @namespace https://github.com/WindrunnerMax/TKScript // @version 1.2 // @description 文本选中后点击复制按钮即可复制,主要用于 百度文库 道客巴巴 无忧考网 学习啦 蓬勃范文 // @author Czy // @include https://wenku.baidu.com/view/* // @include https://www.51test.net/show/* // @include http://www.xuexi.la/* // @include https://www.xuexila.com/* // @include https://www.cspengbo.com/* // @include http://www.doc88.com/* // @license GPL License // @grant unsafeWindow // @require https://cdn.bootcss.com/jquery/2.1.2/jquery.min.js // @require https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js // ==/UserScript== (function() { "use strict"; var $ = window.$; var ClipboardJS = window.ClipboardJS; // https://clipboardjs.com/#example-text function getSelectedText() { if(window.location.host.match(".*doc88.*")) return unsafeWindow.Viewer._0OOO1O; if(window.getSelection) return window.getSelection().toString(); else if(document.getSelection) return document.getSelection(); else if(document.selection) return document.selection.createRange().text; } (function(){ document.addEventListener("mouseup", (e) => { var copyText = getSelectedText(); if(copyText) console.log(copyText) else return ""; $("#_copy").remove(); var template = ` <div id="_copy" style="left:${e.pageX + 30}px;top:${e.pageY}px;" data-clipboard-text="${copyText}">复制</div> `; $("body").append(template); $("#_copy").on("mousedown", (event) => { event.stopPropagation(); }) $("#_copy").on("mouseup", (event) => { event.stopPropagation(); }) new ClipboardJS('#_copy'); }); })(); (function(){ var template = ` <style type="text/css"> #_copy{ width:60px; height:30px; background:#4C98F7; color:#fff; position:absolute; z-index:1000; display:flex; justify-content: center; align-items: center; border-radius: 3px; font-size: 13px; cursor: pointer; } div[id^=reader-helper]{ display: none !important; } </style> `; $("head").prepend(template); ClipboardJS.prototype.on('success', function(e) { $("#_copy").html("复制成功"); setTimeout(() => $("#_copy").fadeOut(1000), 1000); e.clearSelection(); }); ClipboardJS.prototype.on('error', function(e) { $("#_copy").html("复制失败"); setTimeout(() => $("#_copy").fadeOut(1000), 1000); e.clearSelection(); }); $("body").on("mousedown", (e) => { $("#_copy").remove(); }) document.oncopy = () => {} $("body").on("copy", (e) => { e.stopPropagation(); return true; }) })(); })(); /** * https://www.wenku.zone/ * http://wenku.baiduvvv.com/ * https://www.huiyingwu.com/1718/ */
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址