Last active
June 29, 2019 21:52
-
-
Save vandonr/eb5e1d7a65336bc6bf2ac4d25f4b1264 to your computer and use it in GitHub Desktop.
Roadstr filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//meant to be run on www.roadstr.fr search results page | |
//open console and paste this | |
//change upper/wanted | |
//run | |
// | |
//filtered cars are just hidden, so you don't need to refresh the page to re-run the script with different parameters | |
var upper = 175; | |
var wanted = null; //try with Peugeot | |
var cars = document.getElementsByClassName("car-item-container"); | |
for (var c = 0; c < cars.length; c++){ | |
car = cars[c]; | |
var price = parseInt(car.getElementsByClassName("car-item-btn")[0].innerText); | |
if(price > upper){ | |
car.style.display = "none"; | |
continue; | |
} | |
var brand = car.getElementsByClassName("car-item-name")[0].innerText.split(" ")[0]; | |
if(wanted && brand != wanted) | |
{ | |
car.style.display = "none"; | |
continue; | |
} | |
car.style.display = "inline-block"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment