<commit_before>$(document).ready(function() {
  $(document).foundation();


  if (typeof token !== 'undefined') {
    // Delete multiple photos.
    $('.delete-photos').on('click', function(e) {
        e.preventDefault();
        window.selectedPhotos.forEach(function(photo, idx) {
            $.ajax({
                url: '/photos/api/' + photo,
                method: 'delete',
                headers: {
                    Authorization: 'Token ' + token,
                    contentType: 'application/json; charset=utf-8',
                },
                success: function(data) {
                    console.log('deleted ID: ' + photo + ' data:', data);
                    if (window.selectedPhotos.length == idx + 1) {
                        window.location.reload();
                    }
                }
            });
        });
    });

    // Remove multiple photos from an album.
    $('.remove-photos').on('click', function(e) {
        e.preventDefault();
        var albumId = $(this).data().id;
        var postData = '&photo_ids=' + window.selectedPhotos.toString();
        postData += '&csrfmiddlewaretoken=' + $('[name="csrfmiddlewaretoken"]').val();

        window.selectedPhotos.forEach(function(photo, idx) {
            $.ajax({
                url: '/albums/api/' + albumId + '/remove_photos',
                method: 'post',
                data: postData,
                headers: {
                    Authorization: 'Token ' + token,
                    contentType: 'application/json; charset=utf-8',
                },
                success: function(data) {
                    console.log('removed-photos data:', data);
                    window.location.reload();
                }
            });
        });
    });

    $.ajax({
        url: '/albums/api',
        headers: {<commit_msg>Added a confirmation for deletions.<commit_after>$(document).ready(function() {
  $(document).foundation();


  if (typeof token !== 'undefined') {
    // Delete multiple photos.
    $('.delete-photos').on('click', function(e) {
        e.preventDefault();
        if (window.confirm("Really delete these photos?")) {
            window.selectedPhotos.forEach(function(photo, idx) {
                $.ajax({
                    url: '/photos/api/' + photo,
                    method: 'delete',
                    headers: {
                        Authorization: 'Token ' + token,
                        contentType: 'application/json; charset=utf-8',
                    },
                    success: function(data) {
                        console.log('deleted ID: ' + photo + ' data:', data);
                        if (window.selectedPhotos.length == idx + 1) {
                            window.location.reload();
                        }
                    }
                });
            });
        }
    });

    // Remove multiple photos from an album.
    $('.remove-photos').on('click', function(e) {
        e.preventDefault();
        var albumId = $(this).data().id;
        var postData = '&photo_ids=' + window.selectedPhotos.toString();
        postData += '&csrfmiddlewaretoken=' + $('[name="csrfmiddlewaretoken"]').val();

        window.selectedPhotos.forEach(function(photo, idx) {
            $.ajax({
                url: '/albums/api/' + albumId + '/remove_photos',
                method: 'post',
                data: postData,
                headers: {
                    Authorization: 'Token ' + token,
                    contentType: 'application/json; charset=utf-8',
                },
                success: function(data) {
                    console.log('removed-photos data:', data);
                    window.location.reload();
                }
            });
        });
    });

    $.ajax({
        url: '/albums/api',
        headers: {
{'fraction_non_alphanumeric': 0.1476178078625358, 'fraction_numerical': 0.0015620932048945586, 'mean_word_length': 1.3686806411837238, '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': '3552294', 'n_tokens_mistral': 1013, 'n_tokens_neox': 935, 'n_words': 181}