<commit_before>var map;
var feature;

function load_map() {
    map = new L.Map('map', {zoomControl: true, scrollWheelZoom: false});

    var osmUrl = 'https://{s}.tiles.mapbox.com/v3/examples.3hqcl3di/{z}/{x}/{y}.png',
        osmAttribution = 'Datos de <a href="http://openstreetmap.org/">OpenStreetMap</a>, tiles cortesía de mapbox.',
        osm = new L.TileLayer(osmUrl, {maxZoom: 13, attribution: osmAttribution});

    map.setView(new L.LatLng(-8 , -70), 3).addLayer(osm);
    $.get($('.url-instances').data('url-instance-list'), function(result){
        for (var i=0; i < result.length; i++){
            L.marker(result[i].map_center.split(',')).addTo(map).bindPopup(result[i].city_name);
        }
    });
}

function chooseAddr(lat1, lng1, lat2, lng2, osm_type) {
    var loc1 = new L.LatLng(lat1, lng1);
    var loc2 = new L.LatLng(lat2, lng2);
    var bounds = new L.LatLngBounds(loc1, loc2);

    if (feature) {
        map.removeLayer(feature);
    }
    if (osm_type == "node") {
        feature = L.circle( loc1, 50, {color: 'red', fill: false}).addTo(map);
        map.fitBounds(bounds);
        map.setZoom(18);
    } else {
        var loc3 = new L.LatLng(lat1, lng2);
        var loc4 = new L.LatLng(lat2, lng1);

        feature = L.polyline( [loc1, loc4, loc2, loc3, loc1], {color: 'red'}).addTo(map);
        map.fitBounds(bounds);
    }
}

function addr_search() {
    var inp = $("#flisol-place");

    $.getJSON('http://nominatim.openstreetmap.org/search?format=json&viewbox=-115,81,-35,-56&addressdetails=1&bounded=1&limit=5&q=' + inp.val(), function(data) {
        var items = [];

        $.each(data, function(key, val) {
            var name = val.display_name.split(',')[0];
            var country = val.address.country_code;
            var lon = val.lon;
            var lat = val.lat;
            var bb = val.boundingbox;
            items.push({
                'name': name,
                'country': country,
                'lon': lon,
                'lat': lat,
                'bb0': bb[0],
                'bb2': bb[2],
                'bb1': bb[1],
                'bb3': bb[3],
                'osm_type': val.osm_type,
                'display_name': val.display_name,
            });
        });

        var template = Handlebars.compile($('#result-template').html());
        $('#results').empty().html(template(items));
        $('#search').foundation('reveal', 'open');
        inp.val('');
    });
    return false;
}

function look_for_flisol() {
    $.get($('#search').data('flisol-search-url') + '?search=' + $("#flisol-place").val(),
        function(result){
            if (result.length === 0) {
            }
            else {
                console.log(result);
                var template = Handlebars.compile($('#instance-list-template').html());
                $('#instance-list').empty().html(template(result));
            }
            addr_search();
        }
    )
    return false;
}

function replaceall(original, to_replace, replacement) {
    re = new RegExp(to_replace, "g");
    return original.replace(re, replacement);
}<commit_msg>Fixed dropdown<commit_after>var map;
var feature;

function load_map() {
    map = new L.Map('map', {zoomControl: true, scrollWheelZoom: false});

    var osmUrl = 'https://{s}.tiles.mapbox.com/v3/examples.3hqcl3di/{z}/{x}/{y}.png',
        osmAttribution = 'Datos de <a href="http://openstreetmap.org/">OpenStreetMap</a>, tiles cortesía de mapbox.',
        osm = new L.TileLayer(osmUrl, {maxZoom: 13, attribution: osmAttribution});

    map.setView(new L.LatLng(-8 , -70), 3).addLayer(osm);
    $.get($('.url-instances').data('url-instance-list'), function(result){
        for (var i=0; i < result.length; i++){
            L.marker(result[i].map_center.split(',')).addTo(map).bindPopup(result[i].city_name);
        }
    });
}

function chooseAddr(lat1, lng1, lat2, lng2, osm_type) {
    var loc1 = new L.LatLng(lat1, lng1);
    var loc2 = new L.LatLng(lat2, lng2);
    var bounds = new L.LatLngBounds(loc1, loc2);

    if (feature) {
        map.removeLayer(feature);
    }
    if (osm_type == "node") {
        feature = L.circle( loc1, 50, {color: 'red', fill: false}).addTo(map);
        map.fitBounds(bounds);
        map.setZoom(18);
    } else {
        var loc3 = new L.LatLng(lat1, lng2);
        var loc4 = new L.LatLng(lat2, lng1);

        feature = L.polyline( [loc1, loc4, loc2, loc3, loc1], {color: 'red'}).addTo(map);
        map.fitBounds(bounds);
    }
}

function addr_search() {
    var inp = $("#flisol-place");

    $.getJSON('http://nominatim.openstreetmap.org/search?format=json&viewbox=-115,81,-35,-56&addressdetails=1&bounded=1&limit=5&q=' + inp.val(), function(data) {
        var items = [];

        $.each(data, function(key, val) {
            var name = val.display_name.split(',')[0];
            var country = val.address.country_code;
            var lon = val.lon;
            var lat = val.lat;
            var bb = val.boundingbox;
            items.push({
                'name': name,
                'country': country,
                'lon': lon,
                'lat': lat,
                'bb0': bb[0],
                'bb2': bb[2],
                'bb1': bb[1],
                'bb3': bb[3],
                'osm_type': val.osm_type,
                'display_name': val.display_name,
            });
        });

        var template = Handlebars.compile($('#result-template').html());
        $('#results').empty().html(template(items));
        $(document).foundation();
        $(document).foundation('reveal', 'reflow');
        $('#search').foundation('reveal', 'open');
        inp.val('');
    });
    return false;
}

function look_for_flisol() {
    $.get($('#search').data('flisol-search-url') + '?search=' + $("#flisol-place").val(),
        function(result){
            if (result.length === 0) {
            }
            else {
                var template = Handlebars.compile($('#instance-list-template').html());
                $('#instance-list').empty().html(template(result));
            }
            addr_search();
        }
    )
    return false;
}

function replaceall(original, to_replace, replacement) {
    re = new RegExp(to_replace, "g");
    return original.replace(re, replacement);
}
{'fraction_non_alphanumeric': 0.18145674300254452, 'fraction_numerical': 0.019083969465648856, 'mean_word_length': 2.2168797953964194, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '903856', 'n_tokens_mistral': 2180, 'n_tokens_neox': 2079, 'n_words': 383}