// ==UserScript==
// @name boss直聘职位描述远程兼职关键词高亮显示
// @namespace http://tampermonkey.net/
// @version 2024-03-31
// @description 有问题联系:qq183180915
// @author 余默
// @match https://www.zhipin.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @license MIT
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
window.onload = function() {
// 在这里编写需要在页面加载完毕后执行的 JavaScript 代码
setInterval(() => {
const desc = document.querySelector('p.desc');
let txt = desc.innerHTML;
// console.log(txt);
// 获取文本内容
// const textContent = document.getElementById('content').innerHTML;
// 匹配包含“远程”的关键词
// const keywords = txt.match(/远程/g);
// const keywords2 = txt.match(/兼职/g);
// const regex = /兼([\s\S]*?)职/g;
// const matches = txt.match(regex);
// 输出匹配到的内容
// console.log(matches);
txt = txt.replace(/兼([\s\S]*?)职/g, '兼职');
txt = txt.replace(/远([\s\S]*?)程/g, '远程');
txt = txt.replace(/线([\s\S]*?)上/g, '线上');
// 高亮显示关键词
const highlightedContent = txt.replace(/远程/g, '远程');
const highlightedContent1 = highlightedContent.replace(/家/g, '家');
const highlightedContent2 = highlightedContent1.replace(/兼职/g, '兼职');
const highlightedContent3 = highlightedContent2.replace(/线上/g, '线上');
// 更新文本内容
desc.innerHTML = highlightedContent3;
}, 1200);
};
})();