<commit_before>/*
 *  'nodejs + connectjs': HTTP communication with backend (remote web browser)
 */

(function get_extjs_remote_config(url){
var xhr = new XMLHttpRequest
    xhr.open(
        'GET'
        ,(url ? url : '') + '/app.config.extjs.json'
        ,true
    )
    xhr.onreadystatechange = onreadystatechange
    xhr.send()
    return

    function onreadystatechange(res){
    var extjs_config, req = res.target
        if(4 == req.readyState){
            if(200 != req.status){
                throw new Error(xhr ? l10n.errload_config_read : l10n.extjsNotFound)
            } else {
                if(xhr){
                    xhr = null
                    extjs_config = JSON.parse(req.responseText)
                    if(url){// `nw` context
                        app.config.extjs.load = extjs_config.load
                        app.extjs_load(document, window)
                        return
                    }
                    // `browser` context
                    app.config = {
                        extjs: extjs_config,
                        backend:{// record start time
                            time: new Date,
                            msg: l10n.stsBackendXHR,
                            op: l10n.stsCheck
                        }
                    }
                    req.open(// check for network availability of ExtJS
                        'HEAD'
                       ,(url ? url : '') + app.config.extjs.path + 'ext-all-nw.js'
                       ,true
                    )
                    req.send()
                } else {
                    app.extjs_load(document, window)
                }
            }
        }
    }
})(app.config && app.config.backend.url)<commit_msg>app_front_http: rework to use no circular dep. via variable<commit_after>/*
 *  'nodejs + connectjs': HTTP communication with backend (remote web browser)
 */

(function app_front_http(url){
var xhr = new XMLHttpRequest
    xhr.open('GET', (url ? url : '') + '/app.config.extjs.json', true)
    xhr.onreadystatechange = load_config_then_ExtJS
    xhr.send()
    xhr = null
    return

    function load_config_then_ExtJS(res){
    var extjs_config, req = res.target
        if(4 != req.readyState) return
        if(200 != req.status) throw new Error(/config/.test(req.responseURL)?
            l10n.errload_config_read :
            l10n.extjsNotFound
        )

        if(req.responseText){// config
            extjs_config = JSON.parse(req.responseText)
            if(url){
        // `nw` context
                app.config.extjs.load = extjs_config.load
                app.extjs_load(document, window)
                return
            }
        // `browser` context
        } else {// load after HEAD check
            app.extjs_load(document, window)
            return
        }

        app.config = {
            extjs: extjs_config,
            backend:{// record start time
                time: new Date,
                msg: l10n.stsBackendXHR,
                op: l10n.stsCheck
            }
        }
        req.open(// check for network availability of ExtJS
            'HEAD'
           ,(url ? url : '') + app.config.extjs.path + 'ext-all-nw.js'
           ,true
        )
        req.send()
    }
})(app.config && app.config.backend.url)
{'fraction_non_alphanumeric': 0.10229330114665057, 'fraction_numerical': 0.00724200362100181, 'mean_word_length': 1.279917469050894, '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': '2069532', 'n_tokens_mistral': 968, 'n_tokens_neox': 908, 'n_words': 192}