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.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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});
})();