Greasy Fork

Greasy Fork is available in English.

一键沟通boss

沟通

当前为 2024-02-23 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    // ==UserScript==
// @name         一键沟通boss
// @license      GPL-3.0
// @namespace    http://tampermonkey.net/
// @version      2024-02-22
// @description  沟通
// @author       You
// @match        https://www.zhipin.com/*
// @icon         https://static.zhipin.com/v2/web/geek/images/logo.png
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    // 定义一个等待函数
    function wait(ms) {
        return new Promise(resolve => setTimeout(resolve, ms));
    }
    function getRandomInteger(min, max) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    }
    // 创建一个容器
    let container = document.createElement('div');
    container.style.position = 'fixed';
    container.style.top = '50px';
    container.style.right = '10px';
    container.style.zIndex = '10000';
    document.body.appendChild(container);


    // 创建一键沟通按钮
    let communicateBtn = document.createElement('button');
    communicateBtn.textContent = '一键沟通';
    container.appendChild(communicateBtn);



    communicateBtn.addEventListener('click', function() {
        // 获取所有具有 "start-chat-btn" 类的元素
        var buttons = document.getElementsByClassName("start-chat-btn");

        // 定义一个函数,用于执行延迟点击
        async function delayedClick(index) {
            if (index >= buttons.length) {
                console.log("所有按钮点击完成");
                 alert('执行完毕');
                return; // 如果所有按钮都已经被点击,就退出函数
            }
            if( buttons[index].innerText==="继续沟通"){

            }else{
                // 触发点击
                buttons[index].click();
                console.log("按钮 " + index + " 被点击");
                await wait(2000)
                document.querySelector("body > div.greet-boss-dialog > div.greet-boss-container > div.greet-boss-footer > a.default-btn.cancel-btn").click()
            }

            await wait(getRandomInteger(300, 2000))
            // 设置下一个点击的延迟
            setTimeout(function() {
                delayedClick(index + 1);
            }, 1000); // 这里设置的延迟是1000毫秒(1秒)
        }

        // 开始遍历并延迟点击每个按钮
        delayedClick(0);


    });



})();