BOSS直聘接收消息提醒
BOSS直聘手机APP的通知权限全开了,接收到消息也不会立刻提醒,因此写个脚本监听消息。
用BOSS直聘网页首页( https://www.zhipin.com/guangzhou/ )当浏览器后台标签页,挂后台,接收到消息就发送axios请求调用自己的消息推送接口提醒自己。
JavaScript油猴脚本代码:
// ==UserScript==
// @name BOSS直聘消息提醒
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.zhipin.com/guangzhou/
// @require https://unpkg.com/axios@0.27.2/dist/axios.min.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
let newMsgNumber=0;
setInterval(function () {
if(Number(document.getElementsByClassName('nav-chat-num')[0].textContent)!=newMsgNumber){
newMsgNumber=Number(document.getElementsByClassName('nav-chat-num')[0].textContent);
if(newMsgNumber!=0){
//发送axios请求,调用自己的消息推送接口(例如我这里用的是企业微信的消息推送)
}
}
},5000);
})();