// ==UserScript== // @name IgnoreSomeCompanies // @namespace https://github.com/hfc1994 // @version 1.1.1 // @description 根据需要添加关键字,然后可以把页面上相对应公司的招聘条目给忽略 // @author 枯木 // @license GPL // @icon https://avatars2.githubusercontent.com/u/32028349?s=40&v=4 // @match https://search.51job.com/list/* // @match https://sou.zhaopin.com/* // @grant none // @downloadURL https://update.greasyfork.icu/scripts/374962/IgnoreSomeCompanies.user.js // @updateURL https://update.greasyfork.icu/scripts/374962/IgnoreSomeCompanies.meta.js // ==/UserScript== /** * 根据添加的指定关键字,忽略求职网站上指定公司的招聘条目 * 如果发现bug,非常欢迎向我提出来https://github.com/hfc1994/IgnoreSomeCompanies */ let companies = [] let website = '' // 初始化,用来读取localStorage // 存储格式key:companies,value:['',''] function init() { judgeWebsite() appendGlobalStyle() appendFloatDiv() try { companies = JSON.parse(window.localStorage.getItem('companies')) if (companies === null || companies === undefined || companies.length === 0) { companies = [] console.warn('页面暂无需要过滤的数据') return } else { for (let i=0; i { // console.log('DOM changed') doIgnore() }) let number = setInterval(() => { let target = document.getElementById('listContent') if (null !== target) { doIgnore() // DOM布局第一次形成,先过滤一遍 observer.observe(target, {'childList': true}) clearInterval(number) // console.log('observer设置完毕,定时任务结束') } else { // console.log('dom还没有初始化完成,500毫秒后重试') } }, 500) } function doIgnore() { let compDivs = getDivListToIgnore() for (let i=0; i