<commit_before>// The wab namespace and constructor definitions. Everything is in this file
// to minimize page fetchs from the server.

var wab = {
    View: function() {
        this.view = document.getElementById("view");
        this.page = null;
        this.specs = {};
    },
    List: function List(kind, spec) {
        this.kind = kind;
        this.spec = spec;
        this.table = null;
    },
    Obj: function Obj(ref, list) {
        this.ref = ref;
        this.list = list;
        this.spec = list.spec;
        this.form = null;
        this.lock = null;
        this.edit = false;
        this.save_button = null;
        this.delete_button = null;
    },
    // The act attribute is an enum value 0=view, 1=edit, 2=delete
    listButtons: [
        { title: 'View', icon: 'icon icon-eye', cn: 'actions', act: 0 },
        { title: 'Edit', icon: 'icon icon-pencil', cn: 'actions', act: 1 },
        { title: 'Delete', icon: 'icon icon-trash-o', cn: 'actions delete', act: 2 }
    ],
    inputOptions: [ 'required', 'maxlength', 'pattern', 'min', 'max', 'step' ],

    // Helper functions.
    httpCall: function(verb, url, obj, callback) {
        if (verb != 'GET' && verb != 'DELETE') return null;

        var h = new XMLHttpRequest();
        h.open(verb, url, true);
        h.responseType = 'json';
        h.onreadystatechange = function() {
            if (4 == h.readyState) {
                if (200 == h.status) {
                    callback(obj, h.response);
                } else {
                    alert(verb + ': ' + url + ' returned ' + h.status + '.');
                }
            }
        };
        h.send();
    },
    classifyNewElement: function(elem, klass) {
        var e = document.createElement(elem);
        e.className = klass;
        return e;
    }
}<commit_msg>Don't keep-alive<commit_after>// The wab namespace and constructor definitions. Everything is in this file
// to minimize page fetchs from the server.

var wab = {
    View: function() {
        this.view = document.getElementById("view");
        this.page = null;
        this.specs = {};
    },
    List: function List(kind, spec) {
        this.kind = kind;
        this.spec = spec;
        this.table = null;
    },
    Obj: function Obj(ref, list) {
        this.ref = ref;
        this.list = list;
        this.spec = list.spec;
        this.form = null;
        this.lock = null;
        this.edit = false;
        this.save_button = null;
        this.delete_button = null;
    },
    // The act attribute is an enum value 0=view, 1=edit, 2=delete
    listButtons: [
        { title: 'View', icon: 'icon icon-eye', cn: 'actions', act: 0 },
        { title: 'Edit', icon: 'icon icon-pencil', cn: 'actions', act: 1 },
        { title: 'Delete', icon: 'icon icon-trash-o', cn: 'actions delete', act: 2 }
    ],
    inputOptions: [ 'required', 'maxlength', 'pattern', 'min', 'max', 'step' ],

    // Helper functions.
    httpCall: function(verb, url, obj, callback) {
        if (verb != 'GET' && verb != 'DELETE') return null;

        var h = new XMLHttpRequest({keepAlive: false}); // force send of request
        h.open(verb, url, true);
        h.responseType = 'json';
        h.onreadystatechange = function() {
            if (4 == h.readyState) {
                if (200 == h.status) {
                    callback(obj, h.response);
                } else {
                    alert(verb + ': ' + url + ' returned ' + h.status + '.');
                }
            }
        };
        h.send();
    },
    classifyNewElement: function(elem, klass) {
        var e = document.createElement(elem);
        e.className = klass;
        return e;
    }
}
{'fraction_non_alphanumeric': 0.14753654574986463, 'fraction_numerical': 0.005414185165132647, 'mean_word_length': 1.8013646702047006, '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': '4365642', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1117, 'n_words': 312}