Skip to content

Instantly share code, notes, and snippets.

@modestemax
Last active August 29, 2015 14:17
Show Gist options
  • Save modestemax/9e71e43908f583845640 to your computer and use it in GitHub Desktop.
Save modestemax/9e71e43908f583845640 to your computer and use it in GitHub Desktop.
create a bookmarklet to extract iata airports
//window.location.href='http://www.world-airport-codes.com/alphabetical/city-name/b.html'
var all=$('.table-link');
all=all.filter(function(i,e){
return $('td:nth-child(4)',e).text()
});
all=all.map(function(i,e){
return {
'Airport':$(':nth-child(1)',e).first().text(),
'City':$(':nth-child(2)',e).first().text(),
'Country':$(':nth-child(3)',e).first().text(),
'IATA':$(':nth-child(4)',e).first().text()
};
});
all=all.toArray();
$('body').html('<pre>'+JSON.stringify(all,4,4)+'</pre>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment