<commit_before>/*global $:false, jQuery:false, Spinner:false*/

/**
 * gplusraffle - Google API PHP OAuth 2.0 and FusionTables client based raffle
 * management system
 *
 * Webapp Client Controller
 *
 * @package gplusraffle
 * @copyright <NAME> 2014
 * @license MIT Expat
 * @version v0.1.1-beta
 *
 */

/*
 * Processing dots animation
 */
/* (Replaced by spinner animation)
function processingDots(){
//dots animation shown while the server processes the request
    "use strict";
    var dots = document.getElementById('dots');
    if ($(dots).text().length < 3) {
        $(dots).text($(dots).text()+'.');
    } else {
        $(dots).text('.');
    }
}
*/

/**
 * Send a request to the web server
 */
function requestAndProcessPageJSONData(request){
    "use strict";
    var xmlhttp, //intervalID = window.setInterval(processingDots,1000), 
        opts, target, spinner, propertyName, data, params, response, subtitle;
    if (request.hasOwnProperty('subtitle')){
        subtitle = request['subtitle'];
        delete request['subtitle']; // this is bad design.
    }
    //$("#postAjaxContent").hide();
    //$("#preAjaxContent").show();
    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    } else {// code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
            //window.clearInterval(intervalID);
            spinner.stop();
            if (xmlhttp.responseText) {
                //console.log(xmlhttp.responseText);
                data=JSON.parse(xmlhttp.responseText);
                //generate and dump table on #dataTable div
                dumpTable(data,'dataTable','theMotherOfAllTables');
                //initialize datatables features and styling
                fireDataTables('theMotherOfAllTables');
                //set output text on some other fields
                $('#execTime').text(data['execTime']);
                //set the url to reflect the parameters of the JSON acquired
                //path = /^([\w\W]*\/)\d+\/\d+\/\d+(\/[\w\W]*)$/.exec(window.location.pathname);
                //path=(path===null)?window.location.pathname:path[1];
                //history.replaceState(stateObj, "", url);
                //$('#subtitle').text(data['subtitle']);
            }
            if (
                request.collection === 'raffle' && 
                (
                    request.action === 'open' ||
                    request.action === 'close' ||
                    request.action === 'delete'
                )
            ){
                requestAndProcessPageJSONData(
                    {
                        'collection':'raffle',
                        'action':'list',
                        'userid':'me',
                        'subtitle': subtitle
                    }
                );
            } else if (
                request.collection === 'raffle' &&
                (
                    request.action === 'join'
                )
            ){
                requestAndProcessPageJSONData(
                    {
                        'collection':'raffle',
                        'action':'list',
                        'raffleid':request.raffleid,
                        'subtitle': subtitle
                    }
                );
            } else if (
                request.collection === 'raffle' &&
                (
                    request.action === 'leave'
                )
            ){
                requestAndProcessPageJSONData(
                    {
                        'collection':'raffle',
                        'action':'list',
                        'creatorid':'me',
                        'subtitle': subtitle
                    }
                );
            }
            $('#subtitle').text(subtitle);
            //$("#preAjaxContent").hide();
            //$("#postAjaxContent").show();
        } else if(xmlhttp.readyState === 4){
            spinner.stop();
            if(xmlhttp.status === 404 && request.collection ==='raffle' && (request.action === 'list' || request.action === 'check')){
                data = {'data':{'columns':['']}};
            } else {<commit_msg>Fix creatorid<=>userid mixup.<commit_after>/*global $:false, jQuery:false, Spinner:false*/

/**
 * gplusraffle - Google API PHP OAuth 2.0 and FusionTables client based raffle
 * management system
 *
 * Webapp Client Controller
 *
 * @package gplusraffle
 * @copyright <NAME> 2014
 * @license MIT Expat
 * @version v0.1.1-beta
 *
 */

/*
 * Processing dots animation
 */
/* (Replaced by spinner animation)
function processingDots(){
//dots animation shown while the server processes the request
    "use strict";
    var dots = document.getElementById('dots');
    if ($(dots).text().length < 3) {
        $(dots).text($(dots).text()+'.');
    } else {
        $(dots).text('.');
    }
}
*/

/**
 * Send a request to the web server
 */
function requestAndProcessPageJSONData(request){
    "use strict";
    var xmlhttp, //intervalID = window.setInterval(processingDots,1000), 
        opts, target, spinner, propertyName, data, params, response, subtitle;
    if (request.hasOwnProperty('subtitle')){
        subtitle = request['subtitle'];
        delete request['subtitle']; // this is bad design.
    }
    //$("#postAjaxContent").hide();
    //$("#preAjaxContent").show();
    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    } else {// code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
            //window.clearInterval(intervalID);
            spinner.stop();
            if (xmlhttp.responseText) {
                //console.log(xmlhttp.responseText);
                data=JSON.parse(xmlhttp.responseText);
                //generate and dump table on #dataTable div
                dumpTable(data,'dataTable','theMotherOfAllTables');
                //initialize datatables features and styling
                fireDataTables('theMotherOfAllTables');
                //set output text on some other fields
                $('#execTime').text(data['execTime']);
                //set the url to reflect the parameters of the JSON acquired
                //path = /^([\w\W]*\/)\d+\/\d+\/\d+(\/[\w\W]*)$/.exec(window.location.pathname);
                //path=(path===null)?window.location.pathname:path[1];
                //history.replaceState(stateObj, "", url);
                //$('#subtitle').text(data['subtitle']);
            }
            if (
                request.collection === 'raffle' && 
                (
                    request.action === 'open' ||
                    request.action === 'close' ||
                    request.action === 'delete'
                )
            ){
                requestAndProcessPageJSONData(
                    {
                        'collection':'raffle',
                        'action':'list',
                        'creatorid':'me',
                        'subtitle': subtitle
                    }
                );
            } else if (
                request.collection === 'raffle' &&
                (
                    request.action === 'join'
                )
            ){
                requestAndProcessPageJSONData(
                    {
                        'collection':'raffle',
                        'action':'list',
                        'raffleid':request.raffleid,
                        'subtitle': subtitle
                    }
                );
            } else if (
                request.collection === 'raffle' &&
                (
                    request.action === 'leave'
                )
            ){
                requestAndProcessPageJSONData(
                    {
                        'collection':'raffle',
                        'action':'list',
                        'userid':'me',
                        'subtitle': subtitle
                    }
                );
            }
            $('#subtitle').text(subtitle);
            //$("#preAjaxContent").hide();
            //$("#postAjaxContent").show();
        } else if(xmlhttp.readyState === 4){
            spinner.stop();
            if(xmlhttp.status === 404 && request.collection ==='raffle' && (request.action === 'list' || request.action === 'check')){
                data = {'data':{'columns':['']}};
            } else {
{'fraction_non_alphanumeric': 0.14440101172683376, 'fraction_numerical': 0.005978385835824327, 'mean_word_length': 1.4587337478801583, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 22}, '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': '2469606', 'n_tokens_mistral': 2335, 'n_tokens_neox': 2170, 'n_words': 448}