<commit_before><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Weather Station Select</title>
    <script data-cfasync="false" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script>
        var map, infoWindow, start, stations;

        // Handle select button for weather station selection
        document.addEventListener("click", function(e) {
            if (e.target.className.split(" ").indexOf("selectPWS") > -1) {
                window.top.postMessage({"PWS": e.target.dataset.id},"*");
            }
        }, false);

        // Load the map using the current location as the starting point
        function initialize() {
            if (typeof start === "object") {
                var myOptions = {
                    zoom: 14,
                    center: start,
                    streetViewControl: false,
                    mapTypeControl: false,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                }
                map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
                infoWindow = new google.maps.InfoWindow;
                plotMarker("orgin",{message: "Current Location"},start.lat(),start.lng());
                plotAllMarkers();
                google.maps.event.addListenerOnce(map, "tilesloaded", function(){
                    window.top.postMessage({"loaded":true},"*");
                });
                google.maps.event.addListener(map, "click", function(){
                    infoWindow.close();
                });
            } else {
                setTimeout(initialize,1);
            }
        }

        // Handle communication from parent window
        window.onmessage = function(e) {
            var data = e.data;
            // Handle start point data
            if (data.type === "currentLocation") {
                start = new google.maps.LatLng(data.payload.lat,data.payload.lon);
            // Handle stations data
            } else if (data.type === "pwsData") {
                stations = JSON.parse(decodeURIComponent(data.payload));
                initialize();
            }
        }

        // Plot all stations on the map
        function plotAllMarkers() {
            var bounds = new google.maps.LatLngBounds(),
                marker;

            for (var i=0; i<stations.length; i++) {
                marker = plotMarker("pws",stations[i],stations[i].lat,stations[i].lon);
                if (i === 0) {
                    new google.maps.event.trigger(marker,"click");
                }
                bounds.extend(new google.maps.LatLng(stations[i].lat,stations[i].lon));
            }
            google.maps.event.addListenerOnce(map, "zoom_changed", function(){
                var zoom = map.getZoom();
                if (zoom < 11) {
                    map.setZoom(11);
                    map.setCenter(start);
                }
            });
            map.fitBounds(bounds);
        }

        // Plot an individual station on the map
        function plotMarker(type,data,lat,lon){
            var marker = new google.maps.Marker({
                position: new google.maps.LatLng(lat,lon),
                map: map,
                icon: (type === "orgin" ? "http://maps.google.com/mapfiles/ms/icons/red-dot.png" : "http://maps.google.com/mapfiles/ms/icons/blue-dot.png")
            });

            google.maps.event.addListener(marker, "click", function(){
                infoWindow.close();
                html = (type === "orgin" ? data.message : createInfoWindow(data));
                infoWindow = new google.maps.InfoWindow({
                    content: html
                });
                infoWindow.open(map, marker);
            });

            return marker;
        }

        // Create text for popup info window
        function createInfoWindow(data) {
            return "<div style='min-height:80px;max-width:200px;text-align:center;overflow:hidden!important'><h3 style='padding:0;margin:0 0 4px 0'>"+(data.city ? data.city+", " : "")+(data.state ? data.state+", " : "")+data.country+"</h3><p>"+data.neighborhood+"<br>"+data.distance_mi+" miles away<br><button class='selectPWS' data-id='"+data.id+"'>Select</button></p></div>";
        }
    </script>
    <style>
        html {
            height: 100%;
            overflow: hidden;
        }
        body {
            margin: 0;
            padding: 0;<commit_msg>Options: Improve info window for markers on PWS select<commit_after><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Weather Station Select</title>
    <script data-cfasync="false" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script>
        var map, infoWindow, start, stations;

        // Handle select button for weather station selection
        document.addEventListener("click", function(e) {
            if (e.target.className.split(" ").indexOf("selectPWS") > -1) {
                window.top.postMessage({"PWS": e.target.dataset.id},"*");
            }
        }, false);

        // Load the map using the current location as the starting point
        function initialize() {
            if (typeof start === "object") {
                var myOptions = {
                    zoom: 14,
                    center: start,
                    streetViewControl: false,
                    mapTypeControl: false,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                }
                map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
                infoWindow = new google.maps.InfoWindow;
                plotMarker("orgin",{message: "Current Location"},start.lat(),start.lng());
                plotAllMarkers();
                google.maps.event.addListenerOnce(map, "tilesloaded", function(){
                    window.top.postMessage({"loaded":true},"*");
                });
                google.maps.event.addListener(map, "click", function(){
                    infoWindow.close();
                });
            } else {
                setTimeout(initialize,1);
            }
        }

        // Handle communication from parent window
        window.onmessage = function(e) {
            var data = e.data;
            // Handle start point data
            if (data.type === "currentLocation") {
                start = new google.maps.LatLng(data.payload.lat,data.payload.lon);
            // Handle stations data
            } else if (data.type === "pwsData") {
                stations = JSON.parse(decodeURIComponent(data.payload));
                initialize();
            }
        }

        // Plot all stations on the map
        function plotAllMarkers() {
            var bounds = new google.maps.LatLngBounds(),
                marker;

            for (var i=0; i<stations.length; i++) {
                marker = plotMarker("pws",stations[i],stations[i].lat,stations[i].lon);
                if (i === 0) {
                    new google.maps.event.trigger(marker,"click");
                }
                bounds.extend(new google.maps.LatLng(stations[i].lat,stations[i].lon));
            }
            google.maps.event.addListenerOnce(map, "zoom_changed", function(){
                var zoom = map.getZoom();
                if (zoom < 11) {
                    map.setZoom(11);
                    map.setCenter(start);
                }
            });
            map.fitBounds(bounds);
        }

        // Plot an individual station on the map
        function plotMarker(type,data,lat,lon){
            var marker = new google.maps.Marker({
                position: new google.maps.LatLng(lat,lon),
                map: map,
                icon: (type === "orgin" ? "http://maps.google.com/mapfiles/ms/icons/red-dot.png" : "http://maps.google.com/mapfiles/ms/icons/blue-dot.png")
            });

            google.maps.event.addListener(marker, "click", function(){
                infoWindow.close();
                html = (type === "orgin" ? "<div style='min-height:40px;text-align:center'>"+data.message+"</div>" : createInfoWindow(data));
                infoWindow = new google.maps.InfoWindow({
                    content: html
                });
                infoWindow.open(map, marker);
            });

            return marker;
        }

        // Create text for popup info window
        function createInfoWindow(data) {
            return "<div style='min-height:90px;min-width:170px;text-align:center;'><h3 style='padding:0;margin:0 0 4px 0'>"+(data.city ? data.city+", " : "")+(data.state ? data.state+", " : "")+data.country+"</h3><p>"+data.neighborhood+"<br>"+data.distance_mi+" miles away<br><button class='selectPWS' data-id='"+data.id+"'>Select</button></p></div>";
        }
    </script>
    <style>
        html {
            height: 100%;
            overflow: hidden;
        }
        body {
            margin: 0;
            padding: 0;
{'fraction_non_alphanumeric': 0.1389290882778582, 'fraction_numerical': 0.0064566403206055886, 'mean_word_length': 1.6446864880777157, 'pattern_counts': {'":': 4, '<': 51, '<?xml version=': 0, '>': 49, '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': '3974608', 'n_tokens_mistral': 2506, 'n_tokens_neox': 2362, 'n_words': 466}