<commit_before>/* eslint-env jquery */
/* global io */

(function() {
    'use strict';

    $(function() {
        $('.button-collapse').sideNav({
            edge: 'right'
        });

        $('.dropdown-button').dropdown({
            hover: true
        });
    });
})();

(function(socket_io) {
    'use strict';
    var STALKED_IDS = getStalkedIds();
    console.log(STALKED_IDS);

    setupSocket();

    function setupSocket() {
        var socket = socket_io.connect(window.location.origin);

        socket.on('connection', function(data) {
            console.log(data);
            STALKED_IDS.forEach(function(stalked_id) {
                console.log('Emitting join room', stalked_id);
                socket.emit('join-room', stalked_id);
            });
        });

        socket.on('stalk-data', function(data) {
            console.log(data);
            var card = document.getElementById(data.stalked_id);
            card.querySelector('.stalk-data').innerText = data.message;
        });

        socket.on('disconnect', function() {
            $('.stalk-data').text('Disconnected...');
        });

        setupStalkButton(socket);
        setupStopButton(socket);
    }

    function setupStalkButton(socket) {
        var $btns = $('.stalk-user');

        $btns.click(function() {
            var stalked_id = $(this).closest('.card').attr('id');
            socket.emit('stalk-request', stalked_id);
        });
    }

    function setupStopButton(socket) {
        // var $btns = $('.stop-worker');
        //
        // $btns.click(function() {
        //     var path_parts = window.location.pathname.split('/');
        //     var user_id = path_parts[path_parts.length - 1];
        //     socket.emit('stop-worker', user_id);
        // });
    }

    function getStalkedIds() {
        return $('.stalking-card').toArray().map(function(card) {
            return $(card).attr('id');
        });
    }
})(io);<commit_msg>Connect socket to default namespace. Update stop and start button selectors.<commit_after>/* eslint-env jquery */
/* global io */

(function() {
    'use strict';

    $(function() {
        $('.button-collapse').sideNav({
            edge: 'right'
        });

        $('.dropdown-button').dropdown({
            hover: true
        });
    });
})();

(function(socket_io) {
    'use strict';
    var STALKED_IDS = getStalkedIds();
    console.log(STALKED_IDS);

    setupSocket();

    function setupSocket() {
        var socket = socket_io.connect();

        socket.on('connection', function(data) {
            console.log(data);
            STALKED_IDS.forEach(function(stalked_id) {
                console.log('Emitting join room', stalked_id);
                socket.emit('join-room', stalked_id);
            });
        });

        socket.on('stalk-data', function(data) {
            console.log(data);
            var card = document.getElementById(data.stalked_id);
            card.querySelector('.stalk-data').innerText = data.message;
        });

        socket.on('disconnect', function() {
            $('.stalk-data').text('Disconnected...');
        });

        setupStalkButton(socket);
        setupStopButton(socket);
    }

    function setupStalkButton(socket) {
        var $btns = $('.stalk-start');

        $btns.click(function() {
            var stalked_id = $(this).closest('.card').attr('id');
            socket.emit('stalk-request', stalked_id);
        });
    }

    function setupStopButton(socket) {
        var $btns = $('.stalk-stop');

        $btns.click(function() {
            var stalked_id = $(this).closest('.card').attr('id');
            socket.emit('stalk-stop', stalked_id);
        });
    }

    function getStalkedIds() {
        return $('.stalking-card').toArray().map(function(card) {
            return $(card).attr('id');
        });
    }
})(io);
{'fraction_non_alphanumeric': 0.1713990707279298, 'fraction_numerical': 0.0002581311306143521, 'mean_word_length': 1.9761904761904763, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1520950', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1109, 'n_words': 173}