前程无忧(51job)批量投简历

前程无忧(51job)批量投简历。在页面左下角点击'批量投'按钮执行

目前为 2024-05-29 提交的版本。查看 最新版本

// ==UserScript==
// @name         前程无忧(51job)批量投简历
// @namespace    http://tampermonkey.net/
// @version      5.2
// @description  前程无忧(51job)批量投简历。在页面左下角点击'批量投'按钮执行
// @author       You
// @match        https://we.51job.com/*
// @run-at       document-idle
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 创建附加信息按钮元素
    var sensorsbutton = document.createElement('button');
    sensorsbutton.innerHTML = '附加信息'; // 按钮文本
    sensorsbutton.style.position = 'fixed';
    sensorsbutton.style.bottom = '18%'; // 距离底部的距离
    sensorsbutton.style.left = '10px'; // 距离左侧的距离
    sensorsbutton.style.zIndex = '9999';
    sensorsbutton.style.backgroundColor = '#0DBB4A';
    sensorsbutton.style.borderRadius = '4px'
    sensorsbutton.style.color = 'white'

    // 创建全选按钮元素
    var checkbutton = document.createElement('button');
    checkbutton.innerHTML = '全选/反选'; // 按钮文本
    checkbutton.style.position = 'fixed';
    checkbutton.style.bottom = '14%'; // 距离底部的距离
    checkbutton.style.left = '10px'; // 距离左侧的距离
    checkbutton.style.zIndex = '9999';
    checkbutton.style.backgroundColor = '#ff6000';
    checkbutton.style.borderRadius = '4px'
    checkbutton.style.color = 'white'

    // 创建投递按钮元素
    var submitbutton = document.createElement('button');
    submitbutton.innerHTML = '投递所选的'; // 按钮文本
    submitbutton.style.position = 'fixed';
    submitbutton.style.bottom = '10%'; // 距离底部的距离
    submitbutton.style.left = '10px'; // 距离左侧的距离
    submitbutton.style.zIndex = '9999';
    submitbutton.style.backgroundColor = '#ff6000';
    submitbutton.style.borderRadius = '4px'
    submitbutton.style.color = 'white'

    // 创建按钮元素
    var button = document.createElement('button');
    button.innerHTML = '一键本页全投'; // 按钮文本
    button.style.position = 'fixed';
    button.style.bottom = '2%'; // 距离底部的距离
    button.style.left = '10px'; // 距离左侧的距离
    button.style.zIndex = '9999';
    button.style.backgroundColor = 'red';
    button.style.borderRadius = '4px'
    button.style.color = 'white'

    // 将按钮添加到页面中
    document.body.appendChild(sensorsbutton);
    document.body.appendChild(checkbutton);
    document.body.appendChild(submitbutton);
    document.body.appendChild(button);

    // 全选/取消全选
    checkbutton.addEventListener('click', function() {
        for (let i = 1; i <= 20; i++) {
            // 多选框
            var element = document.querySelector(`#app > div > div.post > div > div > div.j_result > div > div:nth-child(2) > div > div:nth-child(2) > div.joblist > div:nth-child(${i}) > div.ick`);
            if(element == null){
                console.log("element节点有误,没找到复选框");
                continue;
            }
            // 创建一个鼠标点击事件
            var innerEvent = new MouseEvent('click', {
                bubbles: true,
                cancelable: true,
                view: window
            });
            // 触发点击事件
            element.dispatchEvent(innerEvent);
        }
    });


    // 投递所选的
    submitbutton.addEventListener('click', function() {
        var btn = document.querySelector(`#app > div > div.post > div > div > div.j_result > div > div:nth-child(2) > div > div > div > div:nth-child(2) > button:nth-child(2)`);
        if(btn != null) {
            console.log("找到提交按钮")
            var btnEvent = new MouseEvent('click', {
                bubbles: true,
                cancelable: true,
                view: window
            });
            btn.dispatchEvent(btnEvent);
            // 关闭弹窗
            setTimeout(function() {
                var closeElement = document.querySelector(`#app > div > div.post > div > div > div.j_result > div > div:nth-child(2) > div > div:nth-child(2) > div.van-popup.van-popup--center > i`);
                if(closeElement != null) {
                    console.log("找到关闭按钮")
                    var innerEvent = new MouseEvent('click', {
                        bubbles: true,
                        cancelable: true,
                        view: window
                    });
                    closeElement.dispatchEvent(innerEvent);
                }
            },3000);
        }
        //下一页
        setTimeout(function() {
            var nextBtn = document.querySelector(`#app > div > div.post > div > div > div.j_result > div > div:nth-child(2) > div > div.bottom-page > div > div > div > button.btn-next`);
            var nextEvent = new MouseEvent('click', {
                bubbles: true,
                cancelable: true,
                view: window
            });
            nextBtn.dispatchEvent(nextEvent);
            document.documentElement.scrollTop = document.documentElement.scrollHeight;
        },4000);
    });


    // 绑定按钮点击事件
    button.addEventListener('click', function() {
        for (let i = 1; i <= 20; i++) {
            // 多选框
            var element = document.querySelector(`#app > div > div.post > div > div > div.j_result > div > div:nth-child(2) > div > div:nth-child(2) > div.joblist > div:nth-child(${i}) > div.ick`);
            if(element == null){
                console.log("element节点有误,没找到复选框");
                continue;
            }
            // 创建一个鼠标点击事件
            var innerEvent = new MouseEvent('click', {
                bubbles: true,
                cancelable: true,
                view: window
            });
            // 触发点击事件
            element.dispatchEvent(innerEvent);
        }

        // 延迟1秒后执行按钮点击
        setTimeout(function() {
            // 按钮点击
            var btn = document.querySelector(`#app > div > div.post > div > div > div.j_result > div > div:nth-child(2) > div > div > div > div:nth-child(2) > button:nth-child(2)`);
            if(btn != null) {
                console.log("找到提交按钮")
                var btnEvent = new MouseEvent('click', {
                    bubbles: true,
                    cancelable: true,
                    view: window
                });
                btn.dispatchEvent(btnEvent);
                // 关闭弹窗
                setTimeout(function() {
                    var closeElement = document.querySelector(`#app > div > div.post > div > div > div.j_result > div > div:nth-child(2) > div > div:nth-child(2) > div.van-popup.van-popup--center > i`);
                    if(closeElement != null) {
                        console.log("找到关闭按钮")
                        var innerEvent = new MouseEvent('click', {
                            bubbles: true,
                            cancelable: true,
                            view: window
                        });
                        closeElement.dispatchEvent(innerEvent);
                    }
                },3000);
            }
            //下一页
            setTimeout(function() {
                var nextBtn = document.querySelector(`#app > div > div.post > div > div > div.j_result > div > div:nth-child(2) > div > div.bottom-page > div > div > div > button.btn-next`);
                var nextEvent = new MouseEvent('click', {
                    bubbles: true,
                    cancelable: true,
                    view: window
                });
                nextBtn.dispatchEvent(nextEvent);
                document.documentElement.scrollTop = document.documentElement.scrollHeight;
            },4000);
        }, 1000);
    });


    function displayAttachInfo() {
        for (let i = 1; i <= 20; i++) {
            const sensorsElement = document.querySelector(`#app > div > div.post > div > div > div.j_result > div > div:nth-child(2) > div > div:nth-child(2) > div.joblist > div:nth-child(${i}) > div[sensorsname]`);
            if (!sensorsElement) {
                continue; // 如果找不到对应的元素则跳过
                console.log("没有找到带数据的节点")
            }
            const jsonObject = JSON.parse(sensorsElement.getAttribute("sensorsdata"));
            const jobListItemTopElements = sensorsElement.querySelector('.joblist-item-top');
            const attachInfoSpan = jobListItemTopElements.querySelector('.custom-attach-span'); // 新增: 查询是否已存在时间span

            // 如果时间span不存在,则创建并追加
            if (!attachInfoSpan) {
                const attachInfoSpan = document.createElement('span');
                attachInfoSpan.classList.add('custom-attach-span'); // 新增: 添加特定类名
                attachInfoSpan.textContent = jsonObject.jobDegree+" | "+ jsonObject.jobYear+" | "+jsonObject.jobTime + "更新";
                attachInfoSpan.style.color = '#0DBB4A';
                attachInfoSpan.style.fontSize = '13px';
                attachInfoSpan.style.fontWeight = 600;
                attachInfoSpan.style.marginLeft = '16px';
                jobListItemTopElements.appendChild(attachInfoSpan);
            }
        }
    }

    sensorsbutton.addEventListener('click', displayAttachInfo);

//     window.addEventListener('load', (event) => {
//         displayAttachInfo();
//     });
})();

QingJ © 2025

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