<commit_before>var prep_details_page = (function() {
    "use strict";
    var last_description,
        code_mirror,
        user_template;

    user_template = Handlebars.compile($("#user-access-item").text());

    function description_focus() {
        last_description = $("#dataset_description").val();
    }

    function delete_dataset() {
        $.ajax({
            type: "POST",
            url: window.location.href+"/delete",
            data: {
                'csrfmiddlewaretoken': $("input[name='csrfmiddlewaretoken']").val()
            },
            success: function() {
                window.location.href = "/";
            }
        });

    }

    function update_description() {
        var new_description = $("#dataset_description").val();

        if (last_description == new_description) {
            return;
        }
        $.ajax({
            type: "POST",
            url: window.location.href+"/patch_description",
            data: {
                "description": new_description,
                'csrfmiddlewaretoken': $("input[name='csrfmiddlewaretoken']").val()
            },
        });

    }

    function update_sql() {
        var sql = code_mirror.getValue();

        $.ajax({
            type: "POST",
            url: window.location.href+"/patch_sql",
            data: {
                "dataset_sql": sql,
                'csrfmiddlewaretoken': $("input[name='csrfmiddlewaretoken']").val()
            },
        });

    }


    function make_private() {
        $.ajax({
            type: "POST",
            url: window.location.href+"/toggle_public",
            data: {
                "is_public": "0",
                'csrfmiddlewaretoken': $("input[name='csrfmiddlewaretoken']").val()
            },
            success: show_make_public
        });
    }


    function make_public() {
        $.ajax({
            type: "POST",
            url: window.location.href+"/toggle_public",
            data: {
                "is_public": "1",
                'csrfmiddlewaretoken': $("input[name='csrfmiddlewaretoken']").val()
            },
            success: show_make_private
        });
    }

    function show_make_private() {
        $("#make_dataset_public").hide();
        $("#make_dataset_private").show();
    }

    function show_make_public() {
        $("#make_dataset_private").hide();
        $("#make_dataset_public").show();
    }

    function addUserOnEnter(ev) {
        if (ev.keyCode === 13) {
            var content = user_template({ username: $("#exampleInputEmail1").val() });
            $("#dataset_access_list").append($(content));
            $('#user-autocomplete-container #exampleInputEmail1').typeahead('close');
            $('#user-autocomplete-container #exampleInputEmail1').typeahead('val', "");
            $("#exampleInputEmail1").val("");
        }
    }

    function prep_typeahed() {
        var users = new Bloodhound({
            datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
            queryTokenizer: Bloodhound.tokenizers.whitespace,
            remote: {
                url: '/user_search/%QUERY',
                wildcard: '%QUERY'
            }
        });

        $('#user-autocomplete-container #exampleInputEmail1').typeahead(null, {
          name: 'user-list',
          display: 'login',
          source: users
        });


        $("#exampleInputEmail1").on("keypress", addUserOnEnter);
    }

    function save_permissions() {
        var checked = $("input[name='dataset_account']:checked");
        var len = checked.length;

        var accounts = [];
        for (var i = 0; i < len; i++) {
            accounts.push(checked[i].value);
        }

        $.ajax({
            type: "POST",
            url: window.location.href+"/permissions",
            data: {
                "accounts": accounts,
                'csrfmiddlewaretoken': $("input[name='csrfmiddlewaretoken']").val()
            },
            success: hide_sharing_panel
        });

    }

    function hide_sharing_panel() {
        $("#share_modal").modal('hide');
    }

    function show_permissions_panel(data) {
        $("#dataset_access_list").html("");
        for (var i = 0; i < data.length; i++) {
            var content = user_template({ username: data[i] });
            $("#dataset_access_list").append($(content));
        }
        $("#sharing-modal-loading").hide();
        $("#sharing-modal-display").show();
    }
<commit_msg>Making it so hiting save adds the username still in the textbox<commit_after>var prep_details_page = (function() {
    "use strict";
    var last_description,
        code_mirror,
        user_template;

    user_template = Handlebars.compile($("#user-access-item").text());

    function description_focus() {
        last_description = $("#dataset_description").val();
    }

    function delete_dataset() {
        $.ajax({
            type: "POST",
            url: window.location.href+"/delete",
            data: {
                'csrfmiddlewaretoken': $("input[name='csrfmiddlewaretoken']").val()
            },
            success: function() {
                window.location.href = "/";
            }
        });

    }

    function update_description() {
        var new_description = $("#dataset_description").val();

        if (last_description == new_description) {
            return;
        }
        $.ajax({
            type: "POST",
            url: window.location.href+"/patch_description",
            data: {
                "description": new_description,
                'csrfmiddlewaretoken': $("input[name='csrfmiddlewaretoken']").val()
            },
        });

    }

    function update_sql() {
        var sql = code_mirror.getValue();

        $.ajax({
            type: "POST",
            url: window.location.href+"/patch_sql",
            data: {
                "dataset_sql": sql,
                'csrfmiddlewaretoken': $("input[name='csrfmiddlewaretoken']").val()
            },
        });

    }


    function make_private() {
        $.ajax({
            type: "POST",
            url: window.location.href+"/toggle_public",
            data: {
                "is_public": "0",
                'csrfmiddlewaretoken': $("input[name='csrfmiddlewaretoken']").val()
            },
            success: show_make_public
        });
    }


    function make_public() {
        $.ajax({
            type: "POST",
            url: window.location.href+"/toggle_public",
            data: {
                "is_public": "1",
                'csrfmiddlewaretoken': $("input[name='csrfmiddlewaretoken']").val()
            },
            success: show_make_private
        });
    }

    function show_make_private() {
        $("#make_dataset_public").hide();
        $("#make_dataset_private").show();
    }

    function show_make_public() {
        $("#make_dataset_private").hide();
        $("#make_dataset_public").show();
    }

    function addUserOnEnter(ev) {
        if (ev.keyCode === 13) {
            addUserFromInput();
        }
    }

    function addUserFromInput() {
        var username = $("#exampleInputEmail1").val();
        username = username.replace(/^ +/, "").replace(/ +$/, "");

        if (username) {
            var content = user_template({ username: username });
            $("#dataset_access_list").append($(content));
        }
        $('#user-autocomplete-container #exampleInputEmail1').typeahead('close');
        $('#user-autocomplete-container #exampleInputEmail1').typeahead('val', "");
        $("#exampleInputEmail1").val("");
    }

    function prep_typeahed() {
        var users = new Bloodhound({
            datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
            queryTokenizer: Bloodhound.tokenizers.whitespace,
            remote: {
                url: '/user_search/%QUERY',
                wildcard: '%QUERY'
            }
        });

        $('#user-autocomplete-container #exampleInputEmail1').typeahead(null, {
          name: 'user-list',
          display: 'login',
          source: users
        });


        $("#exampleInputEmail1").on("keypress", addUserOnEnter);
    }

    function save_permissions() {
        addUserFromInput();
        window.setTimeout(function() {
            var checked = $("input[name='dataset_account']:checked");
            var len = checked.length;

            var accounts = [];
            for (var i = 0; i < len; i++) {
                accounts.push(checked[i].value);
            }

            $.ajax({
                type: "POST",
                url: window.location.href+"/permissions",
                data: {
                    "accounts": accounts,
                    'csrfmiddlewaretoken': $("input[name='csrfmiddlewaretoken']").val()
                },
                success: hide_sharing_panel
            });
        }, 0);
    }

    function hide_sharing_panel() {
        $("#share_modal").modal('hide');
    }

    function show_permissions_panel(data) {
        $("#dataset_access_list").html("");
        for (var i = 0; i < data.length; i++) {
            var content = user_template({ username: data[i] });
            $("#dataset_access_list").append($(content));
        }
        $("#sharing-modal-loading").hide();
        $("#sharing-modal-display").show();
    }

{'fraction_non_alphanumeric': 0.15518903287994001, 'fraction_numerical': 0.002677519545892685, 'mean_word_length': 1.8033623536475534, 'pattern_counts': {'":': 10, '<': 7, '<?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': '3463', 'n_tokens_mistral': 2597, 'n_tokens_neox': 2516, 'n_words': 405}