<commit_before><html>
<head>
<title>Kihon Weather</title>
</head>
<body>
<button id="setCookie">Set</button> <button id="getCookie">Get</button> <button id="clearCookie">Clear</button>
<br>
<label for="apikey">Wunderground API key</label>
<br>
<input  type="text" id="apikey" name="apikey" maxlength="20" size="30">
<br>
<label for="zip">US Zip Code</label>
<br>
<input  type="text" id="zip" name="zip" maxlength="50" size="30">
<br>
<button id="weather">Refresh</button>
<br>
<hr>
<div id="time"></div>
<div id="location"></div>
<div id="status"></div>
<div id="temp"></div>
<div id="sun"></div>
<hr>
<div id="precipTitle"></div><br>
<canvas id="precipChart" width="600" height="200"></canvas>
<br>
<div id="tempTitle"></div><br>
<canvas id="tempChart" width="600" height="200"></canvas>
<br>
<div id="forecast"></div>
<br>
</body>
<script type="text/javascript" src="zepto.min.js"></script>
<script type="text/javascript" src="Chart.min.js"></script>
<script type="text/javascript" >
$(function() {
    var protocol = ('https:' == document.location.protocol ? 'https://' : 'http://');
    var baseUrl = "api.wunderground.com/api/";
    var middleUrl = "/conditions/astronomy/forecast/hourly/q/";
    var endUrl = ".json";
    var sep = "/";
    var myPrecipChart = null;
    var myTempChart = null;

    var keyname = "apikey";
    var zipname = "zip";

    if (getPersistentValue(keyname)) {
        $("#"+keyname).val(getPersistentValue(keyname));
    }
    if (getPersistentValue(zipname)) {
        $("#"+zipname).val(getPersistentValue(zipname));
    }

    $("#setCookie").click(function (event) {
        setPersistentValue(keyname, $("#"+keyname).val());
        setPersistentValue(zipname, $("#"+zipname).val());
    });

    $("#getCookie").click(function (event) {
        $("#"+keyname).val(getPersistentValue(keyname));
        $("#"+zipname).val(getPersistentValue(zipname));
    });

    $("#clearCookie").click(function (event) {
        clearPersistentValues();
        $("#"+keyname).val(null);
        $("#"+zipname).val(null);
    });

    $("#weather").click(function (event) {

        var fullUrl = protocol + baseUrl + $("#"+keyname).val() + middleUrl + $("#"+zipname).val() + endUrl;
        console.log(fullUrl);

        $.ajax({
            url : fullUrl,
            dataType : "jsonp",
            success : function(parsed_json) {
                //console.log(JSON.stringify(parsed_json, null, " "));

                $("#time").text("")
                $("#location").text("")
                $("#status").text("")
                $("#temp").text("")
                $("#sun").text("")
                $("#forecast").text("")
                $("#tempTitle").text("")
                $("#precipTitle").text("")

                if (parsed_json['response']['error']) {
                    $("#location").text(parsed_json['response']['error']['type']);
                    $("#temp").text(parsed_json['response']['error']['description']);
                    return;
                }

                $("#time").text(parsed_json['current_observation']['observation_time']);
                $("#location").text(parsed_json['current_observation']['display_location']['full']);
                $("#status").text(parsed_json['current_observation']['weather']);
                $("#temp").text(parsed_json['current_observation']['temperature_string']);
                var sunrise = parsed_json['sun_phase']['sunrise']['hour'] + ":" + parsed_json['sun_phase']['sunrise']['minute']
                var sunset = parsed_json['sun_phase']['sunset']['hour'] + ":" + parsed_json['sun_phase']['sunset']['minute']
                $("#sun").text("Sunrise " + sunrise + " Sunset " + sunset);

                var allforecast =  parsed_json['forecast']['txt_forecast']['forecastday'];
                var fullforecast = [];
                for (var idx = 0; idx < allforecast.length; idx++) {
                    fullforecast.push(allforecast[idx]['title']);
                    fullforecast.push(allforecast[idx]['fcttext']);
                    fullforecast.push(allforecast[idx]['pop'] + "% chance of precipitation");
                    fullforecast.push("\n");
                }
                $("#forecast").html("<pre>" + fullforecast.join('\n') + "</pre>");

                var hourly = parsed_json['hourly_forecast'];<commit_msg>add simple stylesheet, clean up styles a little<commit_after><html>
<head>
<title>Kihon Weather</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
body{margin:5px 20px auto;width: 620px;font-size:16px;color:#444;padding:0 10px}h1,h2,h3{line-height:1.2}
</style>
</head>
<body>
<button id="setCookie">Set</button> <button id="getCookie">Get</button> <button id="clearCookie">Clear</button>
<br>
<label for="apikey">Wunderground API key</label>
<br>
<input  type="text" id="apikey" name="apikey" maxlength="20" size="30">
<br>
<label for="zip">US Zip Code</label>
<br>
<input  type="text" id="zip" name="zip" maxlength="50" size="30">
<br>
<button id="weather">Refresh</button>
<br>
<hr>
<div id="time"></div>
<div id="location"></div>
<div id="status"></div>
<div id="temp"></div>
<div id="sun"></div>
<hr>
<h3 id="precipTitle"></h3><br>
<canvas id="precipChart" width="600" height="200"></canvas>
<br>
<h3 id="tempTitle"></h3><br>
<canvas id="tempChart" width="600" height="200"></canvas>
<br>
<div id="forecast"></div>
<br>
</body>
<script type="text/javascript" src="zepto.min.js"></script>
<script type="text/javascript" src="Chart.min.js"></script>
<script type="text/javascript" >
$(function() {
    var protocol = ('https:' == document.location.protocol ? 'https://' : 'http://');
    var baseUrl = "api.wunderground.com/api/";
    var middleUrl = "/conditions/astronomy/forecast/hourly/q/";
    var endUrl = ".json";
    var sep = "/";
    var myPrecipChart = null;
    var myTempChart = null;

    var keyname = "apikey";
    var zipname = "zip";

    if (getPersistentValue(keyname)) {
        $("#"+keyname).val(getPersistentValue(keyname));
    }
    if (getPersistentValue(zipname)) {
        $("#"+zipname).val(getPersistentValue(zipname));
    }

    $("#setCookie").click(function (event) {
        setPersistentValue(keyname, $("#"+keyname).val());
        setPersistentValue(zipname, $("#"+zipname).val());
    });

    $("#getCookie").click(function (event) {
        $("#"+keyname).val(getPersistentValue(keyname));
        $("#"+zipname).val(getPersistentValue(zipname));
    });

    $("#clearCookie").click(function (event) {
        clearPersistentValues();
        $("#"+keyname).val(null);
        $("#"+zipname).val(null);
    });

    $("#weather").click(function (event) {

        var fullUrl = protocol + baseUrl + $("#"+keyname).val() + middleUrl + $("#"+zipname).val() + endUrl;
        console.log(fullUrl);

        $.ajax({
            url : fullUrl,
            dataType : "jsonp",
            success : function(parsed_json) {
                //console.log(JSON.stringify(parsed_json, null, " "));

                $("#time").text("")
                $("#location").text("")
                $("#status").text("")
                $("#temp").text("")
                $("#sun").text("")
                $("#forecast").text("")
                $("#tempTitle").text("")
                $("#precipTitle").text("")

                if (parsed_json['response']['error']) {
                    $("#location").text(parsed_json['response']['error']['type']);
                    $("#temp").text(parsed_json['response']['error']['description']);
                    return;
                }

                $("#time").text(parsed_json['current_observation']['observation_time']);
                $("#location").text(parsed_json['current_observation']['display_location']['full']);
                $("#status").text(parsed_json['current_observation']['weather']);
                $("#temp").text(parsed_json['current_observation']['temperature_string']);
                var sunrise = parsed_json['sun_phase']['sunrise']['hour'] + ":" + parsed_json['sun_phase']['sunrise']['minute']
                var sunset = parsed_json['sun_phase']['sunset']['hour'] + ":" + parsed_json['sun_phase']['sunset']['minute']
                $("#sun").text("Sunrise " + sunrise + " Sunset " + sunset);

                var allforecast =  parsed_json['forecast']['txt_forecast']['forecastday'];
                var fullforecast = [];
                for (var idx = 0; idx < allforecast.length; idx++) {
                    fullforecast.push("<h3>" + allforecast[idx]['title'] + "</h3>");
                    fullforecast.push(allforecast[idx]['fcttext']);
                    fullforecast.push("\n");
                }
                $("#forecast").html(fullforecast.join('\n'));

                var hourly = parsed_json['hourly_forecast'];
{'fraction_non_alphanumeric': 0.21815519765739386, 'fraction_numerical': 0.007771145399256673, 'mean_word_length': 2.9910112359550562, 'pattern_counts': {'":': 4, '<': 131, '<?xml version=': 0, '>': 129, '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': '2912431', 'n_tokens_mistral': 2768, 'n_tokens_neox': 2717, 'n_words': 422}