<commit_before>$(document).foundation()

var Pokedex = {

    template: template = $("#li_template")
            .detach()
            .removeAttr("id"),

    addPokemonToList: function(pokemon) {
        var li = this.template.clone().bind(this);
        var list = $("#pokemon_list");
        var icon = li.find(".pokemon-icon");
        li.find(".pokemon-name").text(pokemon.pokemon_species.name);
        icon.attr("src", "http://pokeapi.co/media/sprites/pokemon/" + pokemon.entry_number + ".png");
        li.append(icon);
        list.append(li);
    },

    loadPokemon: function(pokemon) {
        $.each(pokemon.pokemon_entries, function(i, pokemon) {
            this.addPokemonToList(pokemon);
        }.bind(this));
    },

    getAllPokemon: function() {
        $.get({
            url: this.url,
        }).done(this.loadPokemon.bind(this));
    },

    init: function(url) {
        this.url = url;
        if(!/^.*\/$/.test(url))
            this.url += "/";

        this.getAllPokemon()
    },
};

Pokedex.init("https://pokeapi.co/api/v2/pokedex/2");<commit_msg>added click event handler<commit_after>$(document).foundation()

var Pokedex = {

    template: template = $("#li_template")
            .detach()
            .removeAttr("id"),

    addPokemonToList: function(pokemon) {
        var li = this.template.clone().bind(this);
        var list = $("#pokemon_list");
        var icon = li.find(".pokemon-icon");
        li.find(".pokemon-name").text(pokemon.pokemon_species.name);
        icon.attr("src", "http://pokeapi.co/media/sprites/pokemon/" + pokemon.entry_number + ".png");
        li.append(icon);
        list.append(li);
    },

    loadPokemon: function(pokemon) {
        $.each(pokemon.pokemon_entries, function(i, pokemon) {
            this.addPokemonToList(pokemon);
        }.bind(this));
    },

    getAllPokemon: function() {
        $.get({
            url: this.url,
        }).done(this.loadPokemon.bind(this));
    },

    init: function(url) {
        this.url = url;
        if(!/^.*\/$/.test(url))
            this.url += "/";

        this.getAllPokemon();

        $(document).on("click", "li.pokedex-entry.clickable", function(ev) {
            ev.preventDefault();
            console.log(ev.currentTarget);
        })
    },
};

Pokedex.init("https://pokeapi.co/api/v2/pokedex/2");
{'fraction_non_alphanumeric': 0.1841880341880342, 'fraction_numerical': 0.0017094017094017094, 'mean_word_length': 2.193724420190996, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '279216', 'n_tokens_mistral': 813, 'n_tokens_neox': 796, 'n_words': 101}