<commit_before><!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Feedbacker</title>
    <style media="screen" type="text/css">
        .response-btn {
            box-shadow:inset 0px 1px 0px 0px #ffffff;
            background:linear-gradient(to bottom, #f9f9f9 5%, #e9e9e9 100%);
            background-color:#f9f9f9;
            border-radius:6px;
            border:1px solid #dcdcdc;
            display:inline-block;
            cursor:pointer;
            color:#333333;
            font-family:monospace;
            font-size:14px;
            padding:6px 24px;
            text-decoration:none;
            text-shadow:0px 1px 0px #ffffff;
        }
        #poll_canvas {
            background-color:#f9f9f9;
            border:1px solid #c3c3c3;

        }
        .response-btn:active {
            position:relative;
            top:1px;
        }
        .poll_question {
            font-family:monospace;
            font-size:18px;
            font-weight:bold;
            padding:6px 24px;
            text-decoration:none;
        }
        .response_buttons {
            float: left;
        }

        @media only screen and (max-width: 1000px) {
            .poll_question {
                font-size:28px;
            }
            .response-btn {
                font-size:24px;
            }
        }

    </style>

</head>
<body id="body">
<br/>
<span id="poll_question" class="poll_question">Nice Poll</span>
<br/>

<span id="response_buttons"></span>
<br/>
<canvas id="poll_canvas" height="225">
    Your browser does not support the HTML5 canvas tag.
</canvas>
<br/>
<span name="<!-- session-id -->" id="session-id">
    <!-- presenter-sect -->

</span>
<br/>

