Seek-BAdvertisers

Hides agency adverts on Seek

  1. // ==UserScript==
  2. // @name Seek-BAdvertisers
  3. // @namespace https://github.com/BoKu/Seek-BAdvertisers
  4. // @version 0.3
  5. // @description Hides agency adverts on Seek
  6. // @homepage https://github.com/BoKu/Seek-BAdvertisers
  7. // @supportURL https://github.com/BoKu/Seek-BAdvertisers/pulls
  8. // @author BoKu
  9. // @match *://*.seek.com.au/*
  10. // @match *://*.seek.co.nz/*
  11. // @license Creative Commons Attribution-ShareAlike 3.0 Unported License.
  12. // ==/UserScript==
  13. (function() {
  14. 'use strict';
  15. const jsonuri = 'https://raw.githubusercontent.com/BoKu/Seek-BAdvertisers/main/badvertisers.json';
  16. const strAdSection = "[data-search-sol-meta]";
  17. const strAdNameClass = ".l2mi890";
  18.  
  19. var DeleteAds = function (badvertisers) {
  20. const JobsArray = document.querySelectorAll(strAdSection);
  21. if(badvertisers){
  22. JobsArray.forEach(Ad =>{
  23. const badvertiseName = Ad.querySelector(strAdNameClass).innerText;
  24. if(badvertisers.includes(badvertiseName)){
  25. Ad.remove();
  26. console.debug("Deleted Ad By:", badvertiseName);
  27. }
  28. })
  29. }
  30. };
  31.  
  32. var xhr = new XMLHttpRequest();
  33. xhr.open('GET', jsonuri, true);
  34. xhr.responseType = 'json';
  35. xhr.onload = function() {
  36. var status = xhr.status;
  37. if (status === 200) {
  38. console.debug(xhr.response);
  39. DeleteAds(xhr.response);
  40. } else {
  41. console.debug(status, xhr.response);
  42. }
  43. };
  44. xhr.send();
  45.  
  46. })();