<commit_before>jQuery(document).ready(function($) {
    var container = $('#splashing_images');
    $.LoadingOverlaySetup({
        color           : "rgba(241,241,241,0.8)",
        maxSize         : "80px",
        minSize         : "20px",
        resizeInterval  : 0,
        size            : "30%"
    });

    $('a.upload').click(function(e){
        var element = $(this);
        var image = element.find('img');
        // If not saving, then proceed
        if(!element.hasClass('saving')){
            element.addClass('saving');
            e.preventDefault();
            var payload = { source : $(this).data('source'), author: $(this).data('author'), credit: $(this).data('credit')};
            payload[window.csrfTokenName] = window.csrfTokenValue;
            $.ajax({
                type: 'POST',
                url: Craft.getActionUrl('unsplash/download/save'),
                dataType: 'JSON',
                data: payload,
                beforeSend: function() {
                    image.LoadingOverlay("show");
                },
                success: function(response) {
                    image.LoadingOverlay("hide");
                    Craft.cp.displayNotice(Craft.t('Image saved!'));

                },
                error: function(xhr, status, error) {
                    Craft.cp.displayError(Craft.t('Oops, something went wrong!'));
                }
            });
        };
    });<commit_msg>Hide overlay on ajax error<commit_after>jQuery(document).ready(function($) {
    var container = $('#splashing_images');
    $.LoadingOverlaySetup({
        color           : "rgba(241,241,241,0.8)",
        maxSize         : "80px",
        minSize         : "20px",
        resizeInterval  : 0,
        size            : "30%"
    });

    $('a.upload').click(function(e){
        var element = $(this);
        var image = element.find('img');
        // If not saving, then proceed
        if(!element.hasClass('saving')){
            element.addClass('saving');
            e.preventDefault();
            var payload = { source : $(this).data('source'), author: $(this).data('author'), credit: $(this).data('credit')};
            payload[window.csrfTokenName] = window.csrfTokenValue;
            $.ajax({
                type: 'POST',
                url: Craft.getActionUrl('unsplash/download/save'),
                dataType: 'JSON',
                data: payload,
                beforeSend: function() {
                    image.LoadingOverlay("show");
                },
                success: function(response) {
                    image.LoadingOverlay("hide");
                    Craft.cp.displayNotice(Craft.t('Image saved!'));

                },
                error: function(xhr, status, error) {
                    image.LoadingOverlay("hide");
                    Craft.cp.displayError(Craft.t('Oops, something went wrong!'));
                }
            });
        };
    });
{'fraction_non_alphanumeric': 0.150253807106599, 'fraction_numerical': 0.012182741116751269, 'mean_word_length': 1.5417024935511607, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5702098', 'n_tokens_mistral': 813, 'n_tokens_neox': 760, 'n_words': 135}