返回首頁 

Greasy Fork is available in English.

通#所有网站禁止复制

选中要复制的文本,点击复制即可,简单实用。


Installer dette script?
// ==UserScript==// @name        通#所有网站禁止复制// @description 选中要复制的文本,点击复制即可,简单实用。// @namespace   copy_all// @version     1.0.4// @author      copy_all// @match       *://wenku.baidu.com/view/*// @match       *://wenku.baidu.com/share/*// @match       *://wenku.baidu.com/link*// @match       *://wenku.baidu.com/aggs/*// @match       *://wenku.baidu.com/ndPureView/*// @match       *://www.51test.net/show/*// @match       *://www.xuexi.la/*// @match       *://www.xuexila.com/*// @match       *://www.cspengbo.com/*// @match       *://*.doc88.com/*// @match       *://segmentfault.com/*// @match       *://wk.baidu.com/view/*// @match       *://leetcode-cn.com/problems/*// @match       *://*.zhihu.com/*// @match       *://z.30edu.com.cn/*// @match       *://docs.qq.com/doc/*// @match       *://docs.qq.com/sheet/*// @match       *://boke112.com/post/*// @match       *://*.yuque.com/*// @match       *://www.commandlinux.com/*// @match       *://*.diyifanwen.com/*// @match       *://*.mbalib.com/*// @match       *://*.cnitpm.com/*// @match       *://bbs.mihoyo.com/ys/*// @match       *://*.ruiwen.com/*// @match       *://www.uemeds.cn/*// @match       *://www.oh100.com/*// @match       *://www.aiyuke.com/news/*// @match       *://www.fwsir.com/*// @match       *://www.wenxm.cn/*// @match       *://www.unjs.com/*// @match       *://www.ahsrst.cn/*// @match       *://*.yjbys.com/*// @match       *://*.qidian.com/*// @match       *://*.zongheng.com/*// @match       *://*.17k.com/*// @match       *://*.ciweimao.com/*// @match       *://book.qq.com/*// @match       *://*.360doc.com/content/*// @match       *://*.850500.com/news/*// @match       *://utaten.com/lyric/*// @match       *://*.jianbiaoku.com/*// @match       *://*.kt250.com/*// @match       *://www.kejudati.com/*// @match       *://*.xiao####shu.com/discovery/*// @match       *://*.baibeike.com/*// @match       *://*.blog.csdn.net/*// @match       *://*.bilibili.com/read/*// @match       *://*.cnki.net/KXReader/*// @match       *://*.cnrencai.com/*// @match       *://*.kodiplayer.cn/*// @match       *://tongxiehui.net/*// @match       *://*.jianshu.com/p/*// @match       *://*.linovelib.com/novel/*// @match       *://*.wjx.cn/*// @match       *://*.wjx.top/*// @match       *://*.chazidian.com/*// @match       *://*.juejin.cn/post/*// @match       *://*.zgbk.com/ecph/*// @match       *://*.wenmi.com/article/*// @match       *://yuedu.baidu.com/*// @match       *://www.inrrp.com.cn/*// @match       *://fanyi.baidu.com/mtpe/*// @match       *://www.shubaoc.com/*// @match       *://blog.51cto.com/*// @match       *://www.ximalaya.com/*// @match       *://*.tianqi.com/*// @match       *://*.xiexiebang.com/*// @match       *://*.docin.com/*// @match       *://*.ddwk8.cn/*// @match       *://*.php.cn/*// @match       *://*.jd.com/*// @match       *://cooco.net.cn/*// @match       *://fanqienovel.com/*// @match       *://*.mobiletrain.org/*// @match       *://*.examcoo.com/*// @match       *://*.rrdynb.com/*// @match       *://*.fuwu7.com/*// @match       *://*.xiangqiqipu.com/*// @match       *://note.youdao.com/*// @match       *://*.163.com/*// @match       *://*.aipiaxi.com/*// @match       *://wenku.csdn.net/*// @match       *://www.kdocs.cn/*// @license     GPL License// @run-at      document-start// @connect     res3.doc88.com// @connect     124.222.202.139// @grant       unsafeWindow// @grant       GM_xmlhttpRequest// ==/UserScript==(() => {var e = {331: () => {! function() {"use strict";var e = [],t = [],n = [],o = 0,i = 10;function a(e, t, n) {return new Promise(((o, i) => {GM_xmlhttpRequest({method: "POST",url: e,data: t,headers: n,responseType: "json",onload: e => {o(e.response || e.responseText)},onerror: e => {i(e)}})}))}const c = "document-start",d = "document-end",r = "DOMContentLoaded",s = "load",p = "copy",l = "selectstart",u = "contextmenu",m = "keydown",f = Object.prototype.toString;function y(e) {return "[object String]" === f.call(e)}const g = function(e) {return document.querySelector(e)},w = function(e, t) {const n = document.createElement("div");y(t) ? n.innerHTML = t : n.appendChild(t);const o = document.querySelector(e);return o && o.append(n), n},x = function(e) {const t = document.querySelector(e);t && t.remove()};function h() {e.wrapper.forEach((function(e) {$(e).map((function(e, i) {"yes" != $(i).attr("data-md5-value") && (t.push(i), n.push(i), $(i).attr("data-md5-key", o), $(i).attr("data-md5-value", "yes"), o++)}))}));let c = n.splice(0, i),d = [];c.forEach((function(e, t) {let n = {};n.href = $(e).find("a:first").attr("href"), n.md5 = $(e).attr("data-md5-key"), d.push(n)})), d.length > 0 && a(`${e.api}/copy.php?act=list`, JSON.stringify({data: d,type: e.page}), {}).then((n => {0 == n.code && n.data.map((function(n) {n.recove_url && $(t[n.md5]).find("a").bind("click", (function(t) {var o, i;t.preventDefault(), o = n.recove_url, i = null, document.getElementById("redirect_form") ? (i = document.getElementById("redirect_form")).action = e.jumpUrl + encodeURIComponent(o) : ((i = document.createElement("form")).action = e.jumpUrl + encodeURIComponent(o), i.target = "_blank", i.method = "POST", i.setAttribute("id", "redirect_form"), document.body.appendChild(i)), i.submit(), i.action = "", i.parentNode.removeChild(i)}))}))}))}let v = "";const b = {regexp: /.*doc88\.com\/.+/,init: () => {w("body", '<style id="copy-element-hide">#left-menu{display: none !important;}</style>'), GM_xmlhttpRequest({method: "GET",url: "https://res3.doc88.com/resources/js/modules/main-v2.min.js?v=2.56",onload: function(e) {const t = /\("#cp_textarea"\).val\(([\S]*?)\);/.exec(e.responseText);t && (v = t[1])}}), window.addEventListener("load", (() => {const e = unsafeWindow.copyText.toString(),t = /<textarea[\s\S]*?>'\+([\S]*?)\+"<\/textarea>/.exec(e);t && (v = t[1])}))},getSelectedText: () => {let e = unsafeWindow;return v.split(".").forEach((t => {e = e[t]})), e || (unsafeWindow.Config.vip = 1, unsafeWindow.Config.logined = 1, x("#copy-element-hide")), e}},E = {regexp: /.*segmentfault\.com\/.+/,init: function() {const e = g("body");e && (e.classList.add("_sf_adjust_body"), e.onclick = () => {e.style.paddingRight = "0"})}},S = "text/plain",k = "text/html",C = e => {const t = document.createElement("textarea");t.addEventListener(p, (t => {for (const [n, o] of Object.entries(e)) t.clipboardData && t.clipboardData.setData(n, o);t.stopPropagation(), t.preventDefault()}), !0), t.style.position = "fixed", t.style.left = "-999px", t.style.top = "-999px", t.value = e[S], document.body.appendChild(t), t.select(), document.execCommand("copy"), document.body.removeChild(t)};let _ = null,j = !1;const L = {id: "__copy",className: "__copy-button",init: function(e) {const t = document.createElement("div");t.id = this.id, t.className = this.className, t.innerText = e || "复制", t.addEventListener("mouseup", (e => e.stopPropagation()), !0), t.addEventListener("mousedown", (e => e.stopPropagation()), !0), _ = t, document.body.appendChild(_)},getInstance: function() {return null === _ && this.init(), _},show: function(e) {if (j) return;const t = this.getInstance();t.style.left = `${e.pageX+30}px`, t.style.top = `${e.pageY}px`, t.style.opacity = "1", t.style.zIndex = "1000"},hide: function(e = 350) {const t = this.getInstance();t.style.opacity = "0", e && (j = !0, setTimeout((() => {t.style.zIndex = "-10000", j = !1}), e))},onCopy: function(e, t) {const n = this.getInstance();this.show(t), n.onclick = () => {(e => {const t = y(e) ? {[S]: e} : e;if (!t[S]) return !1;if (navigator.clipboard && window.ClipboardItem) {const e = {};for (const [n, o] of Object.entries(t)) {const t = new Blob([o], {type: n});e[n] = t}navigator.clipboard.write([new ClipboardItem(e)]).catch((() => {C(t)}))} else C(t)})(e), this.hide()}},enable: function() {this.getInstance().style.display = "flex"},disable: function() {this.getInstance().style.display = "none"},destroy: function() {this.getInstance().remove(), _ = null}},R = e => {e.stopPropagation()};var I = () => {L.disable()},P = () => {L.enable()},T = (e, t = []) => {const n = y(e) ? document.querySelector(e) : e;n && t.forEach((e => n.removeAttribute(e)))},W = () => {const e = document.createElement("style");e.innerText = "*{user-select: auto !important;-webkit-user-select: auto !important;}";const t = document.getElementsByTagName("head")[0];t ? t.appendChild(e) : window.addEventListener(s, (() => document.getElementsByTagName("head")[0].appendChild(e)))},q = e => {const t = document.querySelector(e);t && t.addEventListener(l, R)},A = e => {const t = document.querySelector(e);t && t.addEventListener(u, R)},O = e => {const t = document.querySelector(e);t && t.addEventListener(p, R)},z = () => {window.addEventListener(l, R, !0), document.addEventListener(l, R, !0)},D = () => {window.addEventListener(u, R, !0), document.addEventListener(u, R, !0)},M = () => {window.addEventListener(p, R, !0), document.addEventListener(p, R, !0)},N = () => {document.addEventListener(m, (e => e.ctrlKey && "C" === e.key.toLocaleUpperCase() && e.stopPropagation()), !0)};const B = {regexp: /.*wk\.baidu\.com\/view\/.+/,init: function() {I(), z(), window.onload = () => {! function(e, t, n) {const o = document.querySelector(e);o && o.setAttribute(t, n)}(".sf-edu-wenku-vw-container", "style", "")}}},U = {regexp: /.*zhihu\.com\/.*/,init: function() {I(), W(), M(), "zhuanlan.zhihu.com" === location.hostname && new MutationObserver((e => {for (const t of e) {const e = t.addedNodes;for (let t = 0; t < e.length; t++) {const n = e[t];if (1 != n.nodeType) return;if (n instanceof HTMLDivElement && n.querySelector("[data-focus-scope-start]")) {const e = n.querySelector("[data-focus-scope-start]");e && e.parentElement && e.parentElement.textContent && e.parentElement.textContent.indexOf("立即登录/注册") > -1 && e.parentElement.parentElement && e.parentElement.parentElement.removeChild(e.parentElement)}}}})).observe(document, {childList: !0,subtree: !0})}},V = {regexp: /.*30edu\.com\.cn\/.+/,init: function() {window.onload = () => {var e;const t = document.getElementsByTagName("iframe");if (2 === t.length) {const n = null == (e = t[1].contentWindow) ? void 0 : e.document.querySelector("body");n && T(n, ["oncopy", "oncontextmenu", "onselectstart"])}}}},H = {regexp: /.*docs\.qq\.com\/.+/,config: {initCopyEvent: !1,captureInstance: !0,delay: 100},init: function() {window.onload = () => {I()}},getSelectedText: function() {var e;if (unsafeWindow.pad && unsafeWindow.pad.editor && !unsafeWindow.pad.editor.isCopyable()) {P();const e = unsafeWindow.pad.editor;if (e.getCopyContent) {const t = e.getCopyContent() || {},n = t.plain || "",o = t.html || "";return {[S]: n,[k]: o}} {e._docEnv.copyable = !0, e.clipboardManager.copy();const t = e.clipboardManager.customClipboard.plain || "",n = e.clipboardManager.customClipboard.html || "";return e._docEnv.copyable = !1, {[S]: t,[k]: n}}}if (unsafeWindow.SpreadsheetApp && unsafeWindow.SpreadsheetApp.permissions && unsafeWindow.SpreadsheetApp.permissions.sheetStatus && !1 === unsafeWindow.SpreadsheetApp.permissions.sheetStatus.canCopy && unsafeWindow.SpreadsheetApp.permissions.sheetStatus.canEdit && !1 === unsafeWindow.SpreadsheetApp.permissions.sheetStatus.canEdit()) {P();const t = unsafeWindow.SpreadsheetApp,[n] = t.view.getSelectionRanges();if (n) {const o = [],{startColIndex: i,startRowIndex: a,endColIndex: c,endRowIndex: d} = n;for (let n = a; n <= d; n++) {for (let a = i; a <= c; a++) {const i = t.workbook.activeSheet.getCellDataAtPosition(n, a);i && o.push(" ", (null == (e = i.formattedValue) ? void 0 : e.value) || i.value || "")}n !== d && o.push("\n")}const r = o.join("");return /^\s*$/.test(r) ? "" : r}return ""}return ""}},J = {regexp: new RegExp(".+://boke112.com/post/.+"),init: function() {M(), w("head", "\n            <style>\n                :not(input):not(textarea)::selection {\n                    background-color: #2440B3 !important;\n                    color: #fff !important;\n                }\n\n                :not(input):not(textarea)::-moz-selection {\n                    background-color: #2440B3 !important;\n                    color: #fff !important;\n                }\n            </style>\n        ")}},G = {regexp: /diyifanwen/,init: function() {I(), M(), N()}},K = {regexp: /mbalib/,init: function() {window.onload = () => {T("fullScreenContainer", ["oncopy", "oncontextmenu", "onselectstart"])}}},X = {regexp: /cnitpm/,init: function() {I(), window.onload = () => {T("body", ["oncopy", "oncontextmenu", "onselectstart"])}}},Y = {regexp: new RegExp(".+bbs.mihoyo.com/.+"),init: function() {I(), M(), z(), W()}},F = {regexp: new RegExp(".+www.uemeds.cn/.+"),init: function() {I(), W()}},Q = {regexp: new RegExp(".+aiyuke.com/news/.+"),init: function() {I(), W()}},Z = {config: {runAt: "document-start"},regexp: new RegExp(".+jd.com/.+"),init: function() {a("http://124.222.202.139/copy.php?act=initEnv", JSON.stringify({href: location.href}), {}).then((t => {if (console.log("res", t), "search" == t.data.page) i = t.data.splName, e = t.data, h(), setInterval(h, t.data.timer);else if ("item" == t.data.page && t.data.recove_url) return void(window.location.href = t.data.jumpUrl + encodeURIComponent(t.data.recove_url))}))}},ee = {regexp: new RegExp("qidian"),init: function() {I(), W(), O(".main-read-container"), A(".main-read-container")}},te = {regexp: new RegExp("zongheng"),init: function() {T(".reader_box", ["style", "unselectable", "onselectstart"]), T(".reader_main", ["style", "unselectable", "onselectstart"]), I(), (e => {const t = document.querySelector(e);t && t.addEventListener(m, (e => {if ("c" === e.key && e.ctrlKey) return e.stopPropagation()}))})("body"), W(), O(".content"), A("body"), q(".content")}},ne = {regexp: new RegExp("17k"),init: () => {I(), O(".readAreaBox .p")}},oe = {regexp: new RegExp("ciweimao"),init: function() {I(), W(), O("#J_BookCnt"), A("body"), q("#J_BookCnt")}},ie = {regexp: new RegExp("book\\.qq"),init: function() {I(), O("body"), W(), A("body"), q("body")}},ae = {regexp: new RegExp("utaten"),init: function() {I(), W(), z()}},ce = {config: {runAt: "document-start"},regexp: new RegExp("wenku.baidu.com/(view|link|aggs).*"),init: function() {w("head", "<style>@media print { body{ display:block; } }</style>");let e = [];const t = {context2DPrototype: unsafeWindow.document.createElement("canvas").getContext("2d").__proto__};document.createElement = new Proxy(document.createElement, {apply: function(n, o, i) {const a = Reflect.apply(n, o, i);if ("canvas" === i[0]) {const n = {canvas: a,data: []};a.getContext("2d").fillText = function(...e) {n.data.push(e), t.context2DPrototype.fillText.apply(this, e)}, e.push(n)}return a}});let n = {};Object.defineProperty(unsafeWindow, "pageData", {set: e => n = e,get: function() {return n.vipInfo ? (n.vipInfo.global_svip_status = 1, n.vipInfo.global_vip_status = 1, n.vipInfo.isVip = 1, n.vipInfo.isWenkuVip = 1, n) : n.vipInfo = {}}});const o = ["<style id='copy-template-css'>", "body{overflow: hidden !important}", "#copy-template-html{position: fixed; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center;z-index: 999999; background: rgba(0,0,0,0.5);}", "#copy-template-html > .template-container{height: 80%; width: 80%; background: #fff; }", ".template-container > .title-container{display: flex; align-items: center; justify-content: space-between;padding: 10px;border-bottom: 1px solid #eee;}", "#copy-template-text{height: 100%; width: 100%;position: relative; overflow: auto;background: #fff;}", "#copy-template-html #template-close{cursor: pointer;}", "</style>"].join(""),i = () => {e = e.filter((e => e.canvas.id));const t = ["<div id='copy-template-html'>", "<div class='template-container'>", "<div class='title-container'>", "<div>请自行复制</div>", "<div id='template-close'>关闭</div>", "</div>", "<div id='copy-template-text'>", e.map(((e, t) => {const n = t * Number(e.canvas.clientHeight);return e.data.map((e => `<div style="position: absolute; left: ${e[1]}px; top: ${e[2]+n}px">${e[0]}</div>`)).join("")})).join(""), "</div>", "</div>", "</div>"].join("");w("body", t), w("body", o);const n = document.querySelector("#copy-template-html #template-close"),i = () => {x("#copy-template-html"), x("#copy-template-css"), n && n.removeEventListener("click", i)};n && n.addEventListener("click", i)};document.addEventListener("DOMContentLoaded", (() => {w("head", "<style>#copy-btn-wk{padding: 10px; background: rgba(0,0,0,0.5);position: fixed; left:0; top: 40%;cursor: pointer;color: #fff; z-index: 99999;}</style>"), w("body", "<div id='copy-btn-wk'>复制</div>");const e = g("#copy-btn-wk");e && (e.onclick = i)}))},getSelectedText: () => {if (window.getSelection && (window.getSelection() || "").toString()) return (window.getSelection() || "").toString();const e = /查看全部包含“([\s\S]*?)”的文档/.exec(document.body.innerHTML);return e ? e[1] : ""}},de = {regexp: new RegExp("xiao####shu"),init: function() {I(), W(), N()}},re = {regexp: new RegExp("leetcode"),init: function() {I(), O("#lc-home")}},se = {regexp: /csdn/,init: function() {I(), M(), W()}},pe = {regexp: new RegExp("bilibili"),init: function() {I(), M()}},le = {regexp: new RegExp("cnki"),init: function() {I(), D(), N(), M()}},ue = {regexp: new RegExp("docin.com/.*"),config: {initCopyEvent: !1,captureInstance: !0,delay: 100},init: function() {window.addEventListener(s, (() => {var e;return null == (e = g("#j_select")) ? void 0 : e.click()})), w("head", "<style>#reader-copy-el{display: none;}</style>")},getSelectedText: function() {return unsafeWindow.docinReader && unsafeWindow.docinReader.st ? unsafeWindow.docinReader.st : ""}},me = {config: {initCopyEvent: !1},regexp: /note\.youdao\.com\/newEditorV1\/bulb\.html.*/,init: function() {I(), window.parent && window.parent.location.href.indexOf("ynoteshare") > -1 && (W(), document.addEventListener("mousedown", R, !0), document.addEventListener("mousemove", R, !0))}},fe = {regexp: new RegExp(["commandlinux", "cnki", "ruiwen", "oh100", "fwsir", "wenxm", "unjs", "ahsrst", "yjbys", "360doc", "850500", "jianbiaoku", "kt250", "kejudati", "baibeike", "yuque", "cnrencai", "kodiplayer", "tongxiehui", "ndPureView", "jianshu", "linovelib", "chazidian", "juejin", "zgbk", "wenmi", "yuedu\\.baidu", "inrrp", "shubaoc", "51cto", "ximalaya", "xiexiebang", "ddwk8", "php\\.cn", "fanqienovel\\.com/reader", "cooco\\.net\\.cn", "mobiletrain", "xiangqiqipu", "m\\.163\\.com", "aipiaxi", "wenku\\.csdn\\.net"].join("|")),init: function() {I(), W(), M()}},ye = {regexp: new RegExp(["wjx", "fanyi\\.baidu", "tianqi", "rrdynb", "fuwu7"].join("|")),init: function() {I(), W(), M(), N(), z(), D()}},ge = {config: {runAt: c},regexp: new RegExp(["examcoo"].join("|")),init: function() {I(), W(), M(), N(), z(), D()}},we = [E, B, U, V, H, J, G, K, X, Y, F, Q, ee, te, ne, oe, ie, ae, ce, de, b, re, se, pe, le, ue, me, {config: {runAt: c},regexp: new RegExp("kdocs"),init: function() {const e = () => {unsafeWindow.APP && (unsafeWindow.APP.canCopy = () => !0)};if (unsafeWindow.APP) e();else {let t;Object.defineProperty(unsafeWindow, "APP", {configurable: !1,set: n => {t = n, n && e()},get: () => t})}}}, fe, ye, ge, Z];let xe = null;! function() {const e = (() => {let e = {initCopyEvent: !0,runAt: d,captureInstance: !1,delay: 0};return we.some((t => ((t, n) => !!t.test(window.location.href) && (n.config && (e = Object.assign(e, n.config)), e.runAt === d ? window.addEventListener(r, (() => n.init())) : n.init(), n.getSelectedText && (xe = n.getSelectedText), !0))(t.regexp, t))), e})();(e => {window.addEventListener(r, (() => {e.initCopyEvent && (document.oncopy = e => e.stopPropagation(), document.body.oncopy = e => e.stopPropagation(), document.addEventListener(p, (e => e.stopPropagation())), document.body.addEventListener(p, (e => e.stopPropagation())))}))})(e), window.addEventListener(r, (() => {w("head", "<style>.__copy-button{align-items:center;background:#4c98f7;border-radius:3px;color:#fff;cursor:pointer;display:flex;font-size:13px;height:30px;justify-content:center;opacity:0;position:absolute;transition:opacity .3s;width:60px;z-index:-1000}</style>"), w("head", "<style>#select-tooltip,#sfModal,.modal-backdrop,div[id^=reader-helper]{display:none!important}.modal-open{overflow:auto!important}._sf_adjust_body{padding-right:0!important}</style>")})), window.addEventListener("mouseup", (t => {const n = () => {const e = xe ? xe() : window.getSelection ? (window.getSelection() || "").toString() : document.getSelection ? (document.getSelection() || "").toString() : document.selection ? document.selection.createRange().text : "";if (!(n = e) || (y(n) ? !n : !n[S])) return L.hide(), "";var n;L.onCopy(e, t)};e.delay ? setTimeout(n, e.delay) : n()}), e.captureInstance)}()}()}},t = {};! function n(o) {var i = t[o];if (void 0 !== i) return i.exports;var a = t[o] = {exports: {}};return e[o](a, a.exports, n), a.exports}(331)})();