Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5

Probleme mit eXplos1on theme (Wetter)
#1

Hi

Ich hab ein Problem mit dem Wetter im theme.
Normalerweise sollte sich der Hintergrund ändern wenn es jetzt sonnig ist dann sonniges Bild, bei bewölkt ein bewölktes Bild usw.
Nur bei mir bleibt das Bild immer gleich auf das "Not available" (dunno) Bild,...
Ich hab den Skin gelöscht nur das Wetter behalten und etwas umgeschrieben, es geht aber immernoch nicht,.. Ich weiss nicht was ich falsch mache, ich kenn mich da auch nicht so aus,...
Der Code ist noch nicht fertig, wollte noch weiter übersetzen, aber erstmal das mit den Bildern hin bekommen.





<?xml version="1.0" encoding="UTF-16"?>

<html><head>

<base href="Private/"/>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

<script type="text/javascript">





var locale = "GMXX0086"

var isCelsius = true //true|false

var useRealFeel = false //true|false

var enableWallpaper = true; //true|false

var enableLockScreen = *false; //true|false

var stylesheetWall = 'LockScreen'

var stylesheetLock = 'none'

var iconSetWall = 'Images'

var iconExtWall = ".png"

var iconSetLock = 'XTR'

var iconExtLock = '.png'

var source = 'yahooWeather'

var updateInterval = 20

var postal;

var demoMode = false;

var enabled;





if (location.href.indexOf("LockBackground") *== -1){



* * * * stylesheet = stylesheetWall;



* * * * iconSet = iconSetWall;



* * * * iconExt = iconExtWall;



* * * * enabled = enableWallpaper;



}else{



* * * * stylesheet = stylesheetLock;



* * * * iconSet = iconSetLock;



* * * * iconExt = iconExtLock;



* * * * enabled = enableLockScreen;



}



if(enabled == true){



if(iconSet == null || iconSet == 'null' || iconSet == ""){



* * * * var iconSet = stylesheet;



}



var headID = document.getElementsByTagName("head")[0];



var styleNode = document.createElement('link');



styleNode.type = 'text/css';



styleNode.rel = 'stylesheet';



styleNode.href = 'Stylesheets/'+stylesheet+'.css';



headID.appendChild(styleNode);



var scriptNode = document.createElement('script');



scriptNode.type = 'text/javascript';



scriptNode.src = 'Sources/'+source+'.js';



headID.appendChild(scriptNode);



}



function onLoad(){



* * * * if (enabled == true){



* * * * if (demoMode == true){



* * * * * * * * document.getElementById("weatherIcon").src="IconSets/"+iconSet+"/"+"cloudy1"+iconExt;



* * * * * * * * document.getElementById("city").innerText="Somewhere";



* * * * * * * * document.getElementById("desc").innerText=[obj.icon];



* * * * * * * * document.getElementById("temp").innerText="100?";







* * * * }else{



* * * * document.getElementById("weatherIcon").src="IconSets/"+iconSet+"/"+"dunno"+iconExt;



* * * * validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)



* * * * }



* * * * }else{



* * * * * * * * document.getElementsByTagName("body")[0].innerText='';



* * * * }



}



function convertTemp(num)

{

* * * * if (isCelsius == true)

* * * * * * * * return Math.round ((num - 32) * 5 / 9);



* * * * else

* * * * * * * * return num;

}



function setPostal(obj){



* * * * if (obj.error == false){



* * * * * * * * if(obj.cities.length > 0){



* * * * * * * * * * * * postal = escape(obj.cities[0].zip).replace(/^%u/g, "%")



* * * * * * * * * * * * document.getElementById("WeatherContainer").className = "";



* * * * * * * * * * * * weatherRefresherTemp();



* * * * * * * * }else{



* * * * * * * * * * * * document.getElementById("city").innerText="Not Found";



* * * * * * * * * * * * document.getElementById("WeatherContainer").className = "errorLocaleNotFound";



* * * * * * * * }



* * * * }else{



* * * * * * * * document.getElementById("city").innerText=obj.errorString;



* * * * * * * * document.getElementById("WeatherContainer").className = "errorLocaleValidate";



* * * * * * * * setTimeout('validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)', Math.round(1000*60*5));



* * * * }



}



