Seek-BAdvertisers

Hides agency adverts on Seek

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

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

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

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

您需要先安装一款用户脚本管理器扩展,例如 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();

})();