<commit_before>var firstUpload = true;

function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function adOptOut() {
    createCookie("ad-opt-out", '1', 0);
    location.href = "/";
}

function handleFiles(files) {
    uploadFiles(files);
}

function uploadFiles(files) {
    var droparea = document.getElementById('droparea');
    droparea.style.overflowY = 'scroll';
    if (firstUpload) {
        droparea.innerHTML = '';
        firstUpload = false;
    }
    for (var i = 0; i < files.length; i++) {
        var element = document.createElement('div');
        element.className = 'image-loading';
        prepareImage(element, files[i]);
        
        var name = document.createElement('h2');
        name.innerHTML = files[i].name;

        var result = document.createElement('div');

        var progress = document.createElement('div');
        progress.className = 'progress';

        var clearfix = document.createElement('div');
        clearfix.className = 'clearfix';

        element.appendChild(name);
        element.appendChild(result);
        element.appendChild(progress);
        element.appendChild(clearfix);
        droparea.appendChild(element);

        uploadFile(progress, result, files[i]);
    }
}

function prepareImage(parentElement, file) {
    var wrapper = document.createElement('div');
    wrapper.setAttribute('class', 'img-wrapper');
    var image = document.createElement('img');

    var reader = new FileReader();
    reader.onloadend = function(e) {
        image.src = e.target.result;
    };
    reader.readAsDataURL(file);

    wrapper.appendChild(image);
    parentElement.appendChild(wrapper);
}

function showURL(result, url) {
    var text = document.createElement('p');
    text.innerHTML = 'Upload complete!';
    var link = document.createElement('a');
    link.href = '/' + url;
    link.setAttribute('target', '_blank');
    link.innerHTML = window.location.origin + '/' + url;
    result.appendChild(text);
    result.appendChild(link);
}

function checkStatus(processing, progress, result, url) {
    console.log('checking in');
    var xhr = new XMLHttpRequest();

    xhr.open('GET', '/gif/status/' + url + '?' + Math.random());
    xhr.onload = function() {
        if (this.responseText == 'done') {
            progress.style.width = 0;
            processing.remove();
            showURL(result, url)<commit_msg>Removed randomized parameter at the end of the status request call<commit_after>var firstUpload = true;

function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function adOptOut() {
    createCookie("ad-opt-out", '1', 0);
    location.href = "/";
}

function handleFiles(files) {
    uploadFiles(files);
}

function uploadFiles(files) {
    var droparea = document.getElementById('droparea');
    droparea.style.overflowY = 'scroll';
    if (firstUpload) {
        droparea.innerHTML = '';
        firstUpload = false;
    }
    for (var i = 0; i < files.length; i++) {
        var element = document.createElement('div');
        element.className = 'image-loading';
        prepareImage(element, files[i]);
        
        var name = document.createElement('h2');
        name.innerHTML = files[i].name;

        var result = document.createElement('div');

        var progress = document.createElement('div');
        progress.className = 'progress';

        var clearfix = document.createElement('div');
        clearfix.className = 'clearfix';

        element.appendChild(name);
        element.appendChild(result);
        element.appendChild(progress);
        element.appendChild(clearfix);
        droparea.appendChild(element);

        uploadFile(progress, result, files[i]);
    }
}

function prepareImage(parentElement, file) {
    var wrapper = document.createElement('div');
    wrapper.setAttribute('class', 'img-wrapper');
    var image = document.createElement('img');

    var reader = new FileReader();
    reader.onloadend = function(e) {
        image.src = e.target.result;
    };
    reader.readAsDataURL(file);

    wrapper.appendChild(image);
    parentElement.appendChild(wrapper);
}

function showURL(result, url) {
    var text = document.createElement('p');
    text.innerHTML = 'Upload complete!';
    var link = document.createElement('a');
    link.href = '/' + url;
    link.setAttribute('target', '_blank');
    link.innerHTML = window.location.origin + '/' + url;
    result.appendChild(text);
    result.appendChild(link);
}

function checkStatus(processing, progress, result, url) {
    console.log('checking in');
    var xhr = new XMLHttpRequest();

    xhr.open('GET', '/gif/status/' + url);
    xhr.onload = function() {
        if (this.responseText == 'done') {
            progress.style.width = 0;
            processing.remove();
            showURL(result, url)
{'fraction_non_alphanumeric': 0.1486255924170616, 'fraction_numerical': 0.005687203791469194, 'mean_word_length': 2.9550224887556222, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1145537', 'n_tokens_mistral': 1524, 'n_tokens_neox': 1485, 'n_words': 308}