preLoadFile.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /**
  2. * 动态加载JavaScript文件
  3. * @param {string} url - JS文件的URL
  4. * @param {Function} callback - 加载成功后的回调函数
  5. * @param {Function} errorCallback - 加载失败后的回调函数
  6. */
  7. function loadJS(url, callback, errorCallback) {
  8. // 创建script标签
  9. const script = document.createElement('script');
  10. script.type = 'text/javascript';
  11. script.src = url;
  12. // 设置加载成功回调
  13. script.onload = function() {
  14. if (typeof callback === 'function') {
  15. callback();
  16. }
  17. };
  18. // 设置加载失败回调
  19. script.onerror = function() {
  20. if (typeof errorCallback === 'function') {
  21. errorCallback();
  22. }
  23. };
  24. // 将script标签添加到页面中
  25. document.head.appendChild(script);
  26. }
  27. window.statusInfo = "空闲中"
  28. window.darw = {}
  29. if (location.href.startsWith('https://www.douyin.com/user/')) {
  30. if (localStorage.getItem('dqrw')) {
  31. window.statusInfo = "运行中"
  32. window.darw = JSON.parse(localStorage.getItem('dqrw'))
  33. }
  34. }
  35. // 获取tooltip元素
  36. const tooltip = document.getElementById('tooltip');
  37. // 同时触发pointerenter和mouseenter事件
  38. function triggerHoverEvents() {
  39. // 1. 触发pointerenter事件
  40. const pointerEnterEvent = new PointerEvent('pointerenter', {
  41. bubbles: true,
  42. cancelable: true,
  43. view: window,
  44. pointerId: 1,
  45. pointerType: 'mouse',
  46. isPrimary: true
  47. });
  48. // 2. 触发mouseenter事件
  49. const mouseEnterEvent = new MouseEvent('mouseenter', {
  50. bubbles: true,
  51. cancelable: true,
  52. view: window,
  53. clientX: 100,
  54. clientY: 100
  55. });
  56. // 3. 触发pointerover(如果需要)
  57. const pointerOverEvent = new PointerEvent('pointerover', {
  58. bubbles: true,
  59. cancelable: true,
  60. view: window,
  61. pointerId: 1,
  62. pointerType: 'mouse'
  63. });
  64. // 4. 触发mouseover(如果需要)
  65. const mouseOverEvent = new MouseEvent('mouseover', {
  66. bubbles: true,
  67. cancelable: true,
  68. view: window,
  69. clientX: 100,
  70. clientY: 100
  71. });
  72. // 按顺序同时触发所有事件
  73. // document.querySelectorAll('.semi-dropdown-item')[8].click()
  74. // tooltip.dispatchEvent(pointerOverEvent);
  75. window.checkClock1 = setInterval(() => {
  76. tooltip.dispatchEvent(mouseOverEvent);
  77. }, 100);
  78. window.checkClock2 = setInterval(() => {
  79. try {
  80. document.querySelectorAll('.semi-dropdown-item')[8].click()
  81. clearInterval(window.checkClock1)
  82. clearInterval(window.checkClock2)
  83. } catch (error) {
  84. console.log(error)
  85. }
  86. }, 500);
  87. console.log('Pointer和Mouse进入事件已同时触发');
  88. }
  89. // setTimeout(() => {
  90. // if (location.href.startsWith('https://www.douyin.com/user/')) {
  91. // // 执行触发
  92. // triggerHoverEvents();
  93. // setTimeout(() => {
  94. // document.querySelectorAll('.ug0uBNhF div').forEach(element => {
  95. // if (element.querySelector('span')) {
  96. // const typeText = element.querySelector('span').innerText
  97. // console.log(typeText)
  98. // if (typeText == window.darw.jbxx.split('-')[0]) {
  99. // element.querySelector('.A9Seu0Hm').click()
  100. // }
  101. // }
  102. // });
  103. // // 二级举报
  104. // setTimeout(() => {
  105. // document.querySelectorAll('.ug0uBNhF div').forEach(element => {
  106. // if (element.querySelector('span')) {
  107. // const typeText = element.querySelector('span').innerText
  108. // console.log(typeText)
  109. // if (typeText == window.darw.jbxx.split('-')[1]) {
  110. // element.querySelector('.A9Seu0Hm').click()
  111. // }
  112. // }
  113. // });
  114. // }, 3000);
  115. // document.querySelector('.mlG4sNlr textarea').value = window.darw.jbly
  116. // setTimeout(() => {
  117. // // document.querySelector('button.GPAlcn2R').click()
  118. // }, 5000);
  119. // }, 5000);
  120. // }
  121. // }, 5000);
  122. loadJS('https://html2canvas.hertzen.com/dist/html2canvas.min.js')
  123. function captureAndDownload(element) {
  124. html2canvas(element, {
  125. scale: 2, // 提高截图质量
  126. useCORS: true, // 允许跨域图片
  127. backgroundColor: null // 透明背景
  128. }).then(canvas => {
  129. // 创建下载链接
  130. const link = document.createElement('a');
  131. link.download = '截图.png';
  132. link.href = canvas.toDataURL('image/png');
  133. link.click();
  134. });
  135. }
  136. loadJS('https://cunchu.site/puge/ws.js', () => {
  137. let wsOptions = {
  138. isAdmin: false,
  139. onReady: () => {
  140. console.log('ws连接成功');
  141. }
  142. }
  143. wsOptions.messageCallBack = (meg) => {
  144. switch (meg.type) {
  145. case "getInfo": {
  146. owoSocket.send("getInfo", {
  147. url: location.href,
  148. status: window.statusInfo
  149. }, meg.userID)
  150. break
  151. }
  152. case "ksjb": {
  153. if (window.statusInfo == "空闲中") {
  154. console.log(meg.value);
  155. window.dqrw = meg.value
  156. window.statusInfo = "运行中"
  157. localStorage.setItem("dqrw", JSON.stringify(meg.value))
  158. location.href = meg.value.url
  159. }
  160. break
  161. }
  162. }
  163. }
  164. window.owoSocket = new owoSocket('抖音举报', wsOptions)
  165. })