BOSS 直聘 跨境黑名单

可以在 BOSS 直聘上 显示 若比邻的 黑名单,应 Facebook 群友要求,分享一下 祝大家早日找到好工作

目前为 2022-07-20 提交的版本。查看 最新版本

// ==UserScript==
// @name         BOSS 直聘 跨境黑名单
// @namespace    https://github.com/MaiXiaoMeng
// @version      0.1.2
// @description  可以在 BOSS 直聘上 显示 若比邻的 黑名单,应 Facebook 群友要求,分享一下 祝大家早日找到好工作
// @author       XiaoMeng Mai
// @match        https://www.zhipin.com/web/geek/job*
// @match        https://www.zhipin.com/job_detail*
// @match        https://www.zhipin.com/web/geek/chat*
// @compatible   firefox Tampermonkey
// @compatible   chrome Tampermonkey
// @compatible   edge Tampermonkey
// @grant        GM_xmlhttpRequest
// @require      https://code.jquery.com/jquery-2.2.4.min.js
// @require      https://greasyfork.org/scripts/383527-wait-for-key-elements/code/Wait_for_key_elements.js?version=701631
// @license      GPLv3
// ==/UserScript==

function actionFunction_1(jNode) {
    var base_url = 'https://www.zhipin.com'
    var company_url = jNode.attr('href')

    if (jNode.text().indexOf('若比邻黑名单') == -1) {
        console.log(jNode.text() + jNode.attr('href'))
        console.log(base_url + company_url)
        GM_xmlhttpRequest({
            method: 'GET',
            url: base_url + company_url,
            onload: function (response) {
                var response_text = $(response.responseText)
                if (response.responseText.indexOf('请稍后') == -1) {
                    var company_business = response_text.find('.company-full-name > span')[0].textContent
                    console.log(company_business)
                    GM_xmlhttpRequest({
                        method: 'GET',
                        url: `https://www.ratecompany.org/?s=${company_business}&post_type=question`,
                        onload: function (response) {
                            if (response.responseText.indexOf('Sorry,该公司目前还没有人评价') == -1) {
                                // console.log(response.responseText);
                                var response_text = $(response.responseText)
                                var hyperlink = response_text.find('.ap-questions-hyperlink').attr('href')
                                jNode.after($(`<a style="color:#F00" href='${hyperlink}'>&nbsp 若比邻黑名单 &nbsp</a>`))
                                jNode.find(`#${company_business}`).remove()
                            } else {

                            }
                        },
                        onerror: function (response) {
                        }
                    })
                }
            },
            onerror: function (response) {
            }
        })
    }
}

function actionFunction_2(jNode) {
    jNode = jNode.find('a')
    var base_url = 'https://www.zhipin.com'
    var company_url = jNode.attr('href')

    if (jNode.text().indexOf('若比邻黑名单') == -1 && jNode.text().indexOf('去搜索一下') == -1 && jNode.text().length > 1) {
        console.log('公司名称:' + jNode.text() + "URL" + jNode.attr('href'))
        console.log(base_url + company_url)

        var blacklist_search = `https://www.ratecompany.org/?s=${jNode.text()}&post_type=question`
        console.log(blacklist_search);

        GM_xmlhttpRequest({
            method: 'GET',
            url: blacklist_search,
            onload: function (response) {
                if (response.responseText.indexOf('Sorry,该公司目前还没有人评价') == -1) {
                    var response_text = $(response.responseText)
                    var hyperlink = response_text.find('.ap-questions-hyperlink').attr('href')
                    if (hyperlink == undefined) {
                        jNode.after($(`<a style="color:#00F" href='${blacklist_search}'>&nbsp 去搜索一下 &nbsp</a>`))
                    } else {
                        jNode.after($(`<a style="color:#F00" href='${hyperlink}'>&nbsp 若比邻黑名单 &nbsp</a>`))
                    }
                } else {
                    jNode.after($(`<a style="color:#00F" href='${blacklist_search}'>&nbsp 去搜索一下 &nbsp</a>`))
                }
            }
        })
    }
}

