function getForecast() { // if ($("#fc").html() != "") return; var now = new Date(); now = now.getTime(); if (typeof getForecast.last_update == 'undefined') getForecast.last_update = 0; if (getForecast.last_update + 3600000 > now) return; getForecast.last_update = now; if (settings["forecast"] == "yr.no") { // url='https://www.yr.no/sted/' + encodeURI(settings["yr.no"]) + '/forecast.xml'; // url += "?callback=?&t=" + now; // $.getJSON(url, function(fc) { var fc = JSON.parse(makeSyncRequest("yrno.php?url=" + 'https://www.yr.no/sted/' + encodeURI(settings["yr.no"]) + '/forecast.xml')); var i = 0; var date = ''; var str; while (i < 30 && fc.forecast.tabular.time[i]) { var t = fc.forecast.tabular.time[i]; var dt = t['@attributes'].from.replace(/T.*/, ""); var stime = t['@attributes'].from.replace(/.*T/, ""); var etime = t['@attributes'].to.replace(/.*T/, ""); var p = t['@attributes'].period; var sym = t.symbol['@attributes'].number; if (sym.length == 1) sym = '0' + sym; var c_temp = check_convert(t.temperature['@attributes'].value, 'c'); var c_wind = check_convert(roundNumber(t.windSpeed['@attributes'].mps / 0.514444, 1), 'kn'); var c_wdir = check_convert(t.windDirection['@attributes'].deg, 'deg'); var c_baro = check_convert(t.pressure['@attributes'].value, 'hpa'); if (i == 0) str = "<table class='w100'><tr><td></td><td></td><td class='iwdl center bold'>" + c_temp.units + "</td><td class='iwdl center bold'>" + c_wdir.units + "</td><td class='iwdl center bopld'>" + c_wind.units + "</td><td class='iwdl center bold'>" + c_baro.units + "</td><td>"; |