LinkedIn Job Search Result Filter

Filter out LinkedIn job search result by title, company, and location. Edit filter list in the script before use, and keep a backup before updating script.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         LinkedIn Job Search Result Filter
// @namespace    https://greasyfork.org/en/users/85671-jcunews
// @version      1.0.2
// @license      GNU AGPLv3
// @author       jcunews
// @description  Filter out LinkedIn job search result by title, company, and location. Edit filter list in the script before use, and keep a backup before updating script.
// @match        https://www.linkedin.com/search/*
// @grant        none
// ==/UserScript==

((titleFilter, companyFilter, locationFilter) => {

  //===== CONFIGURATION BEGIN =====

  titleFilter    = /badpost|badjob/i;
  companyFilter  = /badcompany|badcorp/i;
  locationFilter = /badcity|badcity, ch|, ch/i;

  //===== CONFIGURATION END =====

  function checkItem(ele, a) {
    if (
      ((a = ele.querySelector(".entity-result__title-text--black,.job-card-list__title")) && titleFilter.test(a.textContent)) ||
      ((a = ele.querySelector(".entity-result__primary-subtitle,.job-card-container__company-name")) && companyFilter.test(a.textContent)) ||
      ((a = ele.querySelector(".entity-result__secondary-subtitle,.job-card-container__metadata-item")) && locationFilter.test(a.textContent))
    ) ele.remove();
  }

  (new MutationObserver(rs => {
    rs.forEach(r => {
      r.addedNodes.forEach(n => {
        if (n.nodeType !== Node.ELEMENT_NODE) return;
        if (n.matches("li.reusable-search__result-container,.jobs-search-results__list-item")) {
          checkItem(n);
        } else document.querySelectorAll("li.reusable-search__result-container,.jobs-search-results__list-item").forEach(li => checkItem(li));
      });
    });
  })).observe(document.body, {childList: true, subtree: true});
})();