<commit_before>//Configure RequireJS
require({
    paths:{ 'jquery': 'jquery' },
    priority: ['jquery']
});

require(['jquery', 'utils/css', 'utils/pubsub', 'sammy', 'gallery', 'text!css/reset.css', 'text!css/theme.css'], function($, css, pubsub, sammy, gallery, reset, theme) {
    css.loadInternal(reset, 'css/reset.css', true);
    css.loadInternal(theme, 'css/theme.css');

    //get data and populate
    $.ajax({
        //url: "data/baby-animals.json",
        url: "data/baby-animals-with-audio.json",
        dataType: "json",
        success: function(data) {
            gallery.populate(data, setupHistory);
        }
    });

    //-----subscribe to flipcard-select event
    pubsub.on('flipcard-selected', function(flipCard) {
        //change the history hash, let the Sammy route do the rest
        window.location.hash = "/flipcard/" + flipCard.id;
    });

    function setupHistory() {
        var singlePageApp = $.sammy(function() {
            //select a flipcard based on the URL
            this.get('#/flipcard/:flipcard', function() {
                var flipCard = gallery.getFlipCard(this.params['flipcard']);<commit_msg>added commented example of how to load modules on demand.<commit_after>//Configure RequireJS
require({
    paths:{ 'jquery': 'jquery' },
    priority: ['jquery']
});

require(['jquery', 'utils/css', 'utils/pubsub', 'sammy', 'gallery', 'text!css/reset.css', 'text!css/theme.css'], function($, css, pubsub, sammy, gallery, reset, theme) {
    css.loadInternal(reset, 'css/reset.css', true);
    css.loadInternal(theme, 'css/theme.css');

    //get data and populate
    $.ajax({
        //url: "data/baby-animals.json",
        url: "data/baby-animals-with-audio.json",
        dataType: "json",
        success: function(data) {
            gallery.populate(data, setupHistory);
        }
    });


    /*  Example of how to load modules on demand.
     *  This helps speed up page load time
     *  by not loading code/markup/styles that aren't  needed yet
    */ 
    //$('#feedback').click(function(e){
    //   require(['feedback'], function(feedback){
    //      //use the feedback module now that it is loaded    
    //   });
    //});

    //-----subscribe to flipcard-select event
    pubsub.on('flipcard-selected', function(flipCard) {
        //change the history hash, let the Sammy route do the rest
        window.location.hash = "/flipcard/" + flipCard.id;
    });

    function setupHistory() {
        var singlePageApp = $.sammy(function() {
            //select a flipcard based on the URL
            this.get('#/flipcard/:flipcard', function() {
                var flipCard = gallery.getFlipCard(this.params['flipcard']);
{'fraction_non_alphanumeric': 0.1614100185528757, 'fraction_numerical': 0.0, 'mean_word_length': 2.5898801597869507, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4074373', 'n_tokens_mistral': 829, 'n_tokens_neox': 794, 'n_words': 201}