Greasy Fork

Greasy Fork is available in English.

抖音直播持续点击讲解

解放你的双手😋

当前为 2023-11-25 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         抖音直播持续点击讲解
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  解放你的双手😋
// @author       gz
// @match        https://fxg.jinritemai.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license     MIT
// ==/UserScript==

(function() {
    'use strict';
    var appendButtons = new Array();
    var onsales = new Array();
    var interId;
    var timeoutId1, timeoutId2;
    function appendDuringButton() {
        let bottoms = document.querySelectorAll(".index__goodsAction___1Pz3g");
        for (let i = 0; i < bottoms.length; i++) {
            let button = document.createElement("button");
            button.className = "auxo-btn auxo-btn-sm lvc2-doudian-btn";
            button.innerText = "持续弹窗";
            button.dataset.index = i;
            button.addEventListener('click', function (e) {
                console.log("开始持续点击");
                let index = e.currentTarget.dataset.index;
                console.log(`获取index:${index}`);
                clearTimeout(timeoutId1);
                clearTimeout(timeoutId2);
                clearInterval(interId);
                onsales[index].click();
                console.log("清除残余完成");

                interId = setInterval(function () {
                    timeoutId1 = setTimeout(function () {
                        onsales[index].click();
                    }, 11000);

                    timeoutId2 = setTimeout(function () {
                        onsales[index].click();
                    }, 12000);
                }, 12000);
            })
            appendButtons.push(button);
            bottoms[i].appendChild(button);
        }
    }

    function getOnsalesButton() {
        let bottoms = document.querySelectorAll(".index__goodsAction___1Pz3g");
        onsales = Array.from(bottoms).map(function (bottom) {
            return bottom.lastChild.getElementsByTagName('button')[0];
        });
    }

    function init(){
        console.log("清空之前的对象");
        appendButtons = new Array();
        onsales = new Array();
        console.log("持续点击初始化中。。。。。。。。");
        let outDiv = document.createElement("div");
        outDiv.className = "index__guideItem___2GjBz";
        let innerDiv = document.createElement("div");
        innerDiv.innerText = "刷新弹窗按钮";
        outDiv.appendChild(innerDiv);
        console.log("创建弹窗按钮。。。。。。。");
        let sideBar = document.querySelectorAll(".index__bottomGuides___BOaP6")[0];
        console.log(`sidebar: ${sideBar}`)
        sideBar.appendChild(outDiv);
        console.log("添加按钮。。。。。。。");
        outDiv.addEventListener('click', function () {
            getOnsalesButton();
            appendDuringButton();
        });
    }

    function pageLoaded(){
        console.log("尝试获取");
        let sideBar = document.querySelectorAll(".index__bottomGuides___BOaP6")[0];
        if(typeof sideBar == 'undefined' && sideBar.length != 0){
            console.log("尝试失败");
            setTimeout(pageLoaded, 1000);
        }else {
            console.log("尝试成功");
            init();
        }
    }
    setTimeout( pageLoaded
               , 5000);

})();