text: !function(n,e,t){"use strict";function o(){var e=n({});n.each({trigger:"publish",on:"subscribe",one:"subscribeOnce",off:"unsubscribe"},function(t,o){n[o]=function(){e[t].apply(e,arguments)}})}function i(e){n.publish("fotw.form.submitted",e)}function s(e){{var t="http://worldflags.dev/api/v1/areaMarkup";n.getJSON(t,e,function(){}).done(function(){}).fail(function(){}).always(function(e){n.publish("fotw.form.api.results",e)})}}function u(e){var t=n("#fotw-results-main"),o=t.find(".items-wrap");if(e&&e.status){var i=e.data.markup||"<p>the markup</p>";t.find(".no-items-wrap").remove(),o.remove(),t.prepend(i)}else console.log("there was an error");r("hide")}function r(n){var e=t.getElementById("fotw-results-main").getElementsByClassName("results-loader")[0]||null;n=n&&""!==n?n:"hide","show"===n?a(e,"in")||e.classList.add("in"):a(e,"in")&&e.classList.remove("in")}function a(n,e){return(" "+n.className+" ").indexOf(" "+e+" ")>-1}o(),n(t).foundation(),n(t).ready(function(){console.log("document.ready in app.js");var e=n("#fotw-search-form").find('input[name="s"]'),t=null,o=null;e.on("keyup",function(){var n=encodeURIComponent(this.value)||"",e=""===n,s=n!==o;s&&r("show"),clearTimeout(t),t=setTimeout(function(){!e&&s?i({s:n}):n!==o&&i({s:"_all"}),o=n},220)})}),n.subscribe("fotw.form.submitted",function(n,e){s(e)}),n.subscribe("fotw.form.api.results",function(n,e){u(e)})}(jQuery,window,document,void 0);