Greasy Fork

Greasy Fork is available in English.

Unwanted Job Result Hider - indeed.com

Adds a button to toggle the visibilty of job results that contain keywords defined in the script.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Unwanted Job Result Hider - indeed.com
// @namespace   Violentmonkey Scripts
// @match       https://www.indeed.com/*
// @grant       none
// @version     1.0
// @author      primarily from ChatGPT but with manual fixes and modifications
// @description Adds a button to toggle the visibilty of job results that contain keywords defined in the script.
// @license MIT
// ==/UserScript==

(function() {
  const keywords = ['nanny', 'caregiver', 'driver', 'pizza', 'cashier'];
  // replace any of the above keywords with ones you don't want to see!
  let isHidden = false;

  function hideUnwantedElements() {
    const elements = document.querySelectorAll('.resultWithShelf');
    elements.forEach(element => {
      const text = element.textContent.toLowerCase();
      const shouldHide = keywords.some(keyword => text.includes(keyword));
      element.style.opacity = shouldHide && isHidden ? '0' : '1';
      element.style.pointerEvents = shouldHide && isHidden ? 'none' : 'auto';
    });
  }

  function toggleVisibility() {
    const elements = document.querySelectorAll('.resultWithShelf');
    elements.forEach(element => {
      element.style.opacity = '1';
      element.style.pointerEvents = 'auto';
    });
    isHidden = !isHidden;
    hideUnwantedElements();
    updateButtonStyle();
  }

  function updateButtonStyle() {
    const button = document.getElementById('toggleButton');
    if (button) {
      button.style.backgroundColor = isHidden ? '#808080' : '';
      button.style.boxShadow = isHidden ? 'inset 0 2px 2px rgba(0, 0, 0, 0.3)' : '';
    }
  }

  function createToggleButton() {
    const button = document.createElement('button');
    button.textContent = 'Toggle Unwanted';
    button.style.width = '10%';
  button.style.height = '10%';
  button.style.backgroundColor = 'gray';
    button.id = 'toggleButton';
    button.style.position = 'fixed';
    button.style.left = '10px';
    button.style.top = '10px';
    button.style.zIndex = '9999';
    button.addEventListener('click', toggleVisibility);
    document.body.appendChild(button);
    updateButtonStyle();
  }

  document.addEventListener('DOMContentLoaded', () => {
    hideUnwantedElements();
    createToggleButton();
  });
})();