<commit_before><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Gruppe10</title>
</head>
<body>
    Your name:<br>
    <input id="nameInput" type="text" name="name" value="">
    <br><br>
    <button onclick="postName()">Submit</button>
    <br>
    <p id="submitResponse"></p>
    <br>
    <button onclick="getNames()">Get Names</button>
    <p>Name list:</p>
    <div id="nameList"></div>
<script>
    function postName() {
        console.log("gg");
        var input = document.getElementById("nameInput").value;
        var submitResponse = document.getElementById("submitResponse");

        if (!input) {
            submitResponse.innerHTML = "Name can't be blank";
            return;
        }

        var xhttp = new XMLHttpRequest();
        var name = { "name": input };
        var url = window.location.href + "register";
        xhttp.open("POST", url, true);
        xhttp.setRequestHeader("Content-type", "application/json");
        xhttp.send(JSON.stringify(name));
        xhttp.onload = function() {
            var message = JSON.parse(xhttp.responseText);
            console.log(message);
            if(typeof message.message === "string") {
                message = message.message;
            }
            else {
                message = "Haha we experienced an error, try again!";
            }
            submitResponse.innerHTML = message;
        };

        xhttp.onerror = function() {
            var message = "Haha we experienced an error, try again!";
        };
    }

    function getNames() {
        var nameList = document.getElementById("nameList");
        var xhttp = new XMLHttpRequest();
        var url = window.location.href + "list";
        xhttp.open("GET", url, true);
        xhttp.setRequestHeader("Content-type", "application/json");
        xhttp.send();
        xhttp.onload = function() {
            var userlist = JSON.parse(xhttp.responseText);
            var nameList = document.getElementById('nameList');
            while (nameList.hasChildNodes()) {
                nameList.removeChild(nameList.lastChild);
            }
            nameList.appendChild(makeNameList(userlist.users));
            //alert(window.location.href);
        };

        xhttp.onerror = function() {
            var message = "Haha we experienced an error, try again!";
        };
    }

    function makeNameList(array) {
        var list = document.createElement('ol');
        for(var i = 0; i < array.length; i++) {
            var item = document.createElement('li');
            item.appendChild(document.createTextNode(array[i].name));
            list.appendChild(item);
        }
        return list;
    }

</script>
</body>
</html><commit_msg>endret litt<commit_after><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Gruppe10</title>
</head>
<body>
    Your name:<br>
    <input id="inputNavn" type="tekst" name="navn" value="">
    <br><br>
    <button onclick="postName()">Submit</button>
    <br>
    <p id="submitResponse"></p>
    <br>
    <button onclick="getNames()">Get Names</button>
    <p>Name list:</p>
    <div id="nameList"></div>
<script>
    function postName() {
        console.log("gg");
        var input = document.getElementById("inputNavn").value;
        var submitResponse = document.getElementById("submitResponse");

        if (!input) {
            submitResponse.innerHTML = "Du må skrive et navn";
            return;
        }

        var xhttp = new XMLHttpRequest();
        var name = { "name": input };
        var url = window.location.href + "register";
        xhttp.open("POST", url, true);
        xhttp.setRequestHeader("Content-type", "application/json");
        xhttp.send(JSON.stringify(name));
        xhttp.onload = function() {
            var message = JSON.parse(xhttp.responseText);
            console.log(message);
            if(typeof message.message === "string") {
                message = message.message;
            }
            else {
                message = "Ups, her har det skjedd en feil";
            }
            submitResponse.innerHTML = message;
        };

        xhttp.onerror = function() {
            var message = "Ups, her har det skjedd en feil";
        };
    }

    function getNames() {
        var nameList = document.getElementById("nameList");
        var xhttp = new XMLHttpRequest();
        var url = window.location.href + "list";
        xhttp.open("GET", url, true);
        xhttp.setRequestHeader("Content-type", "application/json");
        xhttp.send();e
        xhttp.onload = function() {
            var userlist = JSON.parse(xhttp.responseText);
            var nameList = document.getElementById('nameList');
            while (nameList.hasChildNodes()) {
                nameList.removeChild(nameList.lastChild);
            }
            nameList.appendChild(makeNameList(userlist.users));
            //alert(window.location.href);
        };

        xhttp.onerror = function() {
            var message = "Ups, her har det skjedd en feil";
        };
    }

    function makeNameList(array) {
        var list = document.createElement('ol');
        for(var i = 0; i < array.length; i++) {
            var item = document.createElement('li');
            item.appendChild(document.createTextNode(array[i].name));
            list.appendChild(item);
        }
        return list;
    }

</script>
</body>
</html>
{'fraction_non_alphanumeric': 0.14248990084465663, 'fraction_numerical': 0.0014689680499449136, 'mean_word_length': 2.100170745589072, 'pattern_counts': {'":': 2, '<': 61, '<?xml version=': 0, '>': 59, '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': '7163736', 'n_tokens_mistral': 1554, 'n_tokens_neox': 1524, 'n_words': 329}