Skip to content

Instantly share code, notes, and snippets.

@veqtrus
Created March 2, 2020 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veqtrus/2f08cd6e73719e9b55a68b767631965d to your computer and use it in GitHub Desktop.
Save veqtrus/2f08cd6e73719e9b55a68b767631965d to your computer and use it in GitHub Desktop.
A bookmarklet for filtering listings by availability date and number of bedrooms.

Zoopla Filter Bookmarklet

A bookmarklet for filtering listings by availability date and number of bedrooms.

Create a bookmark with the following code as URL:

javascript:(function () { var query = prompt("Select months/bedrooms", "may,jun,jul,aug,sep").split(',').map(function (s) { return s.trim().slice(0, 3).toLowerCase(); }); var testBedrooms = query.some(function (q) { return (/\d+/).test(q); }); var listingResults = document.querySelector("ul.listing-results"); Array.from(document.querySelectorAll("ul.listing-results > li")).filter(function (li) { var from = li.getElementsByClassName("available-from"); if (from.length < 1) return true; from = from[0].innerText.split(' '); if (from.length < 4) return true; from = from[3].trim().slice(0, 3).toLowerCase(); if (!query.includes(from)) return true; if (testBedrooms) { var beds = li.getElementsByClassName("num-beds"); if (beds.length > 0) { beds = beds[0].innerText; if (!query.includes(beds)) return true; } } return false; }).forEach(function (li) { listingResults.removeChild(li); }); })();

License

Copyright © 2019-2020 Pavlos Georgiou

This bookmarklet is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar, which is reproduced below:

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                   Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

 0. You just DO WHAT THE FUCK YOU WANT TO.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment