<commit_before>var timeoutId = 0,
    timeout = 500,
    impress = impress(),
    current = 1;

impress.init();

+function recursive(){
    send({
        data: {
            from: 'pc'
        },
        onSuccess: function(response){
            if(response.turn !== 'current'){
                if(response.turn === 'left'){
                    impress.prev();
                }else{
                    impress.next();
                }
            }

            if(timeoutId){
                clearTimeout(timeoutId);
            }

            timeoutId = setTimeout(recursive, timeout);
        }
    });
}();

function send(option){
    option = option || {};
    $.ajax({
        type: "POST",
        url: "http://10.18.215.246:8080",
        contentType: "application/json",
        data: JSON.stringify(option.data || {}),
        dataType: "text",
        success: function( response ){
            if(typeof response === 'string'){
                response = JSON.parse(response);
            }
            typeof option.onSuccess === 'function' && $.proxy(option.onSuccess, option)(response);
        },
        error: function( error ){
            typeof option.onError === 'function' && $.proxy(option.onError, option)(error);
        },
        complete: function(){
            typeof option.onComplete === 'function' && $.proxy(option.onComplete, option)();
        }
    });
}<commit_msg>code modify<commit_after>var timeoutId = 0,
    timeout = 500,
    impress = impress(),
    current = 1;

impress.init();

+function recursive(){
    send({
        data: {
            from: 'pc'
        },
        onSuccess: function(response){
            if(response.turn !== 'current'){
                if(response.turn === 'left'){
                    impress.prev();
                }else{
                    impress.next();
                }
            }

            if(timeoutId){
                clearTimeout(timeoutId);
            }

            timeoutId = setTimeout(recursive, timeout);
        }
    });
}();

document.addEventListener("visibilitychange", function() {
    if(document.visibilityState === 'visible'){
        timeout = 500;
    } else if(document.visibilityState === 'hidden'){
        timeout = 2*60*900;
    }
});

function send(option){
    option = option || {};
    $.ajax({
        type: "POST",
        url: "http://10.18.215.246:8080",
        contentType: "application/json",
        data: JSON.stringify(option.data || {}),
        dataType: "text",
        success: function( response ){
            if(typeof response === 'string'){
                response = JSON.parse(response);
            }
            typeof option.onSuccess === 'function' && $.proxy(option.onSuccess, option)(response);
        },
        error: function( error ){
            typeof option.onError === 'function' && $.proxy(option.onError, option)(error);
        },
        complete: function(){
            typeof option.onComplete === 'function' && $.proxy(option.onComplete, option)();
        }
    });
}
{'fraction_non_alphanumeric': 0.15488326208484052, 'fraction_numerical': 0.015455442288720816, 'mean_word_length': 1.6801762114537444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '7614762', 'n_tokens_mistral': 853, 'n_tokens_neox': 799, 'n_words': 158}