<commit_before>$(document).ready(function () {  
   
    var map = new L.map('map', {
        fullscreenControl: true,
        fullscreenControlOptions: {
            position: 'topleft'
        }
    }).setView([52.886525, 14.139851], 7); 
    var storedMarkers = [];
    var focusedMarkerPair = {};
    var focusedLine = {};
    var markerlayers = new L.featureGroup([]);
    
    function parseCoordinateString(raw_coordinates) {
        var coordinates = raw_coordinates.split(',');
                
        // $.each(coordinates, function(index, el) { 
        //     coordinates[index] = parseFloat(el);
        // });
        return L.latLng(coordinates[0], coordinates[1]);
    }

    function addMarkerForType(type, coordinates) {
        var marker;
        var icon;
        switch(type) {
            case "origin_coordinate":
                icon = L.MakiMarkers.icon({icon: "rocket", color: "#f00", size: "m"});
                break;
            case "found_coordinate":
                icon = L.MakiMarkers.icon({icon: "circle", color: "#0f0", size: "m"});
                break;
        }
        console.log(coordinates);
        marker = L.marker(coordinates, {icon: icon}).addTo(map);
        return marker;

    }

    function focusMarkerPair(markerPair) {
        var linesegments = [];
        focusedMarkerPair = markerPair;
        $.each(markerPair, function(index, val) {
            val.setIcon(L.MakiMarkers.icon({icon: "swimming", color: "#ff0", size: "m"}));
            linesegments.push(val.getLatLng());
        });
        focusedLine = L.polyline(linesegments, {color: 'red'}).addTo(map);
    }

    function onMarkerShowPopup(event) {
        
        $.each(storedMarkers, function(markerPairIndex, markerPair) {
             $.each(markerPair, function(markerIndex, marker) {
                  var currentLatLng = marker.getLatLng();
                  if (currentLatLng.equals(event.popup.getLatLng())) {
                    focusMarkerPair(markerPair);
                    console.log('focused');
                  }
             });
        });
    }

    function onMarkerClosePopup(event) {
        focusedMarkerPair.found.setIcon(L.MakiMarkers.icon({icon: "circle", color: "#0f0", size: "m"}));
        focusedMarkerPair.origin.setIcon(L.MakiMarkers.icon({icon: "rocket", color: "#f00", size: "m"}));
        map.removeLayer(focusedLine);
    }

    function getDistanceString(originCoordinate, foundCoordiante) {
        var distanceInMeters = foundCoordiante.distanceTo(originCoordinate);
        var distanceInKilometers = Math.round(distanceInMeters / 1000 *100) / 100;
        return distanceInKilometers + ' km';
    }

    $.getJSON('js/metadata.json', function(data) {
        

        L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
             attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
        }).addTo(map); 
        $.each(data, function(index, el) {
            if (el.coordinate && el.origin_coordinate) {
                var coordinates = parseCoordinateString(el.coordinate);
                var origin_coordinates = parseCoordinateString(el.origin_coordinate);
                
                
                var marker = addMarkerForType("found_coordinate", coordinates);
                marker.bindPopup("<b>" + el.title + "</b><br />" +
                    "Distanz: " + getDistanceString(coordinates, origin_coordinates));
                marker.on('popupopen', onMarkerShowPopup);
                marker.on('popupclose', onMarkerClosePopup);
<commit_msg>changed tile layer to guthub<commit_after>$(document).ready(function () {  
   
    var map = new L.map('map', {
        fullscreenControl: true,
        fullscreenControlOptions: {
            position: 'topleft'
        }
    }).setView([52.886525, 14.139851], 7); 
    var storedMarkers = [];
    var focusedMarkerPair = {};
    var focusedLine = {};
    var markerlayers = new L.featureGroup([]);
    
    function parseCoordinateString(raw_coordinates) {
        var coordinates = raw_coordinates.split(',');
                
        // $.each(coordinates, function(index, el) { 
        //     coordinates[index] = parseFloat(el);
        // });
        return L.latLng(coordinates[0], coordinates[1]);
    }

    function addMarkerForType(type, coordinates) {
        var marker;
        var icon;
        switch(type) {
            case "origin_coordinate":
                icon = L.MakiMarkers.icon({icon: "rocket", color: "#f00", size: "m"});
                break;
            case "found_coordinate":
                icon = L.MakiMarkers.icon({icon: "circle", color: "#0f0", size: "m"});
                break;
        }
        console.log(coordinates);
        marker = L.marker(coordinates, {icon: icon}).addTo(map);
        return marker;

    }

    function focusMarkerPair(markerPair) {
        var linesegments = [];
        focusedMarkerPair = markerPair;
        $.each(markerPair, function(index, val) {
            val.setIcon(L.MakiMarkers.icon({icon: "swimming", color: "#ff0", size: "m"}));
            linesegments.push(val.getLatLng());
        });
        focusedLine = L.polyline(linesegments, {color: 'red'}).addTo(map);
    }

    function onMarkerShowPopup(event) {
        
        $.each(storedMarkers, function(markerPairIndex, markerPair) {
             $.each(markerPair, function(markerIndex, marker) {
                  var currentLatLng = marker.getLatLng();
                  if (currentLatLng.equals(event.popup.getLatLng())) {
                    focusMarkerPair(markerPair);
                    console.log('focused');
                  }
             });
        });
    }

    function onMarkerClosePopup(event) {
        focusedMarkerPair.found.setIcon(L.MakiMarkers.icon({icon: "circle", color: "#0f0", size: "m"}));
        focusedMarkerPair.origin.setIcon(L.MakiMarkers.icon({icon: "rocket", color: "#f00", size: "m"}));
        map.removeLayer(focusedLine);
    }

    function getDistanceString(originCoordinate, foundCoordiante) {
        var distanceInMeters = foundCoordiante.distanceTo(originCoordinate);
        var distanceInKilometers = Math.round(distanceInMeters / 1000 *100) / 100;
        return distanceInKilometers + ' km';
    }

    $.getJSON('js/metadata.json', function(data) {
        

        L.tileLayer('https://{s}.tiles.mapbox.com/v4/knutator.l8m1lim1/{z}/{x}/{y}.png?access_token=<KEY>').addTo(map); 
        $.each(data, function(index, el) {
            if (el.coordinate && el.origin_coordinate) {
                var coordinates = parseCoordinateString(el.coordinate);
                var origin_coordinates = parseCoordinateString(el.origin_coordinate);
                
                
                var marker = addMarkerForType("found_coordinate", coordinates);
                marker.bindPopup("<b>" + el.title + "</b><br />" +
                    "Distanz: " + getDistanceString(coordinates, origin_coordinates));
                marker.on('popupopen', onMarkerShowPopup);
                marker.on('popupclose', onMarkerClosePopup);

{'fraction_non_alphanumeric': 0.13875598086124402, 'fraction_numerical': 0.01125809175344779, 'mean_word_length': 2.1941573033707864, 'pattern_counts': {'":': 4, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 1, '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': '3332546', 'n_tokens_mistral': 2142, 'n_tokens_neox': 2031, 'n_words': 340}