function dealWithWeather(obj){



* * * * if (obj.error == false){



* * * * * * * * document.getElementById("city").innerText=obj.city;



* * * * * * * * document.getElementById("desc").innerText=descriptions[obj.icon];



* * * * * * * * translatedesc=obj.description.toLowerCase();





* * * * * * * * if(useRealFeel == true){



* * * * * * * * * * * * tempValue = convertTemp(obj.realFeel);



* * * * * * * * }else{



* * * * * * * * * * * * tempValue = convertTemp(obj.temp)



* * * * * * * * }

document.getElementById("temp").innerHTML=tempValue+ "°"

* * * * * * * * document.getElementById("hi").innerHTML="H: "+convertTemp(obj.TodayHi)+ "°"

* * * * * * * * document.getElementById("lo").innerHTML="L: "+convertTemp(obj.TodayLo)+ "°"

* * * * * * * * document.getElementById("humidity").innerHTML=obj.humidity+"%"

* * * * * * * * document.getElementById("WeatherContainer").className = "";







* * * * * * * * document.getElementById("weatherIcon").src="IconSets/"+iconSet+"/"+MiniIcons[obj.icon]+iconExt;



* * * * * * * * document.getElementById("WeatherContainer").className = "";



* * * * }else{

* * * * * * * * * * * * * * * * document.getElementById("WeatherContainer").className = "errorWeatherDataFetch";



* * * * }



}



function weatherRefresherTemp(){ //this is one of my nice works so far... dont forget to find me and thank me "ibnyaffa".



* * * * fetchWeatherData(dealWithWeather,postal);



* * * * setTimeout(weatherRefresherTemp, 60*1000*updateInterval);



}

//"ibnyaffa"



var MiniIcons =











[







"tornado", * * * * * * * * * * * //0 * *tornado



* * * * "tstorm3", * * * * * * *//1 * * tropical storm



* * * * "tornado", * * * * * * *//2 * * hurricane



* * * * "tstorm3", * * * * * * *//3 * * severe thunderstorms



* * * * "shower3", * * * * * * *//4 * * thunderstorms



* * * * "sleet", * * * * * * * *//5 * * mixed rain and snow



* * * * "sleet", * * * * * * * *//6 * * mixed rain and sleet



* * * * "sleet", * * * * * * * *//7 * * mixed snow and sleet



* * * * "sleet", * * * * * * * *//8 * * freezing drizzle



* * * * "light_rain", * * * * * //9 * * drizzle



* * * * "sleet", * * * * * * * *//10 * *freezing rain



* * * * "shower2", * * * * * * *//11 * *showers



* * * * "shower2", * * * * * * *//12 * *showers



* * * * "snow1", * * * * * * * *//13 * *snow flurries



* * * * "snow2", * * * * * * * *//14 * *light snow showers



* * * * "snow4", * * * * * * * *//15 * *blowing snow



* * * * "snow4", * * * * * * * *//16 * *snow



* * * * "hail", * * * * * * * * //17 * *hail



* * * * "sleet", * * * * * * * *//18 * *sleet



* * * * "mist", * * * * * * * * //19 * *dust



* * * * "fog", * * * * * * * * *//20 * *foggy



* * * * "fog", * * * * * * * * *//21 * *haze



* * * * "fog", * * * * * * * * *//22 * *smoky



* * * * "cloudy1", * * * * * * *//23 * *blustery



* * * * "wind", * * * * * * * * //24 * *windy



* * * * "ice", * * * * * * * * *//25 * *cold



* * * * "cloudy", * * * * * * * //26 * *cloudy



* * * * "cloudy4_night", * * * * * * * *//27 * *mostly cloudy (night)



* * * * "cloudy", * * * * * * * //28 * *mostly cloudy (day)



* * * * "cloudy2_night", * * * * * * * *//29 * *partly cloudy (night)



* * * * "cloudy2", * * * * * * *//30 * *partly cloudy (day)



* * * * "sunny_night", * * * * *//31 * *clear (night)



* * * * "sunny", * * * * * * * *//32 * *sunny



* * * * "cloudy2_night", * * * * * * * *//33 * *fair (night)



* * * * "cloudy4", * * * * * * *//34 * *fair (day)



* * * * "hail", * * * * * * * * //35 * *mixed rain and hail



* * * * "hot", * * * * * * * * *//36 * *hot



* * * * "tstorm1", * * * * * * *//37 * *isolated thunderstorms



* * * * "shower3", * * * * * * *//38 * *scattered thunderstorms



* * * * "shower3", * * * * * * *//39 * *scattered thunderstorms



* * * * "showers", * * * * * * *//40 * *scattered showers



* * * * "snow5", * * * * * * * *//41 * *heavy snow



* * * * "snow3", * * * * * * * *//42 * *scattered snow showers



* * * * "snow5", * * * * * * * *//43 * *heavy snow



* * * * "cloudy1", * * * * * * *//44 * *partly cloudy



* * * * "storm1", * * * * * * * //45 * *thundershowers



* * * * "snow2", * * * * * * * *//46 * *snow showers



* * * * "tstorm2", * * * * * * *//47 * *isolated thundershowers



* * * * "dunno", * * * * * * * *//3200 *not available



]

var descriptions =



[



"tornado",



"storm",



"hurricane",



"severe storms",



"tstorms",



"rain/snow",



"rain/sleet",



"snow/sleet",



"light rain",



"drizzle",



"sleet",



"showers",



"showers",



"flurries",



"light snow",



"snow",



"snow",



"hail",



"sleet",



"mist",



"foggy",



"haze",



"smoky",



"cold",



"windy",



"cold",



"bewölkt",



"bewölkt",



"bewölkt",



"bewölkt",



"bewölkt",



"clear",



"sunny",



"fair",



"fair",



"rain/hail",



"hot",



"tstorms",



"tstorms",



"tstorms",



"showers",



"heavy snow",



"snow",



"heavy snow",



"bewölkt",



"tshowers",



"snow",



"tshowers",



"n/a",















]









function constructError (string)

{



* * * * return {error:true, errorString:string};



}



function findChild (element, nodeName)

{



* * * * var child;



* * * * for (child = element.firstChild; child != null; child = child.nextSibling)



* * * * {



* * * * * * * * if (child.nodeName == nodeName)



* * * * * * * * * * * * return child;



* * * * }



* * * * return null;

}



function fetchWeatherData (callback, zip)

{



* * * * url="http://weather.yahooapis.com/forecastrss?u=f&p=" //u=Farenheit, because accuWeather sucks



* * * * var xml_request = new XMLHttpRequest();



* * * * xml_request.onload = function(e) {xml_loaded(e, xml_request, callback);}



* * * * xml_request.overrideMimeType("text/xml");



* * * * xml_request.open("GET", url+zip);



* * * * xml_request.setRequestHeader("Cache-Control", "no-cache");



* * * * xml_request.send(null);



* * * * return xml_request;



}



function xml_loaded (event, request, callback)

{



* * * * if (request.responseXML)



* * * * {



* * * * * * * * var obj = {error:false, errorString:null};



* * * * * * * * var effectiveRoot = findChild(findChild(request.responseXML, "rss"), "channel");



* * * * * * * * obj.city = findChild(effectiveRoot, "yweather:location").getAttribute("city");



* * * * * * * * obj.realFeel = findChild(effectiveRoot, "yweather:wind").getAttribute("chill");//Only accounts for windChill







* * * * * * * * conditionTag = findChild(findChild(effectiveRoot, "item"), "yweather:condition");



* * * * * * * * obj.temp = conditionTag.getAttribute("temp");



* * * * * * * * obj.icon = conditionTag.getAttribute("code");



* * * * * * * * obj.description = conditionTag.getAttribute("text");



obj.humidity = request.responseXML.getElementsByTagName("atmosphere")[0].getAttribute("humidity");

* * * * * * * * obj.TodayHi = request.responseXML.getElementsByTagName("forecast")[0].getAttribute("high");

* * * * * * * * obj.TodayLo = request.responseXML.getElementsByTagName("forecast")[0].getAttribute("low");



* * * * * * * * callback (obj);



* * * * }else{



* * * * * * * * callback ({error:true, errorString:"XML request failed. no responseXML"});



* * * * }



}



function validateWeatherLocation (location, callback)

{



* * * * var obj = {error:false, errorString:null, cities: new Array};



* * * * obj.cities[0] = {zip: location};



* * * * callback (obj);



}

</script>

* * *

</span>



* * *</td>



*</tr>


>



*</span>



*</tr>



*</table>









*<table><tr>













*</tr></table>



</body>





<body onload="onLoad()">

<div id="pagewrap">

<div id="background">



* * * * <img src="Wallpaper.png" width="320" /></div>







<img id="weatherIcon" src=""/>

<div id="WeatherContainer">

<div id="TextContainer">

<p id="city">Loading.....</p>

<p id="temp">-�</p>

<p id="desc">versuch</p>

<a id="city"></a><a id="desc"></a><a id="temp"></a>

</div></div>

</body>



</head>



</html>
Zitieren
#2

Kann mir keiner helfen?
Zitieren
#3

nicht wen du das so postest
Zitieren
#4

Wie sonst?
Zitieren


Möglicherweise verwandte Themen…
Thema / Verfasser Antworten Ansichten Letzter Beitrag
Letzter Beitrag von SemtoxC
29.12.2011, 20:53
Letzter Beitrag von Exuled
01.05.2011, 08:43



Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste