<commit_before><html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Drone Voice Command Center</title>
    <script src="https://code.jquery.com/jquery-2.1.4.min.js" charset="utf-8"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
</head>

<body>
    <script type="text/javascript">
        $(function() {

            var recognition;
            var issued = false;
            var stopped = true;

            var ws;

            if (WebSocket) {
                ws = new WebSocket("wss://localhost:3001/");
                ws.onmessage = function(event) {
                    console.log(event.data);
                    var data = JSON.parse(event.data);
                    if (data.event === 'battery') {
                        $('#battery').text((data.value > 10 ? 'Battery ' : '') + data.value + '%')
                        var bar = $('div.progress-bar');
                        bar.css({
                            width: data.value + '%'
                        });
                        if (data.value < 10) {
                            bar.removeClass('progress-bar-success')
                                .removeClass('progress-bar-warning')
                                .addClass('progress-bar-danger');
                        } else if (data.value < 20) {
                            bar.removeClass('progress-bar-success')
                                .removeClass('progress-bar-danger')
                                .addClass('progress-bar-warning');
                        }
                    }
                }
                ws.onerror = function(err) {
                    console.log(err);<commit_msg>Listen for connection changed event<commit_after><html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Drone Voice Command Center</title>
    <script src="https://code.jquery.com/jquery-2.1.4.min.js" charset="utf-8"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
</head>

<body>
    <script type="text/javascript">
        $(function() {

            var recognition;
            var issued = false;
            var stopped = true;

            var ws;

            function batteryChange(value) {
                $('#battery').text((value > 10 ? 'Battery ' : '') + value + '%')
                var bar = $('div.progress-bar');
                bar.css({
                    width: value + '%'
                });
                if (value < 10) {
                    bar.removeClass('progress-bar-success')
                        .removeClass('progress-bar-warning')
                        .addClass('progress-bar-danger');
                } else if (value < 20) {
                    bar.removeClass('progress-bar-success')
                        .removeClass('progress-bar-danger')
                        .addClass('progress-bar-warning');
                }
            }

            function connectionChange(connected) {
                if (connected) {
                    $('#commands').text('Connected').addClass('label-success').removeClass('label-default');
                } else {
                    $('#commands').text('Not Connected').addClass('label-default').removeClass('label-success');
                }

            }

            if (WebSocket) {
                ws = new WebSocket("wss://localhost:3001/");
                ws.onmessage = function(event) {
                    console.log(event.data);
                    var data = JSON.parse(event.data);
                    if (data.event === 'battery') {
                        batteryChange(data.value);
                    } else if (data.event === 'connected') {
                        console.log(data);
                        connectionChange(data.value);
                    }
                }
                ws.onerror = function(err) {
                    console.log(err);
{'fraction_non_alphanumeric': 0.14331619537275064, 'fraction_numerical': 0.00985432733504713, 'mean_word_length': 1.448348190875721, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 35, 'https://': 6, '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': '6049240', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1180, 'n_words': 218}