copy

开源破解一些网站的禁止复制,免登录(不可用)/vip复制

  1. // ==UserScript==
  2. // @name copy
  3. // @namespace http://quhou.top/
  4. // @version 2024-11-04/1
  5. // @description 开源破解一些网站的禁止复制,免登录(不可用)/vip复制
  6. // @author xygodcyx
  7. // @match https://blog.csdn.net/*/article/details/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=csdn.net
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15. if (!navigator || !navigator.clipboard) {
  16. console.warn("对不起,您的浏览器不支持破解复制,请更换新版的浏览器。------来自 破解禁止复制 插件")
  17. return
  18. }
  19.  
  20. let copyBtn = document.createElement("button")
  21. let x = 0
  22. let y = 0
  23.  
  24. window.addEventListener("mouseup", function () {
  25. if (selectText) {
  26. showCopyBtn()
  27. }
  28. })
  29. window.addEventListener("mousemove", function (e) {
  30. x = e.clientX
  31. y = e.clientY
  32. })
  33. window.addEventListener("mousedown", function (e) {
  34. const target = e.target
  35. if (target !== copyBtn) {
  36. hideCopyBtn()
  37. }
  38. })
  39.  
  40. function showCopyBtn(e) {
  41. copyBtn.style.left = x + 30 + "px"
  42. copyBtn.style.top = y - 30 + "px"
  43. copyBtn.style.visibility = "visible"
  44. }
  45.  
  46. function hideCopyBtn() {
  47. copyBtn.style.visibility = "hidden"
  48. }
  49.  
  50. // Your code here...
  51. window.addEventListener("load", function (e) {
  52. copyBtn.style.padding = "5px"
  53. copyBtn.style.fontSize = "22px"
  54. copyBtn.style.color = "#000"
  55. copyBtn.style.backgroundColor = "#F5F5F5"
  56. copyBtn.style.border = "0"
  57. copyBtn.textContent = "复制"
  58. copyBtn.style.position = "fixed"
  59. copyBtn.style.zIndex = "99999999"
  60. copyBtn.style.cursor = "pointer"
  61. copyBtn.addEventListener("click", function () {
  62. hideCopyBtn()
  63. setCopyText()
  64. })
  65. hideCopyBtn()
  66. document.body.append(copyBtn)
  67. })
  68.  
  69. let selectText = ""
  70. document.addEventListener("selectionchange", function (e) {
  71. selectText = document.getSelection().toString().trim()
  72. if (selectText === "") return
  73. })
  74. document.addEventListener("selectstart", function () {
  75. })
  76. document.addEventListener("select", function () {
  77. })
  78.  
  79. function setCopyText() {
  80. navigator.clipboard.writeText(selectText).then(res => {
  81. showSuccess()
  82. }).catch(() => {
  83. showError()
  84. }).finally(()=>{
  85. selectText = ""
  86. })
  87. }
  88.  
  89. function showSuccess() {
  90. showText("#B2F2BB", "复制成功")
  91. }
  92.  
  93. function showError() {
  94. showText("#FFABAB", "复制失败")
  95. }
  96.  
  97. /**
  98. * @param {string} bg
  99. * @param {string} text
  100. * */
  101. function showText(bg, text) {
  102. const textDom = document.createElement("p")
  103. textDom.style.padding = "5px"
  104. textDom.style.fontSize = "16px"
  105. textDom.textContent = text
  106. textDom.style.color = "#FFF"
  107. textDom.style.position = "fixed"
  108. textDom.style.left = x + "px"
  109. textDom.style.top = y + "px"
  110. textDom.style.backgroundColor = bg
  111. textDom.style.zIndex = "99999999"
  112. document.body.append(textDom)
  113.  
  114. const interval = setInterval(() => {
  115. let y = textDom.style.top.slice(0, -2)
  116. y -= 2
  117. textDom.style.top = y + "px"
  118. }, 16)
  119. const timeout = setTimeout(() => {
  120. textDom.remove()
  121. clearInterval(interval)
  122. clearTimeout(timeout)
  123. }, 16 * 40)
  124. }
  125. })();

QingJ © 2025

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