 
        Greasy Fork is available in English.
boss直聘辅助沟通助手
当前为 
// ==UserScript== // @name boss直聘自动沟通助手 // @namespace npm/vite-plugin-monkey // @version 0.0.0 // @author monkey // @icon https://vitejs.dev/logo.svg // @match https://www.zhipin.com/* // @require http://code.jquery.com/jquery-2.1.1.min.js // @require https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/core-js/3.21.1/minified.min.js // @require https://cdn.jsdelivr.net/npm/[email protected]/umd/react.production.min.js // @require https://cdn.jsdelivr.net/npm/[email protected]/umd/react-dom.production.min.js // @grant GM_xmlhttpRequest // @grant window.close // @description boss直聘辅助沟通助手 // ==/UserScript== (e=>{const o=document.createElement("style");o.dataset.source="vite-plugin-monkey",o.innerText=e,document.head.appendChild(o)})(` .boss-container{--background-color: orange;--font-color: #fff;position:fixed;left:50px;bottom:150px;display:flex;flex-direction:column;align-items:center;gap:10px;z-index:999}.boss-conversation-container .button{color:var(--font-color);background:var(--background-color);border:none;border-radius:5px;padding:6px 5px}.boss-conversation-setting{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:400px;height:400px;background:#eef;z-index:9999}.boss-conversation-container .multiple-publish{padding:5px;border-radius:5px} `); var W=Object.defineProperty;var q=(o,r,s)=>r in o?W(o,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[r]=s;var a=(o,r,s)=>(q(o,typeof r!="symbol"?r+"":r,s),s);(function(o,r){"use strict";var s={},R={get exports(){return s},set exports(e){s=e}},g={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var _=o,k=Symbol.for("react.element"),C=Symbol.for("react.fragment"),L=Object.prototype.hasOwnProperty,P=_.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,I={key:!0,ref:!0,__self:!0,__source:!0};function x(e,t,n){var i,c={},u=null,l=null;n!==void 0&&(u=""+n),t.key!==void 0&&(u=""+t.key),t.ref!==void 0&&(l=t.ref);for(i in t)L.call(t,i)&&!I.hasOwnProperty(i)&&(c[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps,t)c[i]===void 0&&(c[i]=t[i]);return{$$typeof:k,type:e,key:u,ref:l,props:c,_owner:P.current}}g.Fragment=C,g.jsx=x,g.jsxs=x,function(e){e.exports=g}(R);var h={},b=r;h.createRoot=b.createRoot,h.hydrateRoot=b.hydrateRoot;const d=e=>e==null,f=e=>{const t=e.reduce((n,i,c)=>(n+=i,c<e.length-1&&(n+="|"),n),"");return new RegExp(t)};class m{static isDetail(){const t=document.querySelector(".btn-container>.btn-startchat");return!d(t)||/job_detail/.test(location.pathname)}static isList(){return f(["geek/recommend","geek/job"]).test(location.pathname)}}const v="conversation_config",N={concurrentLimit:2,maxLimit:30,executeInterval:1e4,targetList:["[Rr]eact"],excludeList:["985","211","硕士"],automation:!1,idleMap:{}};class p{constructor(){a(this,"config",{});this.syncReadData()}syncReadData(){const t=localStorage.getItem(v);if(d(t)){this.config=N;return}try{this.config=JSON.parse(t)}catch(n){console.error(n)}}syncWriteData(){localStorage.setItem(v,JSON.stringify(this.config))}}class T{constructor(t,n){a(this,"timer");this.polling=t,this.ms=n}togglePolling(){this.polling=!this.polling}startPolling(){this.polling=!0}stopPolling(){this.polling=!1}get status(){return this.polling}clear(){const t=window.clearInterval;t(this.timer)}start(t){const n=window.setInterval;n(()=>{t()},this.ms)}}class y{constructor(){a(this,"polling",{});a(this,"pageNo",1);a(this,"setting",{});this.init()}init(){this.setting=new p,this.polling=new T(this.setting.config.automation,this.setting.config.executeInterval),this.polling.status&&this.start()}executeIdleQueue(){if(this.setting.config.maxLimit<=0){this.polling.clear();return}if(Object.values(this.setting.config.idleMap).filter(t=>!t.status).length===0){this.polling.status&&this.navigateNextPage(),this.polling.clear();return}for(let t=0;t<this.setting.config.concurrentLimit;t++){const n=Object.entries(this.setting.config.idleMap).filter(i=>!i[1].status).pop();n&&(this.setting.config.idleMap[n[0]].status=!0,n&&window.open(n[0]))}this.setting.syncWriteData()}start(){this.polling.start(()=>{this.setting.syncReadData(),this.addJobTask(),this.executeIdleQueue()})}addJobTask(){document.querySelectorAll(".job-list-box>li a.job-card-left")}navigateNextPage(){let t;const n=location.search.length!==0;/page=[0-9]+/.test(location.search)?t=location.search.replace(/(page=)[0-9]+/,`$1=${this.pageNo}`):t=location.search+`${n?"&":""}page=${this.pageNo}`,location.href=`${location.hostname}/${location.pathname}${t}`}}function D(){const e=()=>{new y().start()};return s.jsx("button",{className:"button",onClick:e,children:"一键投递"})}function E(){var n;const e=o.useRef();o.useEffect(()=>{e.current=new y},[]);const t=()=>{if(e.current){debugger;e.current.polling.togglePolling(),e.current.setting.config.automation=e.current.polling.status,e.current.setting.syncWriteData(),e.current.polling.status&&e.current.start()}};return s.jsx("button",{className:"button",onClick:t,children:(n=e.current)!=null&&n.polling.status?"关闭自动轮询":"开启自动轮询"})}const O=(e=!1)=>{const[t,n]=o.useState(e);return[t,{setFalse(){n(!1)},setTrue(){n(!0)},toggle(){n(!t)},set(c){n(c)}}]};function j(e){const{type:t}=e,[n,i]=o.useState(),c=l=>{const w=new p,S=l.currentTarget.value.split(",");t==="target"?w.config.targetList=S:t==="exclude"&&(w.config.excludeList=S)},u=l=>{i(l.target.value)};return s.jsxs(s.Fragment,{children:[s.jsxs("h5",{children:[t,":"]}),s.jsx("textarea",{onInput:u,value:n}),s.jsx("button",{onClick:c,children:"保存"})]})}function M(){return s.jsxs("div",{className:"boss-conversation-setting",children:["设置",s.jsx(j,{type:"target"}),s.jsx(j,{type:"exclude"})]})}function B(){const[e,{toggle:t}]=O();return s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"button",onClick:()=>{t()},children:"设置"}),e&&r.createPortal(s.jsx(M,{}),document.body)]})}function F(){return m.isList()?s.jsxs("div",{className:"boss-container boss-conversation-container",children:[s.jsx(D,{}),s.jsx(E,{}),s.jsx(B,{})]}):s.jsx(s.Fragment,{})}function A(){return s.jsx(F,{})}const Q="";h.createRoot((()=>{const e=document.createElement("div");return document.body.append(e),e})()).render(s.jsx(o.StrictMode,{children:s.jsx(A,{})}));class J{constructor(){a(this,"mountedTimer");a(this,"setting",new p);debugger;this.start()}checkCondition(){const t=document.querySelector(".job-sec-text");if(d(t))return!1;const n=f(this.setting.config.targetList).test(t.textContent),i=f(this.setting.config.excludeList).test(t.textContent);return n&&!i}publish(){if(this.setting.config.maxLimit<=0)return;const t=document.querySelector(".btn-container>.btn-startchat");t?(t.click(),this.setting.config.automation&&this.setting.config.maxLimit--,this.setting.syncWriteData()):(console.log("没有找到沟通按钮"),window.close())}start(){this.mountedTimer=window.setInterval(()=>{debugger;if(!this.checkCondition()){window.close(),clearInterval(this.mountedTimer);return}const t=document.querySelector(".btn-container>.btn-startchat"),n=document.querySelector(".left-title"),i=document.querySelector(".dialog-container");if(!m.isDetail()){clearInterval(this.mountedTimer),window.close();return}this.publish(),(i||n||t.textContent==="继续沟通")&&(clearInterval(this.mountedTimer),window.close())},3e3)}}m.isDetail()&&new J().start()})(React,ReactDOM);