インターネットはリアルと対極にあると考えがちですが、実際にはリアルを補完する存在として使われることのが多いです。スマートフォンでは天気アプリが使われることが多く、Yahooの雨雲レーダーのように5分後、10分後の天気が気になるケースはよくあります。
そんな訳で天気情報は以外とオンラインでもウケが良いです。もしWebサイトに載せるながらReally Simple Weatherを使ってみましょう。

Really Simple Weatherの使い方

Really Simple Weatherはとてもシンプルに書けます。依存ライブラリはありません。


  
<script><br />reallySimpleWeather.weather({<br /> wunderkey: '', // leave blank for Yahoo<br /> location: 'Bend, OR', //your location <br /> woeid: '', // "Where on Earth ID"<br /> unit: 'f', // 'c' also works<br /> success: function(weather) {<br /> html = '<h2>'+weather.temp+'°'+weather.units.temp+'</h2>';<br /> html += '<ul><li>'+weather.city+', '+weather.region+'</li>';<br /> html += '<li>'+weather.currently+'</li>';<br /> html += '<li>'+weather.wind.direction+' '+weather.wind.speed+' '+weather.units.speed+'</li></ul>';<br /> document.getElementById('weather').innerHTML = html;<br /> },<br /> error: function(error) {<br /> document.getElementById('weather').innerHTML = '<p>'+error+'</p>';<br /> }<br />});</script>  

reallySimpleWeather.weatherを実行するとsuccessに対して天気情報が返ってきます。華氏、摂氏のどちらでも取得できます。

特定の都市を指定することも、位置情報を使って一番近い天気情報を取得することもできます。旅行先の天気情報をチェックしたりすることはよくあるので、旅先情報やグルメ情報を提供するサイトとの相性は良いでしょう。

Really Simple WeatherはJavaScript製のオープンソース・ソフトウェア(MIT License/GPL)です。

Really Simple Weather - Pure JavaScript Weather Plugin
a12k/reallySimpleWeather: simple javascript weather plugin with no dependencies