{"size": 1413, "ext": "js", "max_stars_repo_path": "example/live_w_locator.js", "max_stars_repo_name": "nagaozen/quaggaJS", "max_stars_repo_stars_event_min_datetime": "2015-01-16T06:58:51.000Z", "max_stars_repo_stars_event_max_datetime": "2015-05-21T07:57:46.000Z", "max_issues_repo_path": "example/live_w_locator.js", "max_issues_repo_name": "nagaozen/quaggaJS", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "example/live_w_locator.js", "max_forks_repo_name": "nagaozen/quaggaJS", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.4, "max_line_length": 150, "alphanum_fraction": 0.4366595895}
$(function() {
    var App = {
        init : function() {
            Quagga.init({
                inputStream : {
                    name : "Live",
                    type : "LiveStream"
                },
                decoder : {
                    readers : ["code_128_reader"]
                },
                readyFunc : function() {
                    App.attachListeners();
                    Quagga.start();
                }
            });
        },
        attachListeners : function() {
            $(".controls .reader-group").on("change", "input", function(e) {
                e.preventDefault();
                Quagga.setReaders([e.target.value + "_reader"]);
            });
        },
        detachListeners : function() {
            $(".controls .reader-group").off("change", "input");
        },
        lastResult : null
    };

    App.init();

    Quagga.onDetected(function(result) {
        if (App.lastResult !== result) {
            App.lastResult = result;
            var $node = null, canvas = Quagga.canvas.dom.image;

            $node = $('<li><div class="thumbnail"><div class="imgWrapper"><img /></div><div class="caption"><h4 class="code"></h4></div></div></li>');
            $node.find("img").attr("src", canvas.toDataURL());
            $node.find("h4.code").html(result);
            $("#result_strip ul.thumbnails").prepend($node);
        }
    });

});
