<commit_before>var botUsername = '<img class="watson_avatar" src="img/Watson_Avatar_Rev_RGB.png">'; //'bot';
var popup = new mapboxgl.Popup({
    closeButton: false,
    closeOnClick: false
});
var map;

var app = new Vue({
    el: '#app',
    data: {
        webSocketProtocol: webSocketProtocol,
        webSocket: null,
        webSocketConnected: false,
        webSocketPingTimer: null,
        message: '',
        messages: [],
        startMessageSent: false,
        mobile: false,
        mapLoaded: false
    },
    methods: {
        submitMessage: function() {
            var message = {
                user: '<img class="anon_avatar" src="img/Ic_insert_emoticon_48px.png">',
                ts: new Date(),
                key: new Date().getTime() + '',
                data: {
                    type: 'msg',
                    text: app.message
                },
                isUser: true,
                userStyle: {
                    'float': 'right',
                    'padding-right': '0px',
                    'width': '28px'
                },
                msgStyle: {
                    'overflow': 'auto'
                }
            };
            if (app.mobile) {
                app.messages.unshift(message);
            }
            else {
                app.messages.push(message);
            }
            Vue.nextTick(function() { // scroll messages to bottom of window
                document.getElementById('chat-messages').scrollTop = document.getElementById('chat-messages').scrollHeight;
            });
            app.sendMessage(app.message, false);
            app.message = '';
        },
        sendMessage: function(text, startOver) {
            app.webSocket.send(JSON.stringify({
                token: token,
                type: 'msg',
                text: text,
                mobile: app.mobile,
                startOver: startOver
            }));
        },
        init() {
            app.mobile = window.matchMedia('(max-width: 960px)').matches;
            if (! app.mobile) {
                app.initMap(function() {
                    setTimeout(app.onTimer, 1);
                });
            }
            else {
                setTimeout(app.onTimer, 1);
            }
        },
        initMap(onMapLoaded) {
            if (app.mapLoaded) {
                if (onMapLoaded) {
                    return onMapLoaded();
                }
                else {
                    return;
                }
            }
            else {
                app.mapLoaded = true;
                mapboxgl.accessToken = mapboxAccessToken;
                var bounds = [
                    [-98, 29],
                    [-97, 31]
                ]; // Austin city bounds
                map = new mapboxgl.Map({
                    container: "map",
                    style: "mapbox://styles/rajrsingh/cizhoy8xk000i2socld7of1m1",
                    center: [-97.74306, 30.26715],
                    zoom: 14,
                    pitch: 30
                });

                // device geolocation
                var geoloptions = {
                    enableHighAccuracy: true,
                    timeout: 5000,
                    maximumAge: 0
                };


                navigator.geolocation.getCurrentPosition(locateSuccess, locateError, geoloptions);

                map.addControl(new mapboxgl.NavigationControl(), 'top-left');
                map.on('load', onMapLoaded);
            }
        },
        onTimer() {
            if (!app.webSocketConnected) {
                if (app.webSocket) {
                    try {
                        app.webSocket.close();
                    } catch (e) {
                        console.log(e)
                    }
                }
                app.connect();
            }
            else {
                app.webSocket.send(JSON.stringify({
                    token: token,
                    type: 'ping'
                }));
            }
            setTimeout(app.onTimer, 5000);
        },
        connect() {
            if ("WebSocket" in window) {<commit_msg>Bug fix<commit_after>var botUsername = '<img class="watson_avatar" src="img/Watson_Avatar_Rev_RGB.png">'; //'bot';
var popup = new mapboxgl.Popup({
    closeButton: false,
    closeOnClick: false
});
var map;

var app = new Vue({
    el: '#app',
    data: {
        webSocketProtocol: webSocketProtocol,
        webSocket: null,
        webSocketConnected: false,
        webSocketPingTimer: null,
        message: '',
        messages: [],
        startMessageSent: false,
        mobile: false,
        mapLoaded: false
    },
    methods: {
        submitMessage: function() {
            var message = {
                user: '<img class="anon_avatar" src="img/Ic_insert_emoticon_48px.png">',
                ts: new Date(),
                key: new Date().getTime() + '',
                data: {
                    type: 'msg',
                    text: app.message
                },
                isUser: true,
                userStyle: {
                    'float': 'right',
                    'padding-right': '0px',
                    'width': '28px'
                },
                msgStyle: {
                    'overflow': 'auto'
                }
            };
            if (app.mobile) {
                app.messages.unshift(message);
            }
            else {
                app.messages.push(message);
            }
            Vue.nextTick(function() { // scroll messages to bottom of window
                document.getElementById('chat-messages').scrollTop = document.getElementById('chat-messages').scrollHeight;
            });
            app.sendMessage(app.message, false);
            app.message = '';
        },
        sendMessage: function(text, startOver) {
            app.webSocket.send(JSON.stringify({
                token: token,
                type: 'msg',
                text: text,
                mobile: app.mobile,
                startOver: startOver
            }));
        },
        init() {
            app.mobile = window.matchMedia('(max-width: 960px)').matches;
            if (! app.mobile) {
                app.initMap(function() {
                    setTimeout(app.onTimer, 1);
                });
            }
            else {
                setTimeout(app.onTimer, 1);
            }
        },
        initMap(onMapLoaded) {
            if (app.mapLoaded) {
                if (onMapLoaded) {
                    return onMapLoaded();
                }
                else {
                    return;
                }
            }
            else {
                app.mapLoaded = true;
                mapboxgl.accessToken = mapboxAccessToken;
                var bounds = [
                    [-98, 29],
                    [-97, 31]
                ]; // Austin city bounds
                map = new mapboxgl.Map({
                    container: "map",
                    style: "mapbox://styles/rajrsingh/cizhoy8xk000i2socld7of1m1",
                    center: [-97.74306, 30.26715],
                    zoom: 14,
                    pitch: 30
                });

                // device geolocation
                var geoloptions = {
                    enableHighAccuracy: true,
                    timeout: 5000,
                    maximumAge: 0
                };
                navigator.geolocation.getCurrentPosition(locateSuccess, locateError, geoloptions);

                map.addControl(new mapboxgl.NavigationControl(), 'top-left');

                map.on('load', function() {
                    if (onMapLoaded) {
                        onMapLoaded();
                    }
                });
            }
        },
        onTimer() {
            if (!app.webSocketConnected) {
                if (app.webSocket) {
                    try {
                        app.webSocket.close();
                    } catch (e) {
                        console.log(e)
                    }
                }
                app.connect();
            }
            else {
                app.webSocket.send(JSON.stringify({
                    token: token,
                    type: 'ping'
                }));
            }
            setTimeout(app.onTimer, 5000);
        },
        connect() {
            if ("WebSocket" in window) {
{'fraction_non_alphanumeric': 0.10816277962874822, 'fraction_numerical': 0.012613041408852927, 'mean_word_length': 0.9983357108892059, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1599185', 'n_tokens_mistral': 2260, 'n_tokens_neox': 2041, 'n_words': 390}