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

    $('#post').submit(function (event) {
        event.preventDefault();
        $(':submit').button('loading');
        $.ajax({
            url: '/thread',
            data: {
                submission: $('input[name="submission"]').val(),
                email: $('input[name="email"]:first').val(),
                kindle_address: $('select[name="kindle_address"]:first').val()
            },
            type: 'POST',
            beforeSend: function (xhr) {
                xhr.setRequestHeader('X-CSRFToken', $('input[name=csrf_token]:first').attr('value'))
            }
        })
            .done(function (data) {
                $(':submit').button('reset');
                $('.modal-text').text(data.text);
                $('.modal-body').removeClass().addClass('modal-body alert alert-' + data.type);
                $('#message').modal('show');
                if (data.type == 'success') {
                    $('#post')[0].reset();
                }
            });
    });

    $('#subreddit').submit(function (event) {
        event.preventDefault();
        $(':submit').button('loading');
        $.ajax({
            url: '/subreddit',
            data: {
                subreddit: $('input[name="subreddit"]').val(),
                time: $('select[name="time"]').val(),
                limit: $('input[name="limit"]').val(),
                email: $('input[name="email"]:last').val(),
                kindle_address: $('select[name="kindle_address"]:last').val()
            },
            type: 'POST',
            beforeSend: function (xhr) {
                xhr.setRequestHeader('X-CSRFToken', $('input[name=csrf_token]:last').attr('value'))
            }
        })
            .done(function (data) {
                $(':submit').button('reset');
                $('.modal-text').text(data.text);
                $('.modal-body').removeClass().addClass('modal-body alert alert-' + data.type);
                $('#message').modal('show');
                if (data.type == 'success') {
                    $('#subreddit')[0].reset();
                }
            });
    });

    $('.collapse').on('show.bs.collapse hide.bs.collapse', function (n) {
        $(n.target).siblings('.panel-heading').find('a i').toggleClass('fa-chevron-up fa-chevron-down');
    });
});

<commit_msg>Fix panel icon changing, and store user email using HTML5 storage<commit_after>$(document).ready(function () {

    var storage = window.localStorage;
    if (storage.email) {
        $('input[name="email"]').val(storage.email);
    }

    $('#post').submit(function (event) {
        event.preventDefault();
        storage.email = $('input[name="email"]').val();
        $(':submit').button('loading');
        $.ajax({
            url: '/thread',
            data: {
                submission: $('input[name="submission"]').val(),
                email: $('input[name="email"]:first').val(),
                kindle_address: $('select[name="kindle_address"]:first').val()
            },
            type: 'POST',
            beforeSend: function (xhr) {
                xhr.setRequestHeader('X-CSRFToken', $('input[name=csrf_token]:first').attr('value'))
            }
        })
            .done(function (data) {
                $(':submit').button('reset');
                $('.modal-text').text(data.text);
                $('.modal-body').removeClass().addClass('modal-body alert alert-' + data.type);
                $('#message').modal('show');
                if (data.type == 'success') {
                    $('#post')[0].reset();
                    $('input[name="email"]').val(storage.email)
                }
            });
    });

    $('#subreddit').submit(function (event) {
        event.preventDefault();
        storage.email = $('input[name="email"]').val();
        $(':submit').button('loading');
        $.ajax({
            url: '/subreddit',
            data: {
                subreddit: $('input[name="subreddit"]').val(),
                time: $('select[name="time"]').val(),
                limit: $('input[name="limit"]').val(),
                email: $('input[name="email"]:last').val(),
                kindle_address: $('select[name="kindle_address"]:last').val()
            },
            type: 'POST',
            beforeSend: function (xhr) {
                xhr.setRequestHeader('X-CSRFToken', $('input[name=csrf_token]:last').attr('value'))
            }
        })
            .done(function (data) {
                $(':submit').button('reset');
                $('.modal-text').text(data.text);
                $('.modal-body').removeClass().addClass('modal-body alert alert-' + data.type);
                $('#message').modal('show');
                if (data.type == 'success') {
                    $('#subreddit')[0].reset();
                    $('input[name="email"]').val(storage.email)
                }
            });
    });

    $('.collapse').on('show.bs.collapse hide.bs.collapse', function (n) {
        $(n.target).siblings('a').find('div h4 i').toggleClass('fa-chevron-up fa-chevron-down');
    });
});


{'fraction_non_alphanumeric': 0.21208576998050682, 'fraction_numerical': 0.0011695906432748538, 'mean_word_length': 1.7705183585313176, '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': '2198326', 'n_tokens_mistral': 1455, 'n_tokens_neox': 1402, 'n_words': 183}