miniWeather.js

JavaScript library for weather in iWidgets, GroovyLock and LHTML.

Download Current Back to Libraries

Getting started

miniWeather is designed for an easy way to code weather widgets. Contains minimal code, and provides GPS capabilities if you have WidgetWeather. Does not require jQuery.

This library contains the most common used weather elements city, country, lat, long, temp, dew, feelslike, humid, icon, uv, condition, winddir, windspeed, high, low, and update time.

You can call. w.city, w.country, w.lat, w.long, w.temp, w.dew, w.feelslike, w.humid, w.icon, w.uv, w.condition, w.winddir, w.windspd, w.low, w.high, and w.update.

There is an example project HERE (Lockscreen) and HERE (iWidget with options)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
<div id="temp"></div>
<div id="city"></div>
<div id="low"></div>
<div id="high"></div>

<!--include miniWeather.js -->
<script src="js/miniWeather.js"></script>


<!-- get weather -->
<script>
miniWeather({
  code : '38671',
  temp : 'f',
  lang : 'en',
  gps : false, //must use WidgetWeather xml if set to true
  refresh : 15, // in minutes
  success: function(w){
    document.getElementById('temp').innerHTML = w.temp + '&deg;';                  
    document.getElementById('city').innerHTML = w.city;                  
    document.getElementById('low').innerHTML = w.low + '&deg;';                  
    document.getElementById('high').innerHTML = w.high + '&deg;';                  
  }
});
</script>
Tweet Libraries hosted with ❤ by JunesiPhone

Changes for 1.0.1

Fixed an issue with iWidget not running internal function for converting to celsius after respring.

In the miniWeather object you will now call temp : true/false; See code ->

iWidget Example has been updated and shows how to use with Options.plist.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
<div id="temp"></div>
<div id="city"></div>
<div id="low"></div>
<div id="high"></div>

<!--include miniWeather.js -->
<script src="js/miniWeather.js"></script>


<!-- get weather -->
<script>
miniWeather({
  code : '38671',
  temp : true,// true for celsius, false for fareinheit
  lang : 'en',
  gps : false, //must use WidgetWeather xml if set to true
  refresh : 15, // in minutes
  success: function(w){
    document.getElementById('temp').innerHTML = w.temp + '&deg;';                  
    document.getElementById('city').innerHTML = w.city;                  
    document.getElementById('low').innerHTML = w.low + '&deg;';                  
    document.getElementById('high').innerHTML = w.high + '&deg;';                  
  }
});
</script>
Tweet Libraries hosted with ❤ by JunesiPhone