1.购买服务器阿里云:服务器购买地址https://t.aliyun.com/U/W9mv4W若失效,可用地址
阿里云:
服务器购买地址
https://t.aliyun.com/U/W9mv4W
若失效,可用地址
https://www.aliyun.com/minisite/goods?source=5176.29345612&userCode=49hts92d
腾讯云:
https://curl.qcloud.com/wJpWmSfU
若失效,可用地址
https://cloud.tencent.com/act/cps/redirect?redirect=2446&cps_key=ad201ee2ef3b771157f72ee5464b1fea&from=console
华为云
https://activity.huaweicloud.com/cps.html?fromacct=64b5cf7cc11b4840bb4ed2ea0b2f4468&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905
2.部署教程
3.代码如下
(function() {
'use strict';
const STORAGE = {
LETTER: 'letterLastShown',
GUIDE: 'shouldShowGuide',
AI_COUNT: 'aiReplyCount',
AI_DATE: 'lastAiDate'
};
function getToday() {
return new Date().toISOString().split('T')[0];
}
function init() {
try {
const midnight = new Date();
midnight.setDate(midnight.getDate() + 1);
midnight.setHours(0, 0, 0, 0);
setTimeout(() => {
localStorage.removeItem(STORAGE.AI_COUNT);
localStorage.removeItem(STORAGE.AI_DATE);
localStorage.removeItem(STORAGE.LETTER);
}, midnight - Date.now());
UI.init();
document.body.style.position = 'relative';
const today = getToday();
if (location.pathname.includes('/jobs')) {
if (localStorage.getItem(STORAGE.LETTER) !== today) {
letter.showLetterToUser();
localStorage.setItem(STORAGE.LETTER, today);
} else if (localStorage.getItem(STORAGE.GUIDE) !== 'true') {
guide.showGuideToUser();
localStorage.setItem(STORAGE.GUIDE, 'true');
}
Core.log('自动沟通当前列表职位');
} else if (location.pathname.includes('/chat')) {
Core.log('自动发送自我介绍和简历');
}
} catch (error) {
console.error('初始化失败:', error);
if (UI.notify) UI.notify('初始化失败', 'error');
}
}
window.addEventListener('load', init);
})();
解析
该脚本是为 BOSS 直聘平台量身打造的自动化投递工具,核心功能如下:
自动投递职位并发送打招呼信息;
自动发送自我介绍与简历;
控制首次展示引导卡片/推荐话术;
每天凌晨重置状态计数(如 AI 回复次数);
模块化架构(多文件拆分,逻辑清晰);
提示用户操作步骤(首次使用引导);
根据不同页面(职位页/聊天页)加载不同策略;
支持自动与 AI 接口交互,提升沟通效率。
主要方法
init() | |
getToday() | |
window.addEventListener(...) | |
letter.showLetterToUser() | |
guide.showGuideToUser() | |
Core.log(...) | |
UI.init() | |
localStorage |
核心方法
1. init()
初始化函数
该方法为整个脚本的启动核心,主要做了以下几件事:
function init() {
// 设置次日0点清除状态记录
setTimeout(() => {
localStorage.removeItem(STORAGE.AI_COUNT);
localStorage.removeItem(STORAGE.AI_DATE);
localStorage.removeItem(STORAGE.LETTER);
}, midnight - Date.now());
UI.init(); // 初始化 UI 组件
document.body.style.position = 'relative';
const today = getToday();
// 判断当前页面是否为职位页
if (location.pathname.includes('/jobs')) {
if (localStorage.getItem(STORAGE.LETTER) !== today) {
letter.showLetterToUser(); // 每天只显示一次打招呼推荐话术
localStorage.setItem(STORAGE.LETTER, today);
} else if (localStorage.getItem(STORAGE.GUIDE) !== 'true') {
guide.showGuideToUser(); // 仅首次显示使用指引
localStorage.setItem(STORAGE.GUIDE, 'true');
}
Core.log('自动沟通当前列表职位');
}
// 判断是否进入聊天页面
else if (location.pathname.includes('/chat')) {
Core.log('自动发送自我介绍和简历');
}
}
2. 页面判断逻辑
根据页面路径进行功能分流:
/jobs
:批量沟通职位(触发推荐话术、引导);/chat
:自动发送自我介绍和简历。
3. 本地状态管理
使用 localStorage
进行日常状态控制:
letterLastShown | |
shouldShowGuide | |
aiReplyCount | |
lastAiDate |
这些数据会在每天 0 点自动清除,确保每日自动执行逻辑可重新触发。
依赖结构(通过 @require
引入)
config.js | |
state.js | |
utils.js | |
ui.js | |
core.js | |
letter.js | |
guide.js | |
settings.js |
注意:
本文部分变量已做脱敏处理,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断。技术层面需要提供帮助,可以通过打赏的方式进行探讨。
没有评论:
发表评论