<script>
    var currentPoll = null;

    var ctx = poll_canvas.getContext("2d");
    var barColors = ["#FF0000", "#00FF00", "#0000FF", "#FF00FF"];
    var sessionId = document.getElementById('session-id').getAttribute("name");

    ctx.canvas.width = window.innerWidth - (window.innerWidth * 0.01);

    console.log('My user id is:', sessionId);//TODO: properly storing userId

    var submitPollResponse = function (id) {
        //curl -X POST --data '{"question": 0, "response": 2}' http://localhost:8125/response
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.open("POST","response",true);
        xmlhttp.setRequestHeader("Content-type","application/json");
        xmlhttp.send('{"question": '+currentPoll+', "response": '+id+'}');
    };

    var submitPagingRequest = function (type) {//type: next || prev
        //curl -X POST --data '{"userId": "lksdjflsdkjf"}' http://localhost:8125/prev -v
        //curl -X POST --data '{"userId": "lksdjflsdkjf"}' http://localhost:8125/next -v
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.open("POST",type,true);
        xmlhttp.setRequestHeader("Content-type","application/json");
        xmlhttp.send('{"sessionId": "'+sessionId+'"}');
    };

    function getCurrentButtonsFont() {
        var but = document.getElementsByClassName("response-btn")[0];
        return but.style.fontSize || 14;
    }

    function paintQuestionResult(i, question, count) {
        //ctx.fillStyle = "#FFFFFF";

        ctx.fillStyle = barColors[i];
        ctx.fillRect(5, 5 + (55 * (i + 0)), 25 * count, 50);
        var fontSize = getCurrentButtonsFont();
        ctx.font = fontSize + "px Courier, monospace";
        ctx.fillStyle = "#000000";
        ctx.fillText(question + " votes: "+count, 10, 5 + (55 * (i + 0)) + 25);
    }

    function updatePoll(poll) {
        if (currentPoll !== poll.id) {
            initializeResponseButtons(poll);
            currentPoll = poll.id;
            poll_question.innerHTML = poll.title;

        }

        updatePollResults(poll)
    }

    function updatePollResults(pollResults){
        var responses = pollResults.responses;
        ctx.fillStyle = "#f9f9f9";<commit_msg>get button size from computedStyle when not available from style.fontSize<commit_after><!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Feedbacker</title>
    <style media="screen" type="text/css">
        .response-btn {
            box-shadow:inset 0px 1px 0px 0px #ffffff;
            background:linear-gradient(to bottom, #f9f9f9 5%, #e9e9e9 100%);
            background-color:#f9f9f9;
            border-radius:6px;
            border:1px solid #dcdcdc;
            display:inline-block;
            cursor:pointer;
            color:#333333;
            font-family:monospace;
            font-size:14px;
            padding:6px 24px;
            text-decoration:none;
            text-shadow:0px 1px 0px #ffffff;
        }
        #poll_canvas {
            background-color:#f9f9f9;
            border:1px solid #c3c3c3;

        }
        .response-btn:active {
            position:relative;
            top:1px;
        }
        .poll_question {
            font-family:monospace;
            font-size:18px;
            font-weight:bold;
            padding:6px 24px;
            text-decoration:none;
        }
        .response_buttons {
            float: left;
        }

        @media only screen and (max-width: 1000px) {
            .poll_question {
                font-size:28px;
            }
            .response-btn {
                font-size:24px;
            }
        }

    </style>

</head>
<body id="body">
<br/>
<span id="poll_question" class="poll_question">Nice Poll</span>
<br/>

<span id="response_buttons"></span>
<br/>
<canvas id="poll_canvas" height="225">
    Your browser does not support the HTML5 canvas tag.
</canvas>
<br/>
<span name="<!-- session-id -->" id="session-id">
    <!-- presenter-sect -->

</span>
<br/>

<script>
    var currentPoll = null;

    var ctx = poll_canvas.getContext("2d");
    var barColors = ["#FF0000", "#00FF00", "#0000FF", "#FF00FF"];
    var sessionId = document.getElementById('session-id').getAttribute("name");

    ctx.canvas.width = window.innerWidth - (window.innerWidth * 0.01);

    console.log('My user id is:', sessionId);//TODO: properly storing userId

    var submitPollResponse = function (id) {
        //curl -X POST --data '{"question": 0, "response": 2}' http://localhost:8125/response
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.open("POST","response",true);
        xmlhttp.setRequestHeader("Content-type","application/json");
        xmlhttp.send('{"question": '+currentPoll+', "response": '+id+'}');
    };

    var submitPagingRequest = function (type) {//type: next || prev
        //curl -X POST --data '{"userId": "lksdjflsdkjf"}' http://localhost:8125/prev -v
        //curl -X POST --data '{"userId": "lksdjflsdkjf"}' http://localhost:8125/next -v
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.open("POST",type,true);
        xmlhttp.setRequestHeader("Content-type","application/json");
        xmlhttp.send('{"sessionId": "'+sessionId+'"}');
    };

    function getCurrentButtonsFont() {
        var but = document.getElementsByClassName("response-btn")[0];
        var styleSize = but.style.fontSize;
        //get computedStyle
        var style = window.getComputedStyle(but, null).getPropertyValue('font-size');
        var computedFontSize = parseFloat(style);

        return styleSize || computedFontSize || 14;
    }

    function paintQuestionResult(i, question, count) {
        //ctx.fillStyle = "#FFFFFF";

        ctx.fillStyle = barColors[i];
        ctx.fillRect(5, 5 + (55 * (i + 0)), 25 * count, 50);
        var fontSize = getCurrentButtonsFont();
        ctx.font = fontSize + "px Courier, monospace";
        ctx.fillStyle = "#000000";
        ctx.fillText(question + " votes: "+count, 10, 5 + (55 * (i + 0)) + 25);
    }

    function updatePoll(poll) {
        if (currentPoll !== poll.id) {
            initializeResponseButtons(poll);
            currentPoll = poll.id;
            poll_question.innerHTML = poll.title;

        }

        updatePollResults(poll)
    }

    function updatePollResults(pollResults){
        var responses = pollResults.responses;
        ctx.fillStyle = "#f9f9f9";
{'fraction_non_alphanumeric': 0.14831433422265342, 'fraction_numerical': 0.029347562454523406, 'mean_word_length': 2.239198743126473, 'pattern_counts': {'":': 14, '<': 57, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 16}, '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': '3570336', 'n_tokens_mistral': 2727, 'n_tokens_neox': 2522, 'n_words': 521}