<commit_before>var live_time, load_timeout, app_datatable, map;

function cb(start, end) {
    is_live = live_time.isSame(start, 'day');

    if (is_live) {
        $('#reportrange span').html(<?=$this->escapeJs(__('Live Listeners')) ?>);
    } else {
        $('#reportrange span').html(start.format('ll') + ' - ' + end.format('ll'));
    }

    updateListeners(start, end);
}

var updateListeners = function(start, end) {
    clearTimeout(load_timeout);

    var params = {};
    if (!is_live) {
        params.start = start.format('YYYY-MM-DD');
        params.end = end.format('YYYY-MM-DD');
    }

    $.getJSON('<?=$router->named('api:listeners:index', ['station' => $station->getId()]) ?>', params, function (data) {
        app_datatable.listeners = data;
        setMapPoints(data);

        $('#listener-count').text(data.length);

        if (is_live) {
            load_timeout = setTimeout(updateListeners, 15 * 1000);
        }
    });
};

function initMap()
{
    map = L.map('map').setView([40, 0], 1);

    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
        attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
    }).addTo(map);
}

var markers = new Array();

function setMapPoints(points) {
    for(i=0;i<markers.length;i++) {
        map.removeLayer(markers[i]);
    }
    markers = new Array();

    $.each(points, function(i, l) {
        if (l.location.status !== 'success')
            return null;

        var marker = new L.marker([l.location.lat, l.location.lon])
            .bindPopup('IP: '+l.ip+'<br>' +
                'Country: '+l.location.country+'<br>' +
                'Region: '+l.location.region+'<br>' +
                'City: '+l.location.city+'<br>' +
                'Time connected: '+l.connected_time+'<br>' +
                'User Agent: '+l.user_agent)
            .addTo(map);

        markers.push(marker);
    });
}
<commit_msg>Use a prettier theme for leaflet maps.<commit_after>var live_time, load_timeout, app_datatable, map;

function cb(start, end) {
    is_live = live_time.isSame(start, 'day');

    if (is_live) {
        $('#reportrange span').html(<?=$this->escapeJs(__('Live Listeners')) ?>);
    } else {
        $('#reportrange span').html(start.format('ll') + ' - ' + end.format('ll'));
    }

    updateListeners(start, end);
}

var updateListeners = function(start, end) {
    clearTimeout(load_timeout);

    var params = {};
    if (!is_live) {
        params.start = start.format('YYYY-MM-DD');
        params.end = end.format('YYYY-MM-DD');
    }

    $.getJSON('<?=$router->named('api:listeners:index', ['station' => $station->getId()]) ?>', params, function (data) {
        app_datatable.listeners = data;
        setMapPoints(data);

        $('#listener-count').text(data.length);

        if (is_live) {
            load_timeout = setTimeout(updateListeners, 15 * 1000);
        }
    });
};

function initMap()
{
    map = L.map('map').setView([40, 0], 1);

    L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/<?=$customization->getTheme() ?>_all/{z}/{x}/{y}.png', {
        attribution: 'Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL.'
    }).addTo(map);
}

var markers = new Array();

function setMapPoints(points) {
    for(i=0;i<markers.length;i++) {
        map.removeLayer(markers[i]);
    }
    markers = new Array();

    $.each(points, function(i, l) {
        if (l.location.status !== 'success')
            return null;

        var marker = new L.marker([l.location.lat, l.location.lon])
            .bindPopup('IP: '+l.ip+'<br>' +
                'Country: '+l.location.country+'<br>' +
                'Region: '+l.location.region+'<br>' +
                'City: '+l.location.city+'<br>' +
                'Time connected: '+l.connected_time+'<br>' +
                'User Agent: '+l.user_agent)
            .addTo(map);

        markers.push(marker);
    });
}

{'fraction_non_alphanumeric': 0.1958710976837865, 'fraction_numerical': 0.006042296072507553, 'mean_word_length': 2.5600358422939067, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 29, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, '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': '4220759', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1329, 'n_words': 224}