Seek-BAdvertisers

Hides agency adverts on Seek

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Seek-BAdvertisers
// @namespace    https://github.com/BoKu/Seek-BAdvertisers
// @version      0.3
// @description  Hides agency adverts on Seek
// @homepage     https://github.com/BoKu/Seek-BAdvertisers
// @supportURL   https://github.com/BoKu/Seek-BAdvertisers/pulls
// @author       BoKu
// @match        *://*.seek.com.au/*
// @match        *://*.seek.co.nz/*
// @license 	 Creative Commons Attribution-ShareAlike 3.0 Unported License.
// ==/UserScript==
(function() {
    'use strict';
    const jsonuri = 'https://raw.githubusercontent.com/BoKu/Seek-BAdvertisers/main/badvertisers.json';
    const strAdSection = "[data-search-sol-meta]";
    const strAdNameClass = ".l2mi890";

    var DeleteAds = function (badvertisers) {
        const JobsArray = document.querySelectorAll(strAdSection);
        if(badvertisers){
            JobsArray.forEach(Ad =>{
                const badvertiseName = Ad.querySelector(strAdNameClass).innerText;
                if(badvertisers.includes(badvertiseName)){
                    Ad.remove();
                    console.debug("Deleted Ad By:", badvertiseName);
                }
            })
        }
    };

    var xhr = new XMLHttpRequest();
    xhr.open('GET', jsonuri, true);
    xhr.responseType = 'json';
    xhr.onload = function() {
        var status = xhr.status;
        if (status === 200) {
            console.debug(xhr.response);
            DeleteAds(xhr.response);
        } else {
            console.debug(status, xhr.response);
        }
    };
    xhr.send();

})();