<commit_before><html>
<head><title>Geolocation</title>
<meta name="viewport" content="width=device-width maximum-scale=1 initial-scale=1 user-scalable=no">
<link rel="stylesheet" type="text/css" href="../../style.css"/>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
<link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.6/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.6/leaflet.js"></script>
</head>
<body>
<h2>Geolocation</h2>
<p id="progress">Please wait...</p>
<p>Latitude: <span id="latitude">unknown</span><br>
Longitude: <span id="longitude">unknown</span><br>
Accuracy: <span id="accuracy">unknown</span></p>
<p>Approximate address: <span id="geocode">unavailable</span></p>
<p id="map" style="height: 280px;"></p>
<script>
var el = document.getElementById('progress'),
    latitude = document.getElementById('latitude'),
    longitude = document.getElementById('longitude'),
    geocode = document.getElementById('geocode');


if (navigator.geolocation) {
    el.textContent = 'Location is obtained.';
    window.onload = function() {
        var geocoder = new google.maps.Geocoder();
        navigator.geolocation.watchPosition(function (position) {
            var coords = position.coords,
                pos = new google.maps.LatLng(coords.latitude, coords.longitude),
                map = L.map('map').setView([coords.latitude, coords.longitude], 11);

            latitude.textContent = coords.latitude.toFixed(2);
            longitude.textContent = coords.longitude.toFixed(2);
            accuracy.textContent = (coords.accuracy/1000).toFixed(1) + ' km';

            map.zoomControl.setPosition('bottomright');
            L.tileLayer('http://{s}.tile.cloudmade.com/031678dbee074a098a6da2d1bad30438/997/256/{z}/{x}/{y}.png', {
                attribution: 'Map data &copy; <a href="http://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a><br>Imagery &copy <a href="http://cloudmade.com/">CloudMade</a>.',
                maxZoom: 18
            }).addTo(map);

            geocoder.geocode({'latLng': pos}, function (results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                    if (results.length && results[0].formatted_address) {
                        geocode.textContent = results[0].formatted_address;
                        L.popup().setLatLng([coords.latitude, coords.longitude]).setContent(results[0].formatted_address).addTo(map);
                    }
                } else {
                    geocode.textContent = 'unavailable (' + status + ')';
                }
            });
        }, function (error) {
            el.textContent = 'Error: ' + error.toMessage();
        }, {
            enableHighAccuracy: true,
            timeout: 30 * 1000,        // 30 secs
            maximumAge: 5 * 60 * 1000, // 5 mins
        });
    };
} else {
    el.textContent = 'Sorry! Your browser does not support geolocation.';
}
</script>
</body>
</html>
<commit_msg>geolocation: Use marker, not popup directly.<commit_after><html>
<head><title>Geolocation</title>
<meta name="viewport" content="width=device-width maximum-scale=1 initial-scale=1 user-scalable=no">
<link rel="stylesheet" type="text/css" href="../../style.css"/>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
<link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.6/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.6/leaflet.js"></script>
</head>
<body>
<h2>Geolocation</h2>
<p id="progress">Please wait...</p>
<p>Latitude: <span id="latitude">unknown</span><br>
Longitude: <span id="longitude">unknown</span><br>
Accuracy: <span id="accuracy">unknown</span></p>
<p>Approximate address: <span id="geocode">unavailable</span></p>
<p id="map" style="height: 280px;"></p>
<script>
var el = document.getElementById('progress'),
    latitude = document.getElementById('latitude'),
    longitude = document.getElementById('longitude'),
    geocode = document.getElementById('geocode');


if (navigator.geolocation) {
    el.textContent = 'Location is obtained.';
    window.onload = function() {
        var geocoder = new google.maps.Geocoder();
        navigator.geolocation.watchPosition(function (position) {
            var coords = position.coords,
                pos = new google.maps.LatLng(coords.latitude, coords.longitude),
                map = L.map('map').setView([coords.latitude, coords.longitude], 11);

            latitude.textContent = coords.latitude.toFixed(2);
            longitude.textContent = coords.longitude.toFixed(2);
            accuracy.textContent = (coords.accuracy/1000).toFixed(1) + ' km';

            map.zoomControl.setPosition('bottomright');
            L.tileLayer('http://{s}.tile.cloudmade.com/031678dbee074a098a6da2d1bad30438/997/256/{z}/{x}/{y}.png', {
                attribution: 'Map data &copy; <a href="http://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a><br>Imagery &copy <a href="http://cloudmade.com/">CloudMade</a>.',
                maxZoom: 18
            }).addTo(map);

            geocoder.geocode({'latLng': pos}, function (results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                    if (results.length && results[0].formatted_address) {
                        geocode.textContent = results[0].formatted_address;
                        L.marker([coords.latitude, coords.longitude]).addTo(map).bindPopup(results[0].formatted_address);
                    }
                } else {
                    geocode.textContent = 'unavailable (' + status + ')';
                }
            });
        }, function (error) {
            el.textContent = 'Error: ' + error.toMessage();
        }, {
            enableHighAccuracy: true,
            timeout: 30 * 1000,        // 30 secs
            maximumAge: 5 * 60 * 1000, // 5 mins
        });
    };
} else {
    el.textContent = 'Sorry! Your browser does not support geolocation.';
}
</script>
</body>
</html>

{'fraction_non_alphanumeric': 0.17139195899407336, 'fraction_numerical': 0.022104757328207592, 'mean_word_length': 2.8119658119658117, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1433548', 'n_tokens_mistral': 2084, 'n_tokens_neox': 1945, 'n_words': 309}