<commit_before>//--
// Copyright (c) 2008, Net-ng.
// All rights reserved.
//
// This software is licensed under the BSD License, as described in
// the file LICENSE.txt, which you should have received as part of
// this distribution.
//--

// ----------------------------------------------------------------------------
// Requests

var nagare_callbacks = {
    cache : false,

    success : function (o) { setTimeout(o.responseText, 0) },
    failure : function (o) {
                            var url = o.getResponseHeader["X-Debug-URL"];
                            if(url) {
                                        window.location = url;
                                    } else {
                                        alert("XHR Error");
                                    }
                           },
    upload  : function (o) {
                            if(o.responseText.substring(0, 5) != "URL: ") {
                                var js = "";
                                var js_fragments = o.responseXML.firstChild.lastChild.firstChild;
                                for(var i=0; i<js_fragments.childNodes.length; i++)
                                    js += js_fragments.childNodes[i].data;
                                setTimeout(js, 0);
                            } else {
                                alert("XHR Error");
                            }
                           }
};

function nagare_getAndEval(href) {
    YAHOO.util.Connect.initHeader("ACCEPT", NAGARE_CONTENT_TYPE);
    YAHOO.util.Connect.asyncRequest("GET", href, nagare_callbacks);
    return false;
}

function nagare_hasUpload(f) {
    var inputs = f.getElementsByTagName("input");
    for(var i=0; i<inputs.length; i++)
        if(inputs[i].getAttribute("type") == "file")
            return true;
    return false;
}

function nagare_postAndEval(f, action) {
    YAHOO.util.Connect.initHeader("ACCEPT", NAGARE_CONTENT_TYPE);
    YAHOO.util.Connect.setForm(f, nagare_hasUpload(f));
    YAHOO.util.Connect.asyncRequest("POST", "?_a&"+action, nagare_callbacks);<commit_msg>Ajax file upload fixed on IE9<commit_after>//--
// Copyright (c) 2008-2011, Net-ng.
// All rights reserved.
//
// This software is licensed under the BSD License, as described in
// the file LICENSE.txt, which you should have received as part of
// this distribution.
//--

// ----------------------------------------------------------------------------
// Requests

var nagare_callbacks = {
    cache : false,

    success : function (o) { setTimeout(o.responseText, 0) },
    failure : function (o) {
                            var url = o.getResponseHeader["X-Debug-URL"];
                            if(url) {
                                        window.location = url;
                                    } else {
                                        alert("XHR Error");
                                    }
                           },
    upload  : function (o) {
                            if(o.responseText.substring(0, 5) != "URL: ") {
                                var js = "";
                                var js_fragments = o.responseXML.lastChild.lastChild.firstChild;
                                for(var i=0; i<js_fragments.childNodes.length; i++)
                                    js += js_fragments.childNodes[i].data;
                                setTimeout(js, 0);
                            } else {
                                alert("XHR Error");
                            }
                           }
};

function nagare_getAndEval(href) {
    YAHOO.util.Connect.initHeader("ACCEPT", NAGARE_CONTENT_TYPE);
    YAHOO.util.Connect.asyncRequest("GET", href, nagare_callbacks);
    return false;
}

function nagare_hasUpload(f) {
    var inputs = f.getElementsByTagName("input");
    for(var i=0; i<inputs.length; i++)
        if(inputs[i].getAttribute("type") == "file")
            return true;
    return false;
}

function nagare_postAndEval(f, action) {
    YAHOO.util.Connect.initHeader("ACCEPT", NAGARE_CONTENT_TYPE);
    YAHOO.util.Connect.setForm(f, nagare_hasUpload(f));
    YAHOO.util.Connect.asyncRequest("POST", "?_a&"+action, nagare_callbacks);
{'fraction_non_alphanumeric': 0.14840400190566935, 'fraction_numerical': 0.005955216769890424, 'mean_word_length': 1.288283378746594, 'pattern_counts': {'":': 0, '<': 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': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '177341', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1113, 'n_words': 224}