Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: gh-pages
Fetching contributors…

Cannot retrieve contributors at this time

126 lines (116 sloc) 3.521 kB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Is it snowing?</title>
<style type="text/css" media="screen">body {
margin-left: 25%;
margin-top: 50px;
color: #000;
background-color: #ffffff;
width: 50%;
}
p {
font-family: Helvetica, Arial, sans-serif;
font-size: 10px;
font-weight: 800;
color: #000;
line-height: 15px;
text-transform: uppercase;
bottom: 0px;
padding: 10px 0px;
position: fixed;
}
h1 {
font-family: Helvetica, Arial, sans-serif;
font-size: 60px;
font-weight: 800;
color: #000;
line-height: 60px;
text-transform: uppercase;
}
#snowContainer {
font-family: Helvetica, Arial, sans-serif;
font-size: 60px;
font-weight: 800;
color: #000;
line-height: 60px;
text-transform: uppercase; /*
margin-left: auto;
margin-right: auto;
width: 150px; */
padding-top:1em;
}
form {
font-family: Helvetica, Arial, sans-serif;
font-size: 20px;
font-weight: 800;
color: #000;
line-height: 40px;
text-transform: uppercase;
}
a:link {color: #000; font-weight: 800;}
a:active {text-decoration: none;}
a:hover {color: #000; text-decoration: underline;}
a:visited {color: #000; text-decoration: none;}
</style>
<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', '50d0efff613f5d08de000001');
t.src = '//secure.gaug.es/track.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
})();
</script>
<meta name="DC.format" content="text/html" />
<meta name="DC.language" content="en" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>
<body>
<div id="wrapper">
<h1>Is it snowing?</h1>
<form action="#" id="mf-url-form" method="get">
<label for="mf-url">Zip Code</label>
<input type="text" id="mf-url" value="" class="text" />
<input type="submit" class="submit" value="Submit" />
</form>
<div id="snowContainer">
</div>
<div id="footer">
<p>Created by <a href="https://twitter.com/natebenes">Nate</a>. | <a href="https://github.com/natebenes/Is-It-Snowing">Fork this</a> | <a href="http://creativecommons.org/licenses/by/3.0/">CC 3.0</a></p>
</div>
</div>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("form#mf-url-form").submit(function() {
$(this).attr("value","");
$('#snowContainer').val("");
var url = escape($("#mf-url").val());
$.getJSON("//query.yahooapis.com/v1/public/yql?q=select%20item.condition%0Afrom%20weather.forecast%20%0Awhere%20location%20in%20(%0A%20%20%20%20select%20postal%20%0A%20%20%20%20from%20geo.placefinder%0A%20%20%20%20where%20text%3D%22"+url+"%22%0A%20%20%20%20limit%201%0A)&format=json&callback=?",
function(data){
if(data.query.results != null){
$(data.query.results.channel.item.condition).each(function(condition){
if(this.text.toLowerCase().indexOf("snow") != -1){
// Check for no results
$("#snowContainer").text("Yup! :)");
}
else {
$("#snowContainer").text("Nope! :(");
}
});
} else {
$("#snowContainer").text("Huh? Try entering a zip code.");
}
});
return false;
});
});
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.