ClickScript

用于巨量百应直播中控台自动点击讲解脚本

  1. // ==UserScript==
  2. // @name ClickScript
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-9-20
  5. // @description 用于巨量百应直播中控台自动点击讲解脚本
  6. // @author Hershey
  7. // @match https://buyin.jinritemai.com/dashboard/live/control?*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=jinritemai.com
  9. // @grant none
  10.  
  11. // ==/UserScript==
  12.  
  13. "use strict";
  14.  
  15. let link1XPath='//div[@class="goodsItem-KBGOY5 rpa_lc__live-goods__goods-item"][1]'
  16. let link2XPath='//div[@class="goodsItem-KBGOY5 rpa_lc__live-goods__goods-item"][2]'
  17. let link3XPath='//div[@class="goodsItem-KBGOY5 rpa_lc__live-goods__goods-item"][3]'
  18. let link4XPath='//div[@class="goodsItem-KBGOY5 rpa_lc__live-goods__goods-item"][4]'
  19.  
  20. class ClickScript {
  21. constructor() {
  22. this.init()
  23. }
  24.  
  25. init() {
  26. this.start()
  27. }
  28.  
  29. start() {
  30. this.click()
  31. }
  32.  
  33. //自动每隔15s点击两次
  34. click() {
  35. let result = document.evaluate(link1XPath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
  36. const btn = result.singleNodeValue;
  37. if (btn) {
  38. // 第一次点击
  39. btn.click();
  40. console.log("Clicked button.");
  41.  
  42. // 在1秒后进行第二次点击
  43. setTimeout(() => {
  44. if (btn) {
  45. btn.click();
  46. console.log("Clicked button again.");
  47. }
  48. }, 1000); // 1秒后点击第二次
  49. }
  50.  
  51. // 15秒后再次调用 click(),即每隔15秒点击两次
  52. setTimeout(() => {
  53. this.click();
  54. console.log("Waiting for 15 seconds.");
  55. }, 15000);
  56. }
  57. }
  58.  
  59. (function() {
  60. window.addEventListener("load", () => {
  61. // 每隔1秒检查元素是否加载
  62. const interval = setInterval(() => {
  63. const targetButton = document.querySelector("button.auxo-btn.auxo-btn-primary");
  64. if (targetButton) {
  65. console.log("找到按钮元素!");
  66. clearInterval(interval); // 找到后停止检查
  67. //加载自动点击函数
  68. new ClickScript();
  69. }
  70. else {
  71. console.log("未找到按钮元素!");
  72. }
  73. }, 5000);
  74. });
  75. })();

QingJ © 2025

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