Free Copy

支持复制受限网站的文本内容

  1. // ==UserScript==
  2. // @name Free Copy
  3. // @name:CN:zh 自由复制
  4. // @namespace https://github.com/GuoChen-thlg
  5. // @version 0.1.1
  6. // @description 支持复制受限网站的文本内容
  7. // @author THLG
  8. // @supportURL gc.thlg@gmail.com
  9. // @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CK755FJ9PSBZ8
  10. // @contributionAmount 1
  11. // @match *://wenku.baidu.com/*
  12. // @match *://*.360doc.com/*
  13. // @grant none
  14. // @run-at document-end
  15. // ==/UserScript==
  16. (function () {
  17. 'use strict';
  18. function rejectOtherHandlers (e) {
  19. e.stopPropagation()
  20. if (e.stopImmediatePropagation) {
  21. e.stopImmediatePropagation()
  22. }
  23. }
  24. ['cut',
  25. 'copy',
  26. 'keydown',
  27. 'keyup',
  28. ].forEach((event) => {
  29. document.documentElement.addEventListener(event, rejectOtherHandlers, {
  30. capture: true,
  31. })
  32. })
  33. var style = [
  34. "*::before",
  35. "*",
  36. "*::after",
  37. ].join(',') + "{ user-select: initial !important;\n -webkit-user-select: initial !important; }"
  38. var n_style = document.createElement('style')
  39. n_style.innerHTML = style
  40. document.getElementsByTagName('head')[0].appendChild(n_style)
  41. })();