(28.05.2013, 22:00)oldster schrieb: @Martin
Dann schicke mir mal einen download link von deinem Theme.
Gruß oldster
Hi ich habe das hier gefunden soll angeblich die wetter Daten von accuweather nehmen anstatt von yahoo habe aber es aber nicht geschaft bzw den Autor nich ganz verstanden.
http://modmyi.com/forums/ipod-service-wa...ssues.html
Instead of removing the forecast (which is a pretty cool feature to have) - I would rather change the web service to something else that Yahoo. The closest one I found was weather.service.msn.com.
So what I did on my end was the following:
1) Use iFunBox or iFile to edit /var/mobile/Library/PerPageHTML/HTCAniPPH/Widget.html
2) Replace both JavaScript functions 'fetchWeatherData' and 'xml_loaded' with the following:
Code:
function fetchWeatherData(callback, zip) {
varUnit = isCelsius ? 'c' : 'f';
url = 'http://weather.service.msn.com/data.aspx?wealocations=wc%3a' + zip + '&culture=en-US&weadegreetype=' + varUnit.toUpperCase() + '&src=outlook';
var xml_request = new XMLHttpRequest();
xml_request.onload = function(e) {
xml_loaded(e, xml_request, callback);
}
xml_request.open("GET", url);
xml_request.setRequestHeader("Cache-Control", "no-cache");
xml_request.send(null);
return xml_request;
}
function xml_loaded(event, request, callback) {
if (request.responseXML) {
var xml = request.responseXML;
var obj = {
error : false,
errorString : null
};
obj.city = xml.getElementsByTagName("weather")[0].getAttribute("weatherlocationname");
var current = xml.getElementsByTagName("current")[0];
obj.realFeel = current.getAttribute("feelslike");
obj.temp = current.getAttribute("temperature");
obj.icon = current.getAttribute("skycode");
obj.description = current.getAttribute("skytext");
// we don't have sunset information
obj.sunset = "00:00";
obj.sunsethr = "00";
obj.sunsetmin = "00";
var forecasts = xml.getElementsByTagName("forecast");
obj.Today = forecasts[0].getAttribute("shortday");
obj.TodayHi = forecasts[0].getAttribute("high");
obj.TodayLo = forecasts[0].getAttribute("low");
obj.TodayCode = forecasts[0].getAttribute("skycodeday");
obj.Day1 = forecasts[1].getAttribute("shortday");
obj.Day1Hi = forecasts[1].getAttribute("high");
obj.Day1Lo = forecasts[1].getAttribute("low");
obj.Day1Code = forecasts[1].getAttribute("skycodeday");
obj.Day2 = forecasts[2].getAttribute("shortday");
obj.Day2Hi = forecasts[2].getAttribute("high");
obj.Day2Lo = forecasts[2].getAttribute("low");
obj.Day2Code = forecasts[2].getAttribute("skycodeday");
obj.Day3 = forecasts[3].getAttribute("shortday");
obj.Day3Hi = forecasts[3].getAttribute("high");
obj.Day3Lo = forecasts[3].getAttribute("low");
obj.Day3Code = forecasts[3].getAttribute("skycodeday");
obj.Day4 = forecasts[4].getAttribute("shortday");
obj.Day4Hi = forecasts[4].getAttribute("high");
obj.Day4Lo = forecasts[4].getAttribute("low");
obj.Day4Code = forecasts[4].getAttribute("skycodeday");
forecastTag = "";
callback(obj);
} else {
callback({
error : true,
errorString : "XML request failed. no responseXML"
});
}
}
3) Enjoy