" })), $("#top5-api-readings").empty().append(s); var l = $("#dropdown-state"), r = $("#dropdown-location"), p = $(".for-side.dropdown-results"), d = Object.keys(o).map((function (e) { return '
" })); if (d.unshift('
'), l.empty().append(d.join("")), l.change((function () { var e = o[this.value].locations.map((function (e) { return '
" })); e.unshift('
'), r.removeAttr("disabled").empty().append(e.join("")), p.hide() })), r.change((function () { var e = l.val(), t = this.value, a = { state: e, place: t }; createCookie("HazeApi", JSON.stringify(a), 30), ga("send", "event", "Haze API", "click", t); var n = o[e].locations.indexOf(t), i = o[e].latest[n]; p.show().removeClass().addClass("for-side dropdown-results " + getAPILevelCSSClass(i)).empty().append("
" + i + " " + getAPILevel(i) + "
") })), null != readCookie("HazeApi")) { var c = jQuery.parseJSON(readCookie("HazeApi")).state, u = jQuery.parseJSON(readCookie("HazeApi")).place; selectDropdown("dropdown-state", c); var v = o[c].locations.map((function (e) { return '" })); v.unshift(''), $("#dropdown-location").removeAttr("disabled").empty().append(v.join("")), selectDropdown("dropdown-location", u); var h = o[c].locations.indexOf(u), f = o[c].latest[h]; p.show().removeClass().addClass("for-side dropdown-results " + getAPILevelCSSClass(f)).empty().append("
" + f + " " + getAPILevel(f) + "
") } function getAPILevel(e) { return e <= 50 ? "GOOD" : e <= 100 ? "MODERATE" : e <= 200 ? "UNHEALTHY" : e <= 300 ? "VERY UNHEALTHY" : "HAZARDOUS" } function getAPILevelCSSClass(e) { return e <= 50 ? "good" : e <= 100 ? "moderate" : e <= 200 ? "unhealthy" : e <= 300 ? "very-unhealthy" : "hazardous" } }));