$(document).ready(function(){$.simpleWeather({location:"Newcastle Upon Tyne, United Kingdom",unit:"c",success:function(a){$("#weather").append('<div class="weatherImg"><img src="'+a.image+'"></div>');$("#weather").append('<div class="weatherTemp">'+a.temp+"&deg; "+a.units.temp+"</div>");$("#weather").append('<div class="weatherDesc">'+a.currently+"</div>");$("#weather").append('<div class="weatherRange"><strong>High</strong>: '+a.high+"&deg; "+a.units.temp+" - <strong>Low</strong>: "+a.low+"&deg; "+a.units.temp+"</div>");$("#weather").append('<div class="weatherLink"><a href="'+a.link+'" target="blank">View full forecast</a></div>')},error:function(a){$("#weather").html("<p>We are sorry, but the weather is unavailable at this time.</p>")}})});$(document).ready(function(){tweetstoshow=4;$("#twitter").getTwitter({userName:"NewcastleNE1",numTweets:tweetstoshow,loaderText:"Loading tweets...",slideIn:false,slideDuration:750,showHeading:false,headingText:"Latest Tweets",showProfileLink:false,showTimestamp:false});var e=0;var b=1000;var c=8000;i=0;function a(){i++;e=$("ul#twitter_update_list li:first").html();title=$("ul#twitter_update_list li:first").attr("title");$("ul#twitter_update_list li:first").fadeOut("fast",function(){$(this).remove()});d(e,title)}function d(g,f){last='<li title="'+f+'" style="display:none">'+g+"</li>";$("ul#twitter_update_list").append(last);$("ul#twitter_update_list li:last").fadeIn("slow")}setInterval(a,c)});$(document).ready(function(){$("#open").click(function(){$("div#panel").slideDown("slow")});$("#close").click(function(){$("div#panel").slideUp("slow")});$("#trigger a").click(function(){$("#trigger a").toggle()})});(function(a){a.extend({simpleWeather:function(b){var b=a.extend({zipcode:"76309",location:"",unit:"f",success:function(d){},error:function(d){}},b);var c="http://query.yahooapis.com/v1/public/yql?format=json&diagnostics=true&callback=?&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&q=";if(b.location!=""){c+='select * from weather.forecast where location in (select id from weather.search where query="'+b.location+'") and u="'+b.unit+'"'}else{if(b.zipcode!=""){c+='select * from weather.forecast where location in ("'+b.zipcode+'") and u="'+b.unit+'"'}else{b.error("No location given.");return false}}a.getJSON(c,function(d){if(d!=null&&d.query.results!=null){a.each(d.query.results,function(f,e){currentDate=new Date();sunRise=new Date(currentDate.toDateString()+" "+e.astronomy.sunrise);sunSet=new Date(currentDate.toDateString()+" "+e.astronomy.sunset);if(currentDate>sunRise&&currentDate<sunSet){timeOfDay="d"}else{timeOfDay="n"}var g={title:e.item.title,temp:e.item.condition.temp,units:{temp:e.units.temperature,distance:e.units.distance,pressure:e.units.pressure,speed:e.units.speed},currently:e.item.condition.text,high:e.item.forecast[0].high,low:e.item.forecast[0].low,forecast:e.item.forecast[0].text,humidity:e.atmosphere.humidity,pressure:e.atmosphere.pressure,rising:e.atmosphere.rising,visibility:e.atmosphere.visibility,sunrise:e.astronomy.sunrise,sunset:e.astronomy.sunset,description:e.item.description,thumbnail:"http://l.yimg.com/a/i/us/nws/weather/gr/"+e.item.condition.code+timeOfDay+"s.png",image:"http://l.yimg.com/a/i/us/nws/weather/gr/"+e.item.condition.code+timeOfDay+".png",tomorrow:{high:e.item.forecast[1].high,low:e.item.forecast[1].low,forecast:e.item.forecast[1].text,date:e.item.forecast[1].date,day:e.item.forecast[1].day,image:"http://l.yimg.com/a/i/us/nws/weather/gr/"+e.item.forecast[1].code+"d.png"},city:e.location.city,country:e.location.country,region:e.location.region,updated:e.item.pubDate,link:e.item.link};b.success(g)})}else{if(d.query.results==null){b.error("Invalid location given.")}else{b.error("Weather could not be displayed. Try again.")}}});return this}})})(jQuery);(function(a){a.fn.getTwitter=function(b){a.fn.getTwitter.defaults={userName:null,numTweets:5,loaderText:"Loading tweets...",slideIn:true,slideDuration:750,showHeading:true,headingText:"Latest Tweets",showProfileLink:true,showTimestamp:true};var c=a.extend({},a.fn.getTwitter.defaults,b);return this.each(function(){var h=a(this);h.hide().empty().addClass("twitted");if(c.showHeading){h.append("<h2>"+c.headingText+"</h2>")}var e='<ul id="twitter_update_list"><li></li></ul>';h.append(e);var d=a("#twitter_update_list");d.hide();var g=a('<p class="preLoader">'+c.loaderText+"</p>");h.append(g);if(c.showProfileLink){var f='<p class="profileLink"><a href="http://twitter.com/'+c.userName+'">http://twitter.com/'+c.userName+"</a></p>";h.append(f)}h.show();a.getScript("http://twitter.com/javascripts/blogger.js");a.getScript("http://twitter.com/statuses/user_timeline/"+c.userName+".json?callback=twitterCallback2&count="+c.numTweets,function(){a(g).remove();if(!c.showTimestamp){d.find("li").each(function(){var l=a(this).children("a");var k=l.html();l.remove();a(this).attr("title",k)})}if(c.slideIn){var j=d.data("originalHeight");if(!j){j=d.show().height();d.data("originalHeight",j);d.hide().css({height:0})}d.show().animate({height:j},c.slideDuration)}else{d.show()}d.find("li:first").addClass("firstTweet");d.find("li:last").addClass("lastTweet")})})}})(jQuery);
