Skip to content

Instantly share code, notes, and snippets.

@aleskiontherun
Last active August 29, 2015 13:56
Show Gist options
  • Save aleskiontherun/9258020 to your computer and use it in GitHub Desktop.
Save aleskiontherun/9258020 to your computer and use it in GitHub Desktop.
Log "country - cities" from Ryanair compact destination cities list
/**
* 1. Selct a city in the "From" field list
* 2. Open the "To" field list
*
* Some times there is a simple cities list without countries, which is very uncomfortable
* This gist is for those cases
*
* 3. Copy this code into your Firebug (or other) console and execute
*
* Don't forget to perform step 2 every time you select a new "From" city
*
*/
var findCountry = function(city) {
var c, cc, els = $("#fromRoutes .routeBlock > *");
els.each(function(a, b) {
var t = $(b).text();
if (b.tagName == "H4")
c = $(b).text();
else if ($(b).text() == city)
cc = c;
});
return cc;
};
var o = {};
$("#toRoutes .routeBlock > a").each(function(a, b) {
var c = $(b).text();
var cc = findCountry(c);
if (cc == "Ireland" || cc == "UK")
return;
if (!o[cc]) o[cc] = [];
o[cc].push(c);
});
console.dir(o);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment