// Based on the example in the jQuery Air course example. var filteredFlights, flight, showFlights; $("#tabs ul li a").bind({ click: changeTab, mouseenter: showNumberOfFlights, mouseleave: hideNumberOfFlights }); showFlights = function(activeDiv) { var fetchingFlights; $("#tabs div").hide(); if (fetchingFlights) { fetchingFlights.abort(); } return fetchingFlights = $.ajax('/flights', { data: { date: activeDiv }, cache: false, error: function(result) { if (result.statusText !== "abort") { return $("#tabs #error").show(); } } }); }; filteredFlights = []; currentFlights.forEach(function(index, flight) { if (stops === '2+' || flight.routing === 0) { return filteredFlights.push(flight); } }); // Better, using a list comprehension filteredFlights = (function() { var i, len, results; results = []; for (i = 0, len = currentFlights.length; i < len; i++) { flight = currentFlights[i]; if (stops === '2+' || flight.routing === 0) { results.push(flight); } } return results; })(); //# sourceMappingURL=5-1-jquery.js.map