{"size": 1267, "ext": "js", "max_stars_repo_path": "app/controllers/intentController.client.js", "max_stars_repo_name": "Aioros/fcc-nighttime-app", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/controllers/intentController.client.js", "max_issues_repo_name": "Aioros/fcc-nighttime-app", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/controllers/intentController.client.js", "max_forks_repo_name": "Aioros/fcc-nighttime-app", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 35.1944444444, "max_line_length": 80, "alphanum_fraction": 0.4632991318}
$(function() {
    
    var apiUrl = appUrl + '/api/bars';
    
    $(".search").submit(function() {
        var query = $("#search").val();
        if (query === "")
            return false;
        
        $(".bar:not(.placeholder)").remove();
        $.getJSON(apiUrl, {q: query}, function(data) {
            data.businesses.forEach(function(bar) {
                var barEl = $(".bar.placeholder").clone();
                barEl.find(".bar-thumbnail img").attr("src", bar.image_url);
                barEl.find(".bar-title a").text(bar.name).attr("href", bar.url);
                barEl.find(".bar-intents-count").text(bar.intents.length);
                if (bar.snippet_text)
                    barEl.find(".bar-text").text('"' + bar.snippet_text + '"');
                barEl
                    .attr("data-id", bar.id)
                    .removeClass("placeholder")
                    .appendTo(".bars");
            });
        });
        
        return false;
    });
    
    $(document).on("click", "body.authed .bar-intents", function() {
        var bar = $(this).closest(".bar");
        $.post(apiUrl, {barId: bar.attr("data-id")}, function(result) {
            bar.find(".bar-intents-count").text(result.count);
        });
    });
    
});