<commit_before>var fun_p64 = 0;
var zen     = 0;
var store   = 0;
var eth     = 0;
var api_key = "";
var ip      = "";
var url0    = "";
var url_status = url0 + "/status";
function post_opts () {
    // Default options are marked with *
    return {
        method: "POST", // *GET, POST, PUT, DELETE, etc.
        mode: "cors", // no-cors, cors, *same-origin
        cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
        headers: {
            "Content-Type": "text/plain"  // avoid preflight request
            //"Content-Type": "application/json",
            //"Content-Type": "application/x-www-form-urlencoded",
        },
        credentials : "omit",
        //redirect: "follow", // manual, *follow, error
        //referrer: "no-referrer", // no-referrer, *client
        body: JSON.stringify({ "api_key": api_key }) // body data type must match "Content-Type" header
    }
};

function status () {
    fetch(url_status, post_opts()).then(function (response) {
        return response.json();
    }).then(function (json) {
        console.log(json);
        fun_p64 = json.fun_p64;
        zen = json.zen;
        store = json.store;
        eth = json.eth;
        //swx_visibility("get-status");
        //swx_visibility("controls");
        swx_ctl_state();
    });
};
function swx_ctl_state () {
    if (fun_p64 == 1) {
        var e = document.getElementById('fun-p64');
        e.checked = true;
        e.after = true;
    };
    if (zen == 1) {
        var e = document.getElementById('zen');
        e.checked = true;
        e.after = true;
    };
    if (store == 1) {
        var e = document.getElementById('store');
        e.checked = true;
        e.after = true;
    };
    if (eth == 1) {
        var e = document.getElementById('eth');
        e.checked = true;
        e.after = true;
    };
};
function swx_visibility (id = 'undefined') {
    var e = document.getElementById(id);
    if (e.style.display == 'block')
        e.style.display = 'none';
    else
        e.style.display = 'block';
};
function swx (x = 'undefined') {
    var url = url0;
    function swx_ctl (c = -1) {
        if (c == 0) { c = 1; url += "/on"; }
        else        { c = 0; url += "/off"; }
    };
    if (x == 'fun-p64')    { url += "/1"; swx_ctl(fun_p64); }
    else if (x == 'zen')   { url += "/3"; swx_ctl(zen); }
    else if (x == 'store') { url += "/2"; swx_ctl(store); }
    else if (x == 'eth')   { url += "/4"; swx_ctl(eth); }
    else { return -1; }

    fetch(url, post_opts()).then(function (response) {
        return {};
    }).then(function (_) {
        fetch(url_status, post_opts()).then(function (response) {
            return response.json();<commit_msg>-bash<commit_after>var fun_p64 = 0;
var zen     = 0;
var store   = 0;
var eth     = 0;
var api_key = "";
var ip      = "";
var url0    = "";
var url_status = url0 + "/status";
function post_opts () {
    // Default options are marked with *
    return {
        method: "POST", // *GET, POST, PUT, DELETE, etc.
        mode: "cors", // no-cors, cors, *same-origin
        cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
        headers: {
            "Content-Type": "text/plain"  // avoid preflight request
            //"Content-Type": "application/json",
            //"Content-Type": "application/x-www-form-urlencoded",
        },
        credentials : "omit",
        //redirect: "follow", // manual, *follow, error
        //referrer: "no-referrer", // no-referrer, *client
        body: JSON.stringify({ "api_key": api_key }) // body data type must match "Content-Type" header
    }
};

function status () {
    fetch(url_status, post_opts()).then(function (response) {
        return response.json();
    }).then(function (json) {
        console.log(json);
        fun_p64 = json.fun_p64;
        zen = json.zen;
        store = json.store;
        eth = json.eth;
        //swx_visibility("get-status");
        //swx_visibility("controls");
        swx_ctl_state();
    });
};
function swx_ctl_state () {
    fun_p64 ? document.getElementById('fun-p64').checked = true : document.getElementById('fun-p64').checked = false;
    zen     ? document.getElementById('zen').checked     = true : document.getElementById('zen').checked     = false;
    store   ? document.getElementById('store').checked   = true : document.getElementById('store').checked   = false;
    eth     ? document.getElementById('eth').checked     = true : document.getElementById('eth').checked     = false;
};
function swx_visibility (id = 'undefined') {
    var e = document.getElementById(id);
    if (e.style.display == 'block')
        e.style.display = 'none';
    else
        e.style.display = 'block';
};
function swx (x = 'undefined') {
    var url = url0;
    function swx_ctl (c = -1) {
        if (c == 0) { c = 1; url += "/on"; }
        else        { c = 0; url += "/off"; }
    };
    if (x == 'fun-p64')    { url += "/1"; swx_ctl(fun_p64); }
    else if (x == 'zen')   { url += "/3"; swx_ctl(zen); }
    else if (x == 'store') { url += "/2"; swx_ctl(store); }
    else if (x == 'eth')   { url += "/4"; swx_ctl(eth); }
    else { return -1; }

    fetch(url, post_opts()).then(function (response) {
        return {};
    }).then(function (_) {
        fetch(url_status, post_opts()).then(function (response) {
            return response.json();
{'fraction_non_alphanumeric': 0.17723396366332964, 'fraction_numerical': 0.012235817575083427, 'mean_word_length': 2.164222873900293, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1014035', 'n_tokens_mistral': 1799, 'n_tokens_neox': 1752, 'n_words': 423}