From 24103a98725982d1c1d026dccbbe2c98c2f3f0b8 Mon Sep 17 00:00:00 2001 From: "M. Voerman" Date: Fri, 13 Feb 2015 01:49:30 +0100 Subject: Some more translations added --- javascript/weather.js | 63 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 19 deletions(-) (limited to 'javascript') diff --git a/javascript/weather.js b/javascript/weather.js index 2ec412f..911a5ba 100644 --- a/javascript/weather.js +++ b/javascript/weather.js @@ -1,26 +1,51 @@ -function WeatherInfo_current() { +function WeatherInfo1() { + + var htmltext = "

" + Lang[100] + "

"; + htmltext += "\n\n" xmlhttp=new XMLHttpRequest(); - xmlhttp.open("GET","http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon + "&type=accurate&mode=xml&units=metric",false); + xmlhttp.open("GET","http://api.openweathermap.org/data/2.5/weather?q=" + city + "&type=accurate&mode=xml&units=metric",false); xmlhttp.send(); + try { xmlDoc=xmlhttp.responseXML; - htmltext = "

" + " Current Weather

"; - mainmenu.innerHTML = htmltext; - + htmltext += ""; + htmltext += "
"; + htmltext += Lang[104]; + htmltext += " : "; + htmltext += xmlDoc.getElementsByTagName("city")[0].getAttribute("name") + ","; + htmltext += xmlDoc.getElementsByTagName("country")[0].childNodes[0].nodeValue; + htmltext += "
"; + htmltext += Lang[111]; + htmltext += " : "; + htmltext += Math.round(xmlDoc.getElementsByTagName("temperature")[0].getAttribute("value")*10)/10; + htmltext += " " + xmlDoc.getElementsByTagName("temperature")[0].getAttribute("unit"); + htmltext += "
"; + htmltext += Lang[112]; + htmltext += " : "; + htmltext += xmlDoc.getElementsByTagName("temperature")[0].getAttribute("min") + "/"; + htmltext += xmlDoc.getElementsByTagName("temperature")[0].getAttribute("max"); + htmltext += " " + xmlDoc.getElementsByTagName("temperature")[0].getAttribute("unit"); + htmltext += "
"; + htmltext += Lang[109]; + htmltext += " : "; + htmltext += xmlDoc.getElementsByTagName("humidity")[0].getAttribute("value"); + htmltext += xmlDoc.getElementsByTagName("humidity")[0].getAttribute("unit"); + htmltext += "
"; + htmltext += Lang[103]; + htmltext += " : "; + htmltext += xmlDoc.getElementsByTagName("speed")[0].getAttribute("value") + " m/s, "; + htmltext += xmlDoc.getElementsByTagName("direction")[0].getAttribute("name"); + htmltext += "
"; + htmltext += Lang[110]; + htmltext += " : "; + htmltext += xmlDoc.getElementsByTagName("clouds")[0].getAttribute("value"); + htmltext += "
"; + htmltext += " : "; + htmltext += xmlDoc.getElementsByTagName("lastupdate")[0].getAttribute("value"); + } catch(e) { + htmltext = "

\n\n\n" + Lang[67] + "\n\n\n

"; + alert(e); + } } function WeatherInfo() { -- cgit v1.2.3