<commit_before>// this code is static

function newElement(type) {
    return document.createElement(type);
}

function newCell(value) {
    var cell = newElement('td');
    cell.innerHTML = value;
    return cell;
}

function newButton(caption, action) {
    var button = newElement('button');
    button.type = 'button';
    button.innerHTML = caption;
    button.onclick = function() {
        action(this);
    };
    return button;
}

function hideButtons(button) {
    button.style.display = 'none';
    button.nextSibling.style.display = 'none';
}

function showButtons(button) {
    button.style.display = 'inline-block';
    button.nextSibling.style.display = 'inline-block';
}

function modify_entry(button) {
    hideButtons(button);
    showButtons(button.nextSibling.nextSibling);
    var row = button.parentNode.parentNode;
    for (var i = 0; i < row.childNodes.length - 1; i++) {
        var cell = row.childNodes[i];
        var textbox = newElement('input');
        textbox.type = 'text';
        textbox.value = cell.textContent;
        cell.innerHTML = '';
        cell.appendChild(textbox);
        var backup = newElement('span');
        backup.style.display = 'none';
        backup.textContent = textbox.value;
        cell.appendChild(backup);
    }
}

function getXMLHttp() {
    if (window.XMLHttpRequest) {
        return new XMLHttpRequest();
    }
    alert('Ihr Browser untersttzt kein XMLHttpRequest und ich hab keinen Bock auf ActiveX.');
    return false;
}

function delete_entry(button) {
    var xmlhttp = getXMLHttp();
    if (xmlhttp) {
        hideButtons(button.previousSibling);
        var row = button.parentNode.parentNode;
        /* TODO
        xmlhttp.open('POST', 'localhost', false);
        xmlhttp.send(null);
        */
        if (row.parentNode.childNodes.length == 2) {
            var teacher = row.parentNode.parentNode;
            var day = teacher.parentNode;
            if (day.childNodes.length == 4) {
                day.parentNode.removeChild(day);
            } else {
                teacher.parentNode.removeChild(teacher);
            }
        } else {
            row.parentNode.removeChild(row);
        }
    }
}

function delete_new_entry(button) {
    var row = button.parentNode.parentNode;
    if (row.parentNode.childNodes.length == 2) {
        var teacher = row.parentNode.parentNode;
        var day = teacher.parentNode;
        if (day.childNodes.length == 4) {
            day.parentNode.removeChild(day);
        } else {
            teacher.parentNode.removeChild(teacher);
        }
    } else {
        row.parentNode.removeChild(row);
    }
}

function save_entry(button) {
    hideButtons(button);
    showButtons(button.previousSibling.previousSibling);
    var row = button.parentNode.parentNode;
    var contentHasChanged = false;
    for (var i = 0; i < row.childNodes.length - 1; i++) {
        var cell = row.childNodes[i];
        if (cell.firstChild.value != cell.lastChild.textContent) {
            cell.textContent = cell.firstChild.value;
            contentHasChanged = true;
        } else {
            cell.textContent = cell.lastChild.textContent;
        }
    }
    if (contentHasChanged) {
        // TODO: send row to server
    }
}

function save_new_entry(button) {
    hideButtons(button);
    showButtons(button.previousSibling.previousSibling);
    var row = button.parentNode.parentNode;
    for (var i = 0; i < row.childNodes.length - 1; i++) {
        var cell = row.childNodes[i];
        cell.textContent = cell.firstChild.value;
    }
    alert('Imaginrer Uploadvorgang zum Server...');
    // TODO: send row to server + get new id
    button.onclick = function() {<commit_msg>Removed annoying alert message<commit_after>// this code is static

function newElement(type) {
    return document.createElement(type);
}

function newCell(value) {
    var cell = newElement('td');
    cell.innerHTML = value;
    return cell;
}

function newButton(caption, action) {
    var button = newElement('button');
    button.type = 'button';
    button.innerHTML = caption;
    button.onclick = function() {
        action(this);
    };
    return button;
}

function hideButtons(button) {
    button.style.display = 'none';
    button.nextSibling.style.display = 'none';
}

function showButtons(button) {
    button.style.display = 'inline-block';
    button.nextSibling.style.display = 'inline-block';
}

function modify_entry(button) {
    hideButtons(button);
    showButtons(button.nextSibling.nextSibling);
    var row = button.parentNode.parentNode;
    for (var i = 0; i < row.childNodes.length - 1; i++) {
        var cell = row.childNodes[i];
        var textbox = newElement('input');
        textbox.type = 'text';
        textbox.value = cell.textContent;
        cell.innerHTML = '';
        cell.appendChild(textbox);
        var backup = newElement('span');
        backup.style.display = 'none';
        backup.textContent = textbox.value;
        cell.appendChild(backup);
    }
}

function getXMLHttp() {
    if (window.XMLHttpRequest) {
        return new XMLHttpRequest();
    }
    alert('Ihr Browser untersttzt kein XMLHttpRequest und ich hab keinen Bock auf ActiveX.');
    return false;
}

function delete_entry(button) {
    var xmlhttp = getXMLHttp();
    if (xmlhttp) {
        hideButtons(button.previousSibling);
        var row = button.parentNode.parentNode;
        /* TODO
        xmlhttp.open('POST', 'localhost', false);
        xmlhttp.send(null);
        */
        if (row.parentNode.childNodes.length == 2) {
            var teacher = row.parentNode.parentNode;
            var day = teacher.parentNode;
            if (day.childNodes.length == 4) {
                day.parentNode.removeChild(day);
            } else {
                teacher.parentNode.removeChild(teacher);
            }
        } else {
            row.parentNode.removeChild(row);
        }
    }
}

function delete_new_entry(button) {
    var row = button.parentNode.parentNode;
    if (row.parentNode.childNodes.length == 2) {
        var teacher = row.parentNode.parentNode;
        var day = teacher.parentNode;
        if (day.childNodes.length == 4) {
            day.parentNode.removeChild(day);
        } else {
            teacher.parentNode.removeChild(teacher);
        }
    } else {
        row.parentNode.removeChild(row);
    }
}

function save_entry(button) {
    hideButtons(button);
    showButtons(button.previousSibling.previousSibling);
    var row = button.parentNode.parentNode;
    var contentHasChanged = false;
    for (var i = 0; i < row.childNodes.length - 1; i++) {
        var cell = row.childNodes[i];
        if (cell.firstChild.value != cell.lastChild.textContent) {
            cell.textContent = cell.firstChild.value;
            contentHasChanged = true;
        } else {
            cell.textContent = cell.lastChild.textContent;
        }
    }
    if (contentHasChanged) {
        // TODO: send row to server
    }
}

function save_new_entry(button) {
    hideButtons(button);
    showButtons(button.previousSibling.previousSibling);
    var row = button.parentNode.parentNode;
    for (var i = 0; i < row.childNodes.length - 1; i++) {
        var cell = row.childNodes[i];
        cell.textContent = cell.firstChild.value;
    }
    // TODO: send row to server + get new id
    button.onclick = function() {
{'fraction_non_alphanumeric': 0.11932203389830509, 'fraction_numerical': 0.002711864406779661, 'mean_word_length': 2.4163964798517834, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '5788599', 'n_tokens_mistral': 2158, 'n_tokens_neox': 2218, 'n_words': 455}