Current Weather Widget
HTML
<body>
<div id="wxWrap">
<a href="http://www.weather.com/weather/tenday/Tucson+AZ+USAZ0247" target="_blank" style="text-decoration: none !important;">
<span id="wxIcon2"></span>
<div id="digits"><span id="wxTemp"></span> (<span id="wxTemp2"></span>)</div>
</a>
</div>
</body>
CSS
#wxWrap {
width: 149px;
top: 53px;
position: absolute;
height: 32px;
text-align: left;
z-index: 1;
background-color: #f1f1f1;
}
#wxIntro {
display: inline-block;
font: 14px/20px 'Open Sans',sans-serif;
color: #666;
vertical-align: top;
padding-top: 9px;
}
#wxIcon {
display: inline-block;
width: 50px;
height: 28px;
margin: 2px 0 -1px 1px;
overflow: hidden;
}
#wxIcon2 {
display: inline-block;
width: 34px;
height: 34px;
margin: 1px 6px 0 8px;
overflow: hidden;
}
#wxTemp {}
#wxTemp2 {}
#digits {
font: bold 14px/20px 'Open Sans',sans-serif !important;
color: #333;
display: inline-block;
vertical-align: top;
padding-top: 5px;
margin-left: 0;
}
/* END CSS for Weather Widget */
#news-subpage-summary-blurb {
clear: both;
border: 1px solid #999;
background: #fff;
padding: 10px 10px 10px 0px;
}
#news-subpage-summary-blurb #news-title-wrapper li {
display: inline;
}
#news-subpage-summary-blurb #news-title, #news-subpage-summary-blurb #news-title a {
color: #4A9CD6;
font-family: MuseoSlab-100 !important;
font-size: 1.1em;
padding-top: 8px !important;
text-decoration: none;
}
#news-subpage-summary-blurb #news-title a:hover {
text-decoration: none;
}
#news-subpage-summary-blurb #summary-wrapper {
clear: left;
float: left;
padding-top: 0 !important;
}
#news-subpage-summary-blurb #summary {
color: #777777;
float: left;
font-size: 1em;
line-height: 18px;
}
#news-subpage-summary-blurb a.morelink:link {
color: #385370;
padding-top: 0.5em;
}
#news-subpage-summary-blurb #news_content {
}
#news-subpage-summary-blurb #news-wrapper {
clear: both;
padding: 10px 0;
}
#news-subpage-summary-blurb #news_content h3 {
width: 100%;
}
#news-subpage-summary-blurb #news-text {
float: left;
margin: 10px 0;
}
#news-subpage-summary-blurb #news-text-left {
float: left;
}
#news-subpage-summary-blurb...
JavaScript
$(function () {
var loc = '85701';
var u = 'f';
var v = 'c';
var query = "SELECT item.condition FROM weather.forecast WHERE location='" + loc + "' AND u='" + u + "'";
var cacheBuster = Math.floor((new Date().getTime()) / 1200 / 1000);
var url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(query) + '&format=json&_nocache=' + cacheBuster;
window['wxCallback'] = function (data) {
var info = data.query.results.channel.item.condition;
$('#wxIcon').css({
backgroundPosition: '-' + (61 * info.code) + 'px 0'
}).attr({
title: info.text
});
/* alert (info.temp);*/
var tf = parseInt(info.temp);
var tc = (5/9)*(tf-32);
/* alert (tc);*/
var res=Math.round(tc*Math.pow(10,0))/Math.pow(10,0);
/* alert (dis);*/
$('#wxIcon2').append('<img src="http://l.yimg.com/a/i/us/we/52/' + info.code + '.gif" width="34" height="34" title="' + info.text + '" />');
$('#wxTemp').html(info.temp + '°' + (u.toUpperCase()));
$('#wxTemp2').html(res + '°' + (v.toUpperCase()));
};
$.ajax({
url: url,
dataType: 'jsonp',
cache: true,
jsonpCallback: 'wxCallback'
});
})(jQuery);