function actionFunction_3(jNode) {
    var blacklist_search = `https://www.ratecompany.org/?s=${jNode.text()}&post_type=question`
    GM_xmlhttpRequest({
        method: 'GET',
        url: blacklist_search,
        onload: function (response) {
            if (response.responseText.indexOf('Sorry,该公司目前还没有人评价') == -1) {
                var response_text = $(response.responseText)
                var hyperlink = response_text.find('.ap-questions-hyperlink').attr('href')
                if (hyperlink == undefined) {
                    $('.detail-op > .name').append($(`<a style="color:#00F" href='${blacklist_search}'>&nbsp 去搜索一下 &nbsp</a>`))
                } else {
                    $('.detail-op > .name').append($(`<a style="color:#F00" href='${hyperlink}'>&nbsp 若比邻黑名单 &nbsp</a>`))
                }
            } else {
                $('.detail-op > .name').append($(`<a style="color:#00F" href='${blacklist_search}'>&nbsp 去搜索一下 &nbsp</a>`))
            }
        }
    })
}

function actionFunction_4(jNode) {
    if (jNode.text().indexOf('加载') == -1 && jNode.text().indexOf('您可以与来自店长直聘的Boss直接沟通')) {
        query_quantity = query_quantity + 1
        company_name = jNode.text().split('  ')[0].replace('...', '')
        var blacklist_search = `https://www.ratecompany.org/?s=${company_name}&post_type=question`
        if (query_quantity < 40) {
            GM_xmlhttpRequest({
                method: 'GET',
                url: blacklist_search,
                onload: function (response) {
                    if (response.responseText.indexOf('Sorry,该公司目前还没有人评价') == -1) {
                        var response_text = $(response.responseText)
                        var hyperlink = response_text.find('.ap-questions-hyperlink').attr('href')
                        if (hyperlink == undefined) {
                            jNode.parent().find('.name').append($(`<a style="color:#00F" href='${blacklist_search}'>&nbsp 去搜索一下 &nbsp</a>`))
                        } else {
                            jNode.parent().find('.name').append($(`<a style="color:#F00" href='${hyperlink}'>&nbsp 若比邻黑名单 &nbsp</a>`))
                        }
                    } else {
                        jNode.parent().find('.name').append($(`<a style="color:#00F" href='${blacklist_search}'>&nbsp 去搜索一下 &nbsp</a>`))
                    }
                }
            })
        }
    }
}

function actionFunction_5(jNode) {
    $(".article_child").remove()
    if (jNode.text().indexOf('加载') == -1 && jNode.text().indexOf('您可以与来自店长直聘的Boss直接沟通')) {
        query_quantity = query_quantity + 1
        company_name = jNode.text().replace('...', '')
        var blacklist_search = `https://www.ratecompany.org/?s=${company_name}&post_type=question`
        GM_xmlhttpRequest({
            method: 'GET',
            url: blacklist_search,
            onload: function (response) {
                if (response.responseText.indexOf('Sorry,该公司目前还没有人评价') == -1) {
                    var response_text = $(response.responseText)
                    var hyperlink = response_text.find('.ap-questions-hyperlink').attr('href')
                    if (hyperlink == undefined) {
                        jNode.after($(`<a class="article_child" style="color:#00F" href='${blacklist_search}'>&nbsp 去搜索一下 &nbsp</a>`))
                    } else {
                        jNode.after($(`<a class="article_child" style="color:#F00" href='${hyperlink}'>&nbsp 若比邻黑名单 &nbsp</a>`))
                    }
                } else {
                    jNode.after($(`<a class="article_child" style="color:#00F" href='${blacklist_search}'>&nbsp 去搜索一下 &nbsp</a>`))
                }
            }
        })
    }
}

waitForKeyElements('.company-name', actionFunction_2);
waitForKeyElements('.job-sec > .name', actionFunction_3);
waitForKeyElements('.gray', actionFunction_4);
waitForKeyElements('#container > div > div > div:nth-child(2) > div.article > p > span:nth-child(2)', actionFunction_5);
waitForKeyElements('.info-company > div > h3', actionFunction_2);
query_quantity = 0