As a web developer, I’m constantly reminded of the unique problem-solving abilities this profession instills in us. These skills prove invaluable not just in technical settings but in everyday challenges—like navigating the often frustrating terrain of job boards.

The Job Search Conundrum

Recently, as I’ve been hunting for my next full-time position, LinkedIn’s job board has been a frequent destination. However, this experience has been less than ideal. Alongside encountering numerous “ghost jobs” (listings that seem perpetually open but lead nowhere), I’ve been inundated with spammy listings from companies like “DataAnnotation.” This particular firm posts the same remote job under 50 different titles, crowding out other relevant listings. And these postings aren’t just repetitive—they’re supposedly for every city across America.

LinkedIn, while a powerful tool, unfortunately lacks robust filters to exclude specific employers from search results. This significant oversight means that finding relevant job opportunities becomes a needle-in-a-haystack scenario.

On Reddit there is a discussion of using a plugin called uBlockOrigin to accomplish this, but I wanted to do this without Adblock plugins since I’ve turned mine off most of the time, accepting that the price of the “free internet” is putting up with advertisements to pay for all the “free” websites.

Enter Tampermonkey

Tampermonkey is a popular userscript manager that allows you to run custom JavaScript on web pages. It’s a browser extension available on Chrome, Firefox, and other browsers, which provides a way to enhance or modify the behavior of web pages to suit individual needs. By writing a small script, you can automate tasks, change appearances, or even block content based on specific conditions.

Crafting a Custom Solution

Using Tampermonkey, I decided to tackle the overwhelming flood of irrelevant job postings. Here’s a simple explanation of what my script does:

  • Detect and Hide: The script runs on LinkedIn’s jobs page and checks each job listing. If the listing includes certain keywords—like “DataAnnotation”—it automatically hides these from view.
  • Dynamic Content Handling: As LinkedIn loads job listings dynamically (meaning new content can appear as you scroll), the script must continually check for new listings as they appear.

Install the Tampermonkey extension in your chrome browser, then add a new Userscript. You should be able to cut and paste

Using a setInterval method

Initially, I employed a setInterval method, where the script periodically checked the page every few seconds to hide unwanted listings.

JavaScript
// ==UserScript==
// @name         Block DataAnnotation with setInterval
// @namespace    http://tampermonkey.net/
// @version      .3
// @description  try to take over the world!
// @author       Gray Ayer
// @match        *://www.linkedin.com/jobs/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=linkedin.com
// @grant        none
// ==/UserScript==

(function() {
// concerned that it's not running? Or curious how many it's blocking? use the commented out console.log lines to doublecheck
// console.log("Script started");

// Every 1 second, check for new job listings and hide specific ones
setInterval(() => {
// console.log("Interval check running");
    document.querySelectorAll("li.jobs-search-results__list-item, section.artdeco-card").forEach((item, index) => {
        // console.log(`Checking item ${index}`);
        if (item.innerText.includes("DataAnnotation")) {
            // console.log(`Hiding item ${index}`);
            item.style.display = 'none';
        }
    });
}, 1000);

})();

This works well enough, but let’s try another route.

Changing our method to MutationObserver from setInterval

Initially, I employed a setInterval method, where the script periodically checked the page every few seconds to hide unwanted listings. This method was straightforward but not efficient, as it repeatedly ran whether new content appeared or not, potentially impacting performance.

Realizing this, I switched to using a MutationObserver, a more efficient tool that allows the script to react to changes in the DOM automatically. This approach means the script only runs when new job listings are added to the page, greatly reducing unnecessary processing and providing a cleaner, more performance-friendly solution.

JavaScript
// ==UserScript==
// @name         Remove DataAnnotation job listings on LinkedIn
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Hide specific job listings on LinkedIn using MutationObserver
// @author       Gray Ayer
// @match        https://www.linkedin.com/jobs/*
// @grant        none
// ==/UserScript==
// in case the script isn't having the desired effect, uncomment the alert to make sure the script is loading.
// alert('script running');
(function() {
    'use strict';
    // Function to hide job listings that contain "DataAnnotation"
    function hideDataAnnotationJobs() {
        document.querySelectorAll("li.jobs-search-results__list-item, li.discovery-templates-entity-item").forEach((item) => {
            if (item.innerText.includes("DataAnnotation")) {
                item.style.display = 'none';
            }
        });
    }
    // Function to set up the MutationObserver
    function setupObserver() {
        const targetNode = document.querySelector('ul.scaffold-layout__list-container'); // Adjust selector as needed
        if (targetNode) {
            const config = { childList: true, subtree: true };
            const observer = new MutationObserver((mutations) => {
                mutations.forEach((mutation) => {
                    if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
                        hideDataAnnotationJobs();
                    }
                });
            });
            observer.observe(targetNode, config);
        } else {
            console.error("Please modify Tampermonkey Script because the target node for MutationObserver is not found.");
        }
    }
    // Wait for the entire window to load before running the script
    window.onload = function() {
        setupObserver();
        // Run once immediately in case jobs are already on the page
        hideDataAnnotationJobs();
    };
})();

How to Test Your New ‘Exclude Companies’ Filter

Once you’ve installed the script in Tampermonkey, it’s important to ensure that it’s actively running and effectively cleaning up your job search results. Here’s a simple step-by-step guide to test your new customization:

  1. Check the Extension Status:
    • Open LinkedIn and click on the Tampermonkey icon in your browser’s extension area. Make sure there’s a green toggle next to your script, indicating that it’s active. If it’s not, click the toggle to activate it.
  2. Perform a Test Search:
    • Enter a job search on LinkedIn, using terms or company names that your script is designed to exclude. For example, if you’re filtering out “DataAnnotation,” type it into the search bar.
  3. Observe the Results:
    • Watch as listings from the excluded company or featuring the specific phrases magically disappear from the results. If you previously saw numerous listings from “DataAnnotation,” and now they’re gone, your script is working correctly.
  4. Fine-Tuning:
    • If some listings still slip through, you may need to adjust the script slightly. This could involve refining the text strings used for detection or ensuring the script targets the correct elements in LinkedIn’s ever-evolving page layout.

A Broader Lesson

This fix is a small one, but it speaks volumes about the broader capabilities of web developers. With just a few lines of code, I was able to significantly improve my job search experience on LinkedIn. More importantly, this experience underscores a critical point: being a web developer is about more than coding—it’s about transforming challenges into opportunities using our skills.

As I continue my search for a position that matches my expertise and aspirations, I am reminded of the power of not just accepting things as they are but taking action to mold them into something better. If you’re also navigating job boards and finding the process tedious or overwhelming, remember that sometimes, the tools to better the situation are already at your fingertips—or in your code editor!

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.