bosshelper

Boss直聘企业端设定关键词自动打招呼

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         bosshelper
// @namespace    http://tampermonkey.net/
// @version      0.23
// @description  Boss直聘企业端设定关键词自动打招呼
// @author       Cherokee
// @match        https://www.zhipin.com/vue/index/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var retryCheck = function(checkFun,interval,nextFun,times,delay,startTime){
        if(!times)times = 1;
        else times += 1;
        if(!delay)delay = 0;
        if(!startTime)startTime = (new Date()).getTime();
        setTimeout(function(){
            if(checkFun(times)){
                if(delay){
                    var detal = delay - ((new Date()).getTime() - startTime);
                    if(detal>0)setTimeout(nextFun,detal);
                    else nextFun();
                }else nextFun();
            }else retryCheck(checkFun,interval,nextFun,times,delay,startTime);
        },interval);
    }
    window.addEventListener('load',_=>{
        if(window.location.href.startsWith('https://www.zhipin.com/vue/index/#/dashboard/candidate/recommend')){
           retryCheck(_=>{
              let lst = document.querySelectorAll('#recommend-list li');
              return lst && lst.length>0;
           },500,_=>{
               let checking = null;
               let tmer = null;
               let el = document.createElement('button');
               el.setAttribute('style','width:150px;height:30px;color:white;background-color:red');
               el.innerText = '自动撩人';
               document.querySelector('.op-filter').appendChild(el);
               el.addEventListener('click',function(e){
                   if(checking){
                       window.clearInterval(checking);
                       el.innerText = '自动撩人';
                       checking = null;
                       if(tmer){
                           window.clearTimeout(tmer);
                           tmer = null;
                       }
                   }else{
                       let keyword = window.prompt('请输入关键词','行业研究');
                       let lst = document.querySelector('#recommend-list li');
                       let ct = 1;
                       let hct = 0;
                       checking = window.setInterval(_=>{
                           tmer = window.setTimeout(_=>{
                               if(lst){
                                   lst.scrollIntoView(true);
                                   let sel = lst.querySelector('.col-3');
                                   let btn = lst.querySelector('button.btn-greet');
                                   if(sel&&sel.innerText.includes(keyword)&&btn){
                                       btn.click();
                                       lst.style.backgroundColor = '#98cdbb';
                                       hct++;
                                   }else{
                                       lst.style.backgroundColor = '#ffe5e5';
                                   }
                                   lst = lst.nextSibling;
                                   ct++;
                                   el.innerText = '停止撩人('+hct+'/'+ct+')';
                               }else{
                                   window.clearInterval(checking);
                                   el.innerText = '自动撩人('+hct+'/'+ct+')';
                                   checking = null;
                               }
                           },Math.ceil(Math.random()*4000));
                       },2000);
                   }
               },false);
           });
        }
    },false);
})();