Advertisement
Guest User

Untitled

a guest
May 7th, 2019
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Blacklist locations on OLX
  3. // @namespace    olxisshit
  4. // @version      1.1
  5. // @description  Hide offers from certain locations on OLX
  6. // @author       copychef
  7. // @match        https://www.olx.pl/nieruchomosci/mieszkania/*
  8. // @grant        none
  9. // @require      https://gist.github.com/raw/2625891/waitForKeyElements.js
  10. // ==/UserScript==
  11.  
  12. var blacklistedDistricts = ["Białołęka", "Bielany", "Targówek", "Praga-Południe", "Praga-Północ", "Wilanów", "Ursus", "Bemowo"];
  13.  
  14. function filterOffer(offer) {
  15.     var localization = $(".bottom-cell span", offer).text();
  16.  
  17.     var isBlacklisted = blacklistedDistricts.some(function(district) {
  18.         return localization.indexOf(district) >= 0;
  19.     });
  20.  
  21.     if (isBlacklisted) {
  22.         offer.hide();
  23.     }
  24. }
  25.  
  26. (function() {
  27.     'use strict';
  28.     waitForKeyElements("#offers_table > tbody > tr.wrap", filterOffer);
  29.     waitForKeyElements(".fixed.offers > tbody > tr.wrap", filterOffer);
  30. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement