KarriereAt Spamfilter

try to take over the world!

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        KarriereAt Spamfilter
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  try to take over the world!
// @author       We1rd0
// @match        https://www.karriere.at/jobs*
// @grant        none
// ==/UserScript==

function debounce(func, wait) {
  let timeout;
  return function executedFunction(...args) {
    const later = () => {
      clearTimeout(timeout);
      func(...args);
    };
    clearTimeout(timeout);
    timeout = setTimeout(later, wait);
  };
}

function killAds() {
  let items = Array.from(
    document.querySelector("div.m-jobsSearchList__activeJobs > ol").children
  ).filter((x) => {
    //KERN engineering
    let company = x.querySelector(".m-jobsListItem__company")?.innerText;
    if (!company) return;
    return (
      company.includes("epunkt GmbH") ||
      company.includes("KERN engineering") ||
      company.includes("TODAY Experts GmbH") ||
      company.includes("dataformers") ||
      company.includes("VACE Engineering GmbH") ||
      company.includes("IVM Technical Consultants")
    );
  });

  items.forEach((x) => x.remove());
  if (items.length > 0) console.log("Killed " + items.length + " ads");
}

function clickLoadMoreButton() {
  // Function to click the button, modified to be debounced
  const clickLoadMoreButtonDebounced = debounce(() => {
    const button = document.querySelector(".m-loadMoreJobsButton__button");
    if (button && button.offsetHeight !== 0) {
      button.click();
      console.log("Button clicked!");
    } else {
      console.log("Button not found or not visible yet.");
    }
  }, 2000); // 2000 milliseconds = 2 seconds

  // Create an observer instance to monitor DOM changes
  const observer = new MutationObserver((mutations) => {
    clickLoadMoreButtonDebounced();
  });

  // Configuration of the observer:
  const config = { attributes: true, childList: true, subtree: true };

  // Select the target node to observe
  const targetNode = document.body; // Adjust based on webpage structure

  // Start observing the target node for configured mutations
  observer.observe(targetNode, config);
}

(function () {
  "use strict";

  killAds();
  //   console.log("killed");
  // Observe changes in the job list container
  const targetNode = document.querySelector("div.m-jobsSearchList__activeJobs > ol");
  if (targetNode) {
    const config = { childList: true, subtree: true };
    const callback = function (mutationsList, observer) {
      // Run killAds on any DOM change within the target node
      killAds();
    };
    const observer = new MutationObserver(callback);
    observer.observe(targetNode, config);

    clickLoadMoreButton();
  }
})();