Own / dist.js
HuanLin's picture
Update dist.js
0bc3f7d
raw
history blame
No virus
19.2 kB
// ==UserScript==
// @name Boss Helper
// @namespace http://example.com
// @version 0.1
// @description Not description here but f**k boss forever
// @author HuanLinOTO in github.com
// @match https://*.zhipin.com/*
// @include https://*.zhipin.com/*
// @grant none
// ==/UserScript==
class MiddlewareSystem{constructor(){this.middlewares=[]}registerMiddleware(e){this.middlewares.push(e)}execute(e,t){for(let a of this.middlewares)a(e,t)}}const network=new MiddlewareSystem,originalXhrOpen=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(i,e){this.addEventListener("load",function(){network.execute(e,JSON.parse(this.responseText))}),originalXhrOpen.apply(this,arguments)};const originalFetch=window.fetch;window.fetch=function(i,e){return originalFetch.apply(this,arguments).then(async t=>{const a=t.clone();return network.execute(i,await a.json()),t})},window.hlutils={network,getValidGeek:async(i,e)=>i.map(t=>({name:t.geekCard.geekName,isMatch:e.sex===0&&t.geekCard.geekGender===0||e.sex===1&&t.geekCard.geekGender===1||e.sex===2,origin:t})).filter(t=>t.isMatch?t.origin.geekCard.geekWorks.some(o=>o.positionName===e.job_content):!1),startGreeting:async(i,e)=>{var t=document;console.log(i.length);for(const p of i){for(var a=t.querySelector("#recommend-list > div > ul"),o=()=>new Promise((h,u)=>{setTimeout(h,2e3)}),r=a.children,n=0;n<r.length;n++){var d=r[n].querySelector("div > div.card-inner.blue-collar-wrap > div.col-2 > div.row.name-wrap > span"),s=d.textContent;if(s===p.name){var l=r[n].querySelector("div > div.operate-side > div > span > div > button");console.log(l),e(),l.click();break}}await o()}},getActionBar(){function i(a){const r=a.parentNode.children;return Array.from(r).indexOf(a)+1}var e=document.createElement("div");e.style.position="fixed",e.style.top="70px",e.style.right="10px",e.style.zIndex="9999",e.style.padding="0px 10px 10px 10px",e.style.backgroundColor="rgb(190 103 255 / 26%)",e.style.backdropFilter="blur(30px)",e.style.borderRadius="6px",e.style.display="flex",e.style.flexDirection="column",e.style.transition="0.3s",e.style.overflow="hidden",e.className="h-30px w-200px";var t=!0;return e.onclick=a=>{i(a.target)==1&&(t=!t)},e.onmouseenter=()=>{t&&(e.classList.remove("h-30px"),e.classList.add("h-300px"))},e.onmouseleave=()=>{t&&(e.classList.remove("h-300px"),e.classList.add("h-30px"))},e.bigger=()=>{e.classList.remove("h-30px","h-300px"),e.classList.add("h-600px"),e.classList.remove("w-200px"),e.classList.add("w-500px")},e.unbigger=()=>{e.classList.remove("h-600px"),e.classList.add("h-300px"),e.classList.remove("w-500px"),e.classList.add("w-200px")},e},hButton:i=>{var e=document.createElement("button");return e.style.background="aquamarine",e.style.border="aliceblue",e.style.padding="0 7px",e.style.margin="3px 0",e.style.borderRadius="10px",e.style.fontWeight="bold",e.className="hbtn",e.innerHTML=i,e.style.transition="0.3s",e},hText:i=>{var e=document.createElement("p");return e.innerText=i,e.style.margin="3px 0",e.style.fontWeight="bold",e},hTextarea:()=>{var i=document.createElement("textarea");return i.style.backgroundColor="#ffffff99",i.style.border="aqua",i.style.resize="auto",i.style.height="100%",i},hRadio:i=>{var e=document.createElement("td"),t=document.createElement("div");t.classList.add("button-group");for(var a=[],o=[],r=0;r<i.length;r++){var n=document.createElement("input");n.id="radio-"+r,n.name="radioGroup",n.value=i[r],n.type="radio",n.hidden=!0,a.push(n);var d=document.createElement("label");d.htmlFor="radio-"+r,d.classList.add("radio-button"),d.style.fontWeight="bold",d.textContent=i[r],o.push(d),t.appendChild(n),t.appendChild(d)}a[0].checked=!0,e.appendChild(t);var s=function(){for(var l=0;l<a.length;l++)if(a[l].checked)return l;return-1};return{element:e,getSelectedIndex:s}},hInput:(i,e,t)=>{const a=document.createElement("div"),o=document.createElement("input");var r=document.createElement("span");return r.innerText=i,r.style.fontWeight="bold",o.className="hinput",o.placeholder=e,o.value=t,a.appendChild(r),a.appendChild(o),{element:a,getValue(){return o.value}}}},(()=>{const i=new MutationObserver(function(t){for(let a of t)if(a.type==="childList"&&a.addedNodes.length>0){for(let o of a.addedNodes)if(o.matches&&o.matches("div.boss-popup__wrapper.boss-dialog.boss-dialog__wrapper.dialog-bosszp-download > div.boss-popup__close > i")){o.click(),i.disconnect();return}}});i.observe(document.documentElement,{childList:!0,subtree:!0});var e=document.createElement("style");e.innerHTML=`
.h-300px {
height: 330px
}
.h-600px {
height: 600px
}
.h-30px {
height: 30px
}
.w-500px {
width: 500px !important;
}
.w-200px {
width: 200px !important;
}
.hbtn:disabled {
background-color: #ff7f7f !important;
}
.button-group {
display: flex;
gap: 0;
}
.radio-button {
flex: 1;
height: 25px;
background-color: aliceblue;
border: 0px solid #ccc;
color: #333;
padding: 0px;
text-align: center;
cursor: pointer;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
border-radius: 0;
transition: 0.2s;
}
.radio-button:nth-of-type(1) {
border-top-left-radius: 7px !important;
border-bottom-left-radius: 7px !important;
}
.radio-button:last-child {
border-top-right-radius: 7px;
border-bottom-right-radius: 7px;
}
.radio-button:hover {
background-color: #ddd;
}
input[type="radio"]:checked + .radio-button {
background-color: aquamarine;
color: #333;
}
.hinput {
background-color: transparent;
border: none;
border-bottom: 2px solid aquamarine;
outline: none;
transition: all 0.3s ease 0s;
}
.hinput::placeholder {
color: #00000070;
}
.hinput::hover {
border-bottom: 2px solid #ffc1c1 !import;
}
`,document.body.appendChild(e),console.log(e)})(),window.hlutils.getWeChat=i=>{async function e(t){var a="";t.forEach(function(d,s){var l=d.join(",");a+=s<t.length?l+`
`:l});var o=new Blob([new Uint8Array([239,187,191]),a],{type:"text/csv;charset=GBK"}),r=document.createElement("a");r.href=URL.createObjectURL(o);const n=await fetch("https://www.zhipin.com/wapi/zpboss/h5/user/info",{headers:{accept:"application/json, text/plain, */*","accept-language":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6","sec-ch-ua":'"Not.A/Brand";v="8", "Chromium";v="114", "Microsoft Edge";v="114"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-origin",token:"iGKj6EV75hp0PYuE",traceid:"3853E9A4-288D-4362-9680-BF99F495ADA9","x-anti-request-token":"","x-requested-with":"XMLHttpRequest",zp_token:"V1RN8kF-D821djVtRvxxUcKS6x7DnWzS0~"},referrer:"https://www.zhipin.com/web/frame/info/user-center",referrerPolicy:"strict-origin-when-cross-origin",body:null,method:"GET",mode:"cors",credentials:"include"}).then(d=>d.json());r.download=`\u5FAE\u4FE1\u5BFC\u51FA-${n.zpData.baseInfo.name}-${n.zpData.brand.name}-${t.length}.csv`,r.click()}fetch("https://www.zhipin.com/wapi/zprelation/friend/filterByLabel",{headers:{accept:"application/json, text/plain, */*","accept-language":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6","content-type":"application/x-www-form-urlencoded","sec-ch-ua":'"Not.A/Brand";v="8", "Chromium";v="114", "Microsoft Edge";v="114"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-origin","x-anti-request-token":"","x-requested-with":"XMLHttpRequest",Referer:"https://www.zhipin.com/web/chat/index","Referrer-Policy":"strict-origin-when-cross-origin"},body:"labelId=0&encJobId=",method:"POST"}).then(t=>t.json()).then(t=>t.zpData.result).then(t=>{fetch("https://www.zhipin.com/wapi/zprelation/friend/filterByLabel",{headers:{accept:"application/json, text/plain, */*","accept-language":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6","content-type":"application/x-www-form-urlencoded","sec-ch-ua":'"Not.A/Brand";v="8", "Chromium";v="114", "Microsoft Edge";v="114"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-origin",traceid:"FAB1F39C-F236-44D6-9D69-E5BB5BA7E7C0","x-anti-request-token":"","x-requested-with":"XMLHttpRequest",Referer:"https://www.zhipin.com/web/chat/index","Referrer-Policy":"strict-origin-when-cross-origin"},body:"labelId=6&encJobId=",method:"POST"}).then(a=>a.json()).then(a=>a.zpData.result).then(a=>{for(var o={},r=0;r<a.length;r++){var n=a[r].friendId,d=t.find(c=>c.friendId===n);o[n]=d}var s=0;const l={headers:{accept:"application/json, text/plain, */*","accept-language":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6","sec-ch-ua":'"Not.A/Brand";v="8", "Chromium";v="114", "Microsoft Edge";v="114"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-origin",token:"iGKj6EV75hp0PYuE",traceid:"16CC7E4C-484A-49BA-BD3B-FB58AABAD2DD","x-anti-request-token":"","x-requested-with":"XMLHttpRequest",Referer:"https://www.zhipin.com/web/chat/index","Referrer-Policy":"strict-origin-when-cross-origin"},body:null,method:"GET"};var p=[],h=0;const u=async()=>{i(h,s),s==h&&e(p)};console.log("start");for(let c in o)setTimeout(async()=>{let b=0,v=1,g=!1,k=!0;for(;!g;){k=!1;let f=await fetch(`https://www.zhipin.com/wapi/zpchat/boss/historyMsg?src=${o[c].friendSource}&gid=${c}&maxMsgId=${b}&c=20&page=${v}`,l).then(w=>w.json());if(f.code==19){console.log(o[c],{res:f,t:c,maxMsgId:b,page:v,isFirst:k},`https://www.zhipin.com/wapi/zpchat/boss/historyMsg?src=0&gid=${c}&maxMsgId=${b}&c=20&page=${v}`,"code19");break}const x=f.zpData.messages;var q=x[x.length-1];for(const w of x)if(w.body&&w.body.text){const C=w.body.text,_=/&lt;copy&gt;(.*?)&lt;\/copy&gt;/,y=C.match(_);if(y&&y[1]){const S=y[1];g=!0,p.push([o[c].name,S]);break}}if(!g){var m=await(await fetch(`https://www.zhipin.com/wapi/zpjob/chat/geek/info?uid=${c}&geekSource=${o[c].friendSource}`,l)).json();if(m.zpData.data.geekFreeStatus==1){p.push([o[c].name,"\u5DF2\u88AB boss \u5C01\u7981"]);break}else if(m.zpData.data.weixin){p.push([o[c].name,m.zpData.data.weixin]);break}else if(q)b=q.mid,v++;else{p.push([o[c].name,"\u672A\u5728\u804A\u5929\u8BB0\u5F55\u4E2D\u627E\u5230, \u53EF\u80FD\u7CFB\u7EDF\u541E\u6D88\u606F\u4E86"]);break}}}h++,u()},s*50),s++})})},function(){"use strict";if(!window.location.href.startsWith("https://www.zhipin.com/web/frame/recommend")){console.log(window.location.href,"\u4E0D\u5339\u914D Boss \u635E\u4EBA");return}var i=!1;setTimeout(()=>{i||(r.innerHTML="\u65E0\u6CD5\u83B7\u53D6\u5230\u725B\u4EBA\u4FE1\u606F<br>\u8BF7\u53F3\u952E\u6B64\u5904\u5237\u65B0\u6846\u67B6",r.disabled=!0)},1e4);var e=[];const t=async()=>{var u=0,c={sex:s.getSelectedIndex(),job_content:l.getValue()};e=await window.hlutils.getValidGeek(e,c),console.log(c),window.hlutils.startGreeting(e,()=>{u++,a.innerHTML=`\u5F53\u524D\u6B63\u5728\u635E\u4EBA\u754C\u9762<br>\u5DF2\u81EA\u52A8\u635E ${u}/${e.length} \u4EBA`}),console.log(s.getSelectedIndex()),r.disabled=!0,r.innerHTML="\u5DF2\u5F00\u59CB\u81EA\u52A8\u635E\u4EBA<br>\u6309\u94AE\u5DF2\u7981\u7528"};var a=window.hlutils.hText(`\u5F53\u524D\u6B63\u5728\u635E\u4EBA\u754C\u9762
\u5DF2\u81EA\u52A8\u635E 0 \u4EBA`),o=window.hlutils.getActionBar(),r=window.hlutils.hButton("\u7B49\u5F85\u83B7\u53D6\u725B\u4EBA\u4FE1\u606F");r.onclick=t;var n=window.hlutils.hButton("\u6309\u4F4F\u6EDA\u52A8"),d;n.onmousedown=()=>{n.innerText="\u6EDA\u52A8\u4E2D...",d=setInterval(()=>window.scrollBy({top:9999,left:0,behavior:"smooth"}),100)},n.onmouseup=()=>{n.innerText="\u6309\u4F4F\u81EA\u52A8\u6EDA\u52A8",clearInterval(d)};const s=window.hlutils.hRadio(["\u5973","\u7537","\u4E0D\u7BA1"]),l=window.hlutils.hInput("\u66FE\u4EFB\u5DE5\u4F5C","\u5DE5\u4F5C\u540D\u79F0","\u7F8E\u5BB9\u5E08");var p=window.hlutils.hButton("\u70B9\u51FB\u83B7\u53D6\u6709\u6548\u725B\u4EBA\u6570");p.onclick=async()=>{var u={sex:s.getSelectedIndex(),job_content:l.getValue()};p.innerHTML=`\u6709\u6548\u725B\u4EBA: ${(await window.hlutils.getValidGeek(e,u)).length||0}`},o.appendChild(a),o.appendChild(r),o.appendChild(n),o.appendChild(window.hlutils.hText("\u6536\u96C6\u4E0D\u5230\u5C31\u5237\u65B0\u6846\u67B6")),o.appendChild(window.hlutils.hText("\u7B5B\u9009\u6761\u4EF6\uFF1A")),o.appendChild(s.element),o.appendChild(l.element),o.appendChild(p),document.body.appendChild(o);const h=async(u,c)=>{u.startsWith("/wapi/zpjob/rec/geek/list")&&(i=!0,e.push(...c.zpData.geekList),r.innerText=`\u81EA\u52A8\u6253\u62DB\u547C
\u5DF2\u6536\u96C6${e.length}\u4E2A\u725B\u4EBA`,console.log(e))};window.hlutils.network.registerMiddleware(h)}(),function(){"use strict";if(!window.location.href.startsWith("https://www.zhipin.com/web/frame/report/geek-manage")){console.log(window.location.href,"\u4E0D\u5339\u914D Boss \u725B\u4EBA\u7BA1\u7406");return}var i=window.hlutils.getActionBar();i.style.width="200px";var e=0,t=0,a=window.hlutils.hText("\u4E00\u952E\u7092\u51B7\u996D \u8FDB\u5EA6: 0/0"),o=window.hlutils.hButton("\u4E00\u952E\u7092\u51B7\u996D"),r=window.hlutils.hTextarea();r.value=`\u60A8\u597D\uFF0C\u60A8\u8FD8\u8003\u8651\u52A0\u5165\u6211\u4EEC\u5417\u3002
\u6211\u4EEC\u662F\u4E00\u5BB6\u4E13\u4E1A\u7F8E\u5BB9\u673A\u6784\uFF0C\u4E3B\u8981\u505A\u9762\u90E8\u3001\u8EAB\u4F53\u9879\u76EE\uFF0C\u8FDE\u9501\u578B\u95E8\u5E97\u3002
\u5730\u94C1\u76F4\u8FBE \u5305\u4F4F\u4E0D\u5305\u5403
\u8BD5\u7528\u671F\u4E09\u5929\uFF0C\u5165\u804C\u8D2D\u4E70\u793E\u4FDD
\u65E9\u73ED10:00-8:30 \u665A\u73ED12:30-10:30 \u6708\u4F11\u56DB\u5929\uFF0C\u6CD5\u5B9A\u8282\u5047\u65E5\u53EF\u591A\u4F111-2\u5929\u3002
\u6211\u4EEC\u662F\u8BD5\u7528\u671F\u4E09\u5929\u7684\uFF0C\u8FC7\u4E86\u8D2D\u4E70\u793E\u4FDD\uFF0C\u6211\u4EEC\u9996\u6708\u4FDD\u5E95\u5E95\u85AA\u85AA\u8D446000-8000
\u6211\u4EEC\u5E95\u85AA\u662F\u89C1\u9762\u76F4\u63A5\u8C08\u7684\uFF0C\u770B\u4E2A\u4EBA\u624B\u6CD5\uFF0C\u80FD\u529B\uFF0C\u6211\u4EEC\u90FD\u662F\u7ED9\u5F97\u8D77\u7684\uFF0C\u6211\u4EEC\u8BD5\u7528\u671F\u4E09\u5929\u3002
\u54B1\u53EF\u4EE5\u52A0\u4E2A\u5FAE\u4FE1\u6DF1\u5165\u4E86\u89E3\u4E00\u4E0B\u5417,\u65B9\u4FBF\u7ED9\u4F60\u53D1\u5177\u4F53\u7684\u5E97\u9762\u4F4D\u7F6E\u8BE6\u8C08\u54E6\u3002
`,r.onmouseenter=()=>i.bigger(),r.onmouseleave=()=>i.unbigger(),o.onclick=async()=>{o.innerHTML="\u5728\u7092\u4E86\u5728\u7092\u4E86",o.disabled=!0;const n=l=>new Promise((p,h)=>{setTimeout(p,l)}),d=document,s=window.parent.document;t=Number(d.querySelector("#container > div > div.geek-table-wrapper > div.content-pager > div > div > a:nth-child(9)").innerHTML==" ... "?d.querySelector("#container > div > div.geek-table-wrapper > div.content-pager > div > div > a:nth-child(10)").innerHTML:d.querySelector("#container > div > div.geek-table-wrapper > div.content-pager > div > div > a:nth-child(9)").innerHTML),console.log(t),a.innerHTML=`\u4E00\u952E\u7092\u51B7\u996D \u8FDB\u5EA6: ${e}/${t}`,d.querySelector("#container > div > div.geek-table-wrapper > div.ui-tablepro-wrapper > div > div.ui-tablepro-fixed-right > div.ui-tablepro-fixed-body > table > tbody > tr:nth-child(1) > td:nth-child(1) > div > div > div > div.operate-item.chat > div").click(),await n(100),s.querySelector("body > div.chat-global-outer-wrap > div.chat-global-wrap > div.chat-global-conversation > div > div.bosschat-editor.chat-editor > div.bosschat-toolbar-box > div > span.iboss-sentence.btn-bar > i").click(),await n(100),s.querySelector("body > div.chat-global-outer-wrap > div.chat-global-wrap > div.chat-global-conversation > div > div.bosschat-editor.chat-editor > div.bosschat-toolbar-box > div > div:nth-child(9) > div > h3 > a").click(),await n(200),s.querySelector("div.boss-popup__wrapper.boss-dialog.boss-dialog__wrapper.boss-chat-dialog-wrap.phrase-setting-wrap.boss-dialog-default > div.boss-popup__content > div.boss-dialog__body > div > ul > li:nth-child(1) > div > span:nth-child(1)").click(),await n(500),s.querySelector("div.boss-popup__wrapper.boss-dialog.boss-dialog__wrapper.boss-chat-dialog-wrap.phrase-setting-wrap.boss-dialog-default > div.boss-popup__content > div.boss-dialog__body > div > ul > li:nth-child(1) > div > textarea").value=r.value,s.querySelector("div.boss-popup__wrapper.boss-dialog.boss-dialog__wrapper.boss-chat-dialog-wrap.phrase-setting-wrap.boss-dialog-default > div.boss-popup__content > div.boss-dialog__body > div > ul > li:nth-child(1) > div > textarea").dispatchEvent(new Event("input")),await n(100),s.querySelector("div.boss-popup__wrapper.boss-dialog.boss-dialog__wrapper.boss-chat-dialog-wrap.phrase-setting-wrap.boss-dialog-default > div.boss-popup__content > div.boss-dialog__body > div > ul > li:nth-child(1) > div > p > span.btn-v2.btn-sure-v2").click(),await n(100),s.querySelector("div.boss-popup__wrapper.boss-dialog.boss-dialog__wrapper.boss-chat-dialog-wrap.phrase-setting-wrap.boss-dialog-default > div.boss-popup__close > i").click();for(let l=0;l<t-1;l++){for(let p=1;p<16;p++)try{const h=d.querySelector("#container > div > div.geek-table-wrapper > div.ui-tablepro-wrapper > div > div.ui-tablepro-fixed-right > div.ui-tablepro-fixed-body > table > tbody > tr:nth-child("+p+") > td:nth-child(1) > div > div > div > div.operate-item.chat > div");console.log(h),h.click(),await n(200),s.querySelector("body > div.chat-global-outer-wrap > div.chat-global-wrap > div.chat-global-conversation > div > div.bosschat-editor.chat-editor > div.bosschat-toolbar-box > div > span.iboss-sentence.btn-bar > i").click(),await n(200),s.querySelector("body > div.chat-global-outer-wrap > div.chat-global-wrap > div.chat-global-conversation > div > div.bosschat-editor.chat-editor > div.bosschat-toolbar-box > div > div:nth-child(9) > div > ul > li:nth-child(1)").click(),await n(200),s.querySelector("body > div.chat-global-outer-wrap > div.chat-global-wrap > div.chat-global-conversation > div > div.bosschat-editor.chat-editor > div.bosschat-toolbar-box > div > div.chat-op > span").click(),await n(200),a.innerHTML=`\u4E00\u952E\u7092\u51B7\u996D \u8FDB\u5EA6: ${e}/${t}`}catch(h){console.log(h)}console.log("\u5B8C\u6210\u64CD\u4F5C"),d.querySelector("#container > div > div.geek-table-wrapper > div.content-pager > div > div").lastChild.click(),await n(1e3)}},i.appendChild(a),i.appendChild(o),i.appendChild(window.hlutils.hText("\u81EA\u5B9A\u4E49\u6587\u672C")),i.appendChild(r),document.body.appendChild(i)}(),(async()=>setTimeout(()=>{const i=document.querySelector("#wrap > div.side-wrap > div.menu-list");document.querySelector("#wrap > div.side-wrap > div.menu-list > div.side-bottom-logo").remove();var e=document.createElement("div");e.style.paddingLeft="5px",e.style.paddingRight="5px",e.style.width="100%";var t=window.hlutils.hButton("\u5BFC\u51FA\u5FAE\u4FE1");t.onclick=()=>{t.disabled=!0,window.hlutils.getWeChat((a,o)=>{t.innerHTML=`\u8FDB\u5EA6 ${a}/${o}`,a==o&&(t.innerHTML="\u5BFC\u51FA\u5FAE\u4FE1",t.disabled=!1)})},t.style.width="100%",e.appendChild(t),i.appendChild(e)},3e3))();