Skip to content

Instantly share code, notes, and snippets.

@elmendalerenda
Created June 1, 2013 18:49
Show Gist options
  • Save elmendalerenda/5691347 to your computer and use it in GitHub Desktop.
Save elmendalerenda/5691347 to your computer and use it in GitHub Desktop.
Search Dublin apartments in Luas green line
//do to http://www.daft.ie/lettings/ and run:
function selectOption(selector, optionsToSelect){
var items = document.querySelectorAll(selector + ' > option');
for (var item of items) {
for(var i = 0; i < optionsToSelect.length; i++){
if(item.text.match(optionsToSelect[i]) ){
item.selected = true;
console.log(item.text);
}
}
}
}
var places = '#pt_id';
var selectedPlace = [/^Apartment/];
var leases = '#lease';
var selectedLeases = [/6 Month/];
var areas = '#a_id';
var selectedAreas = [/Ranelagh/, /Windy Arbour/, /Dundrum/ , /Stillorgan/ , /Sandyford/ , /Leopardstown/ , /Churchtown/ , /Milltown/ ];
selectOption(areas, selectedAreas);
selectOption(places, selectedPlace);
selectOption(leases, selectedLeases);
var furnished = document.querySelector('#furnished_2');
furnished.checked = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment