/[drupal]/contributions/modules/wunderground/wunderground.js
ViewVC logotype

Contents of /contributions/modules/wunderground/wunderground.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Sun Nov 9 00:03:44 2008 UTC (12 months, 2 weeks ago) by ppicazo
Branch: MAIN
CVS Tags: DRUPAL-6--2-0, HEAD
Branch point for: DRUPAL-6--2
Changes since 1.2: +3 -1 lines
File MIME type: text/javascript
Added displaying precipitation information. Changed updated time information to display abbreviated timezone name rather than "Local." If updating, you must go in to the settings page and check  "Precipitation" since variable did not exist previously.
1 function wunderground_English()
2 {
3 if (document.getElementById("temp")) { document.getElementById("temp").innerHTML = temp_f + " F"; }
4 if (document.getElementById("pressure")) { document.getElementById("pressure").innerHTML = pressure_in + "\""; }
5 if (document.getElementById("dewpoint")) { document.getElementById("dewpoint").innerHTML = dewpoint_f + " F"; }
6 if (document.getElementById("wind")) { document.getElementById("wind").innerHTML = wind_dir + " @ " + wind_mph + " MPH"; }
7 if (document.getElementById("gusts")) { document.getElementById("gusts").innerHTML = wind_gust_mph + " MPH"; }
8 if (document.getElementById("precip")) { document.getElementById("precip").innerHTML = precip_in + "\" today"; }
9
10 return;
11 }
12
13 function wunderground_Metric()
14 {
15 if (document.getElementById("temp")) { document.getElementById("temp").innerHTML = (Math.round((temp_f - 32) * (5/9) * 100)/100) + " C"; }
16 if (document.getElementById("pressure")) { document.getElementById("pressure").innerHTML = (Math.round(pressure_in * 33.8637526 * 100)/100) + " mb"; }
17 if (document.getElementById("dewpoint")) { document.getElementById("dewpoint").innerHTML = (Math.round((dewpoint_f - 32) * (5/9) * 100)/100) + " C"; }
18 if (document.getElementById("wind")) { document.getElementById("wind").innerHTML = wind_dir + " @ " + (Math.round(wind_mph * 1.609344 * 100)/100) + " km/h"; }
19 if (document.getElementById("gusts")) { document.getElementById("gusts").innerHTML = (Math.round(wind_gust_mph * 1.609344 * 100)/100) + " km/h"; }
20 if (document.getElementById("precip")) { document.getElementById("precip").innerHTML = (Math.round(precip_in * 25.4 * 100)/100) + " mm today"; }
21
22 return;
23 }
24
25 if (units == "Metric") {
26 wunderground_Metric();
27 }
28 else {
29 wunderground_English();
30 }

  ViewVC Help
Powered by ViewVC 1.1.2