MyStats
by Victor
HTML
<div>
<!-- <div class="coffee">
<div class="coffeeIcon"><span class="entypo-cup"></span> Latte Count</div>
<div class="coffeeCount">10</div>
</div> -->
<div id="weather">
<div class="weatherIcon"><span class="entypo-thermometer"></span> </div>
<div class="weatherCurrent"></div>
<div class="weatherTemp">80</div>
</div>
<!-- <div class="tod">
<div class="todIcon"></div>
</div> -->
</div>
CSS
@import url(http://weloveiconfonts.com/api/?family=entypo);
/* entypo */
[class*="entypo-"]:before {
font-family: 'entypo', sans-serif;
}
#weather, .coffee, .tod {
background: #e3e3e3;
border:1px solid #999;
padding:5px;
font-style: italic;
display: inline-block;
}
#weather div, .coffee div {
display: inline;
}
JavaScript
// Docs at http://simpleweatherjs.com
$(document).ready(function() {
$.simpleWeather({
zipcode: '',
woeid: '2357536',
location: '',
unit: 'f',
success: function(weather) {
$('.weatherTemp').text(weather.temp);
if (weather.temp > 50) {
$('.weatherCurrent').append(weather.currently);
};
},
error: function(error) {
$("#weather").html('<p>'+error+'</p>');
}
});
});
/*
* simpleWeather
* http://simpleweatherjs.com
*
* A simple jQuery plugin to display the current weather
* information for any location using Yahoo! Weather.
*
* Developed by James Fleeting <@twofivethreetwo> <http://iwasasuperhero.com>
* Another project from monkeeCreate <http://monkeecreate.com>
*
* Version 2.3.0 - Last updated: June 16 2013
*/
(function(e){"use strict";e.extend({simpleWeather:function(t){t=e.extend({zipcode:"",woeid:"2357536",location:"",unit:"f",success:function(e){},error:function(e){}},t);var n=new Date;var r="http://query.yahooapis.com/v1/public/yql?format=json&rnd="+n.getFullYear()+n.getMonth()+n.getDay()+n.getHours()+"&diagnostics=true&callback=?&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&q=";if(t.location!==""){r+='select * from weather.forecast where location in (select id from weather.search where query="'+t.location+'") and u="'+t.unit+'"'}else if(t.zipcode!==""){r+='select * from weather.forecast where location in ("'+t.zipcode+'") and u="'+t.unit+'"'}else if(t.woeid!==""){r+="select * from weather.forecast where woeid="+t.woeid+' and u="'+t.unit+'"'}else{t.error("Could not retrieve weather due to an invalid WOEID or location.");return false}e.getJSON(r,function(n){if(n!==null&&n.query.results!==null&&n.query.results.channel.description!=="Yahoo! Weather Error"){e.each(n.query.results,function(e,n){if(n.constructor.toString().indexOf("Array")!==-1){n=n[0]}var r=new Date;var i=new Date(r.toDateString()+" "+n.astronomy.sunrise);var s=new Date(r.toDateString()+"...