<commit_before>//Init variable
var clientID = "0bb1c26ce5d54ede9f37467517b9286a";
var url = "https://api.instagram.com/v1/tags/{*}/media/recent";

//Images
function displayImages(obj) {
    var str = "";
    $.each(obj, function(i, el) {
        /* iterate through array or object */
        str += '<li>' + '<ul class="cd-item-wrapper">' + '<li class="is-visible">' + '<a href="' + el.link + '" target="_blank">' +
            '<img src="' + el.images.standard_resolution.url + '" />' + '</a>' + '</li>' + '</ul>' + '</li>';
    });
    $('ul.cd-gallery').html(str);
}


//search function

$('form').on('submit', function(event) {
    event.preventDefault();
    /* Act on the event */
    var query = $('#search').val();

    $.ajax({
        url: url.replace('{*}', $.trim(query)) + "?callback=?",
        type: "GET",
        dataType: 'json',
        data: {
            client_id: clientID
        },
        beforeSend: function() {
            if (!$.trim(query)) {
                $("#search").addClass('animated swing error')
                return false;
            } else {
                if ($("#search").hasClass('animated swing error')) {
                    $("#search").removeClass('animated swing error');
                };
                $('ul.cd-gallery').html("<div class='loader1'><i></i><i></i></div>")
            }

        },
        success: function(a, b) {
            console.log("success", a.data, b);
            if (a.data.length) {
                displayImages(a.data);
            } else {
                $('ul.cd-gallery').html("<h3>Sorry, No Results for that query</h3>")
            }
        }
    })
        .done(function() {
            console.log("Done");
        })
        .fail(function() {
            console.log("error");
        })
        .always(function() {
            console.log("complete");
        });

});<commit_msg>updated js - ensure the variable are not global<commit_after>// Avoid `console` errors in browsers that lack a console.
(function() {
  //Init variable
var clientID = "0bb1c26ce5d54ede9f37467517b9286a";
var url = "https://api.instagram.com/v1/tags/{*}/media/recent";

//Images
function displayImages(obj) {
    var str = "";
    $.each(obj, function(i, el) {
        /* iterate through array or object */
        str += '<li>' + '<ul class="cd-item-wrapper">' + '<li class="is-visible">' + '<a href="' + el.link + '" target="_blank">' +
            '<img src="' + el.images.standard_resolution.url + '" />' + '</a>' + '</li>' + '</ul>' + '</li>';
    });
    $('ul.cd-gallery').html(str);
}


//search function

$('form').on('submit', function(event) {
    event.preventDefault();
    /* Act on the event */
    var query = $('#search').val();

    $.ajax({
        url: url.replace('{*}', $.trim(query)) + "?callback=?",
        type: "GET",
        dataType: 'json',
        data: {
            client_id: clientID
        },
        beforeSend: function() {
            if (!$.trim(query)) {
                $("#search").addClass('animated swing error')
                return false;
            } else {
                if ($("#search").hasClass('animated swing error')) {
                    $("#search").removeClass('animated swing error');
                };
                $('ul.cd-gallery').html("<div class='loader1'><i></i><i></i></div>")
            }

        },
        success: function(a, b) {
            console.log("success", a.data, b);
            if (a.data.length) {
                displayImages(a.data);
            } else {
                $('ul.cd-gallery').html("<h3>Sorry, No Results for that query</h3>")
            }
        }
    })
        .done(function() {
            console.log("Done");
        })
        .fail(function() {
            console.log("error");
        })
        .always(function() {
            console.log("complete");
        });

});

}());

{'fraction_non_alphanumeric': 0.20628380118465103, 'fraction_numerical': 0.012361576100952872, 'mean_word_length': 1.798270893371758, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '3972172', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1163, 'n_words': 226}