baldwhiteguy.co.nz

-
Technical Blog


JDigiClock: JQuery Clock with Yahoo Weather Feed

15March

Some years ago, a nice jquery digital clock plug-in was doing the rounds, written by a guy called Radoslav Dimov and made available under free MIT and GPL licensing. JDigiClock was a fantastic add-in. Aside from showing time, it displayed current weather and forecast information - and is something I’ve been using for a couple of years (albeit with resizing and a minor modification for time zones) on my www.pantanalescapes.com website. Unfortunately, some months ago it stopped working. The problem was that the support for its weather feed from AccuWeather.com was discontinued. This post contains a short list of the modifications I’ve made to JDigiClock allowing it to use an alternative weather feed from Yahoo. The modified code is also available for download.

Key updates that I’ve made to Radoslav Dimov’s original script are as follow:
  • Changed the weather feed from AccuWeather.com to Yahoo. This is a JSON feed using queries developed using Yahoo’s YQL query specification. Locations are specified using the Yahoo’s Where on Earth ID (WOEID) numbers.
  • The originally supplied weather icons have been re-numbered. These icon names are numbers - based on the weather condition codes returned by the weather feed. Since the condition codes returned by the original accuweather and yahoo feeds differ, the re-numbering was necessary to ensure that an appropriate icon always gets displayed. A “yw” (yahoo weather) prefix has also been added. Potentially you can substitute your own icons if preferred.
  • The original script only displayed the time as per the end-user’s computer (i.e. the user’s local time zone). In practice you may prefer to display the current time in a specific timezone. This is possible using the Server Offset option.
See the JDigiClock Sample Page for further information. This includes a download link for the images and code.
Andrew Mercer (Bald White Guy)
Andrew Mercer
I'm a Business Intelligence and Data Warehousing consultant based in Brisbane, Australia. I've consulted on or managed several large BI systems in New Zealand, Australia and Latin America.
Stacks Image 9105
Contact Info
Please use the contact form on this site.
Or phone 04 5704 1640 (Australia)
Latest Photo

Old-timer with a machine gun. Vintage War truck in 2015 ANZAC Day. Flag with original Australian (and ANZAC) colours is held in the background.

Stacks Image 11045
Stacks Image 11049
Stacks Image 11047
blog comments powered by Disqus
© 2015 Andrew Mercer