【图灵】快捷短语快速复制

快捷短语快速复制 页面中悬浮 点击直接复制到剪贴板

  1. // ==UserScript==
  2. // @name 【图灵】快捷短语快速复制
  3. // @namespace tolingsoftkjdy
  4. // @version 3.0
  5. // @description 快捷短语快速复制 页面中悬浮 点击直接复制到剪贴板
  6. // @author Tolingsoft
  7. // @match http://*/*
  8. // @match https://*/*
  9. // @license GPL-3.0-or-later
  10. // @require https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js
  11. // ==/UserScript==
  12.  
  13. (async function () {
  14. 'use strict';
  15.  
  16. // Your code here...
  17. var list = [
  18. ["Email/邮箱", ""],
  19. ["Discord/不和谐ID", ""],
  20. ["twitter/推特ID", "@"],
  21. ["Tg/电报Id", "@"],
  22. ["---------", ""],
  23. ["twitter【不带@】", ""],
  24. ["Tg【不带@】", ""],
  25. ["---------", ""],
  26. ["主要Eth/Bsc【6571】", ""],
  27. ]
  28.  
  29.  
  30. await insertDiv(list);
  31.  
  32. var clipboard = new ClipboardJS('.btn_tolingsoft');
  33.  
  34. clipboard.on('success', function (e) {
  35. console.info('Action:', e.action);
  36. console.info('Text:', e.text);
  37. console.info('Trigger:', e.trigger);
  38. var sdiv = e.trigger;
  39. // sdiv 文字彩色渐变
  40. var color = [
  41. "#04FF00",
  42. "#1BE800",
  43. "#E81700",
  44. "#D12E00",
  45. "#BA4500",
  46. "#8E7500",
  47. "#A55E00",
  48. "#BC4700",
  49. "#D33000",
  50. "#EA1900",
  51. "#32D100",
  52. "#49BA00",
  53. "#60A300",
  54. "#FF0000",
  55. "#30CF00",
  56. "#19E600"];
  57. var i = 0;
  58. var timer = setInterval(function () {
  59. sdiv.style.color = color[i];
  60. i++;
  61. if (i >= color.length) {
  62. clearInterval(timer);
  63. sdiv.style.color = "#04ff00";
  64. }
  65. }, 800 / color.length);
  66.  
  67. e.clearSelection();
  68. console.log("复制成了!自动关闭网页");
  69.  
  70. });
  71.  
  72. clipboard.on('error', function (e) {
  73. console.error('Action:', e.action);
  74. console.error('Trigger:', e.trigger);
  75. });
  76.  
  77.  
  78. })();
  79.  
  80.  
  81. async function insertDiv(list) {
  82. var body = document.querySelector("body");
  83. if (body) {
  84. var zkdiv = document.createElement("div");
  85. zkdiv.style = `
  86. position: fixed;
  87. font-size: 12px;
  88. top: 0px;
  89. right: 0px;
  90. background: white;
  91. z-index: 9999;
  92. margin: 1px;
  93. padding: 3px;
  94. color: rgb(255 255 255);
  95. border: 1px solid rgb(255 255 255);
  96. border-radius: 5px;
  97. cursor: pointer;
  98. line-height: 1;
  99. zoom: 0.8;
  100. opacity: 0.3;`;
  101. zkdiv.innerHTML = `<span style="color: #04ff00;"><b>展开/缩小</b></span>`;
  102. zkdiv.onclick = function () {
  103. var div = document.querySelector(".kjdy");
  104. if (div) {
  105. div.style.display = div.style.display == "none" ? "block" : "none";
  106. }
  107. }
  108. body.appendChild(zkdiv);
  109.  
  110. SetListHtml(body,list);
  111.  
  112.  
  113. } else {
  114. await sleep(1000);
  115. console.log("继续查找");
  116. await insertDiv();
  117. }
  118. }
  119. function SetListHtml(body,list) {
  120. var div = document.querySelector(".kjdy");
  121. if (!div) {
  122. div = document.createElement("div");
  123. div.className = "kjdy";
  124. div.style = `
  125. position: fixed;
  126. font-size: 12px;
  127. top: 22px;
  128. right: 0px;
  129. background: black;
  130. z-index: 9999;
  131. margin: 1px;
  132. padding: 3px;
  133. color: #04ff00;
  134. border: 1px solid #04ff00;
  135. border-radius: 5px;
  136. cursor: move;
  137. line-height: 1.5;
  138. display: none;
  139. `;
  140.  
  141. div.innerHTML = "";
  142. div.innerHTML += "<div class='movediv' style='color:#fff;cursor: move;margin-bottom: 15px;'><b>图灵快捷短语复制</b></div>"
  143.  
  144. for (var i = 0; i < list.length; i++) {
  145. var item = list[i];
  146. var name = item[0];
  147. var value = item[1];
  148. var divitem = document.createElement("div");
  149. divitem.style = "cursor: pointer;color: #04ff00;";
  150. divitem.innerHTML = `${name}`;
  151. divitem.className = "btn_tolingsoft";
  152. divitem.setAttribute("data-clipboard-text", value);
  153. divitem.setAttribute("alt", value);
  154. divitem.setAttribute("title", value);
  155. div.appendChild(divitem);
  156.  
  157. }
  158.  
  159.  
  160. body.appendChild(div);
  161. //div 可拖动
  162. var div1 = document.querySelector(".movediv");
  163. div1.onmousedown = function (e) {
  164. var disX = e.clientX - div1.parentNode.offsetLeft;
  165. var disY = e.clientY - div1.parentNode.offsetTop;
  166.  
  167. document.onmousemove = function (e) {
  168. div1.parentNode.style.left = e.clientX - disX + "px";
  169. div1.parentNode.style.right ="";
  170. div1.parentNode.style.top = e.clientY - disY + "px";
  171. }
  172.  
  173. document.onmouseup = function () {
  174. document.onmousemove = null;
  175. document.onmouseup = null;
  176. }
  177. }
  178. console.log("成功");
  179. }
  180. }
  181. async function sleep(ms) {
  182. return new Promise(resolve => setTimeout(resolve, ms));
  183. }

QingJ © 2025

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