Hallo oldster´s
Ich hab jetzt mal vom Htc wetter widget
die configureMe,js und Lockbackground.html eingefügt vieleicht kannst du damit was anfangen
configureMe.js
Ich hab jetzt mal vom Htc wetter widget
die configureMe,js und Lockbackground.html eingefügt vieleicht kannst du damit was anfangen
configureMe.js
Code:
// Use weather.com to find your weathercode
// For example searching for London, UK will get you this URL
// http://www.weather.com/weather/today/London+United+Kingdom+UKXX0085
// The last part UKXX0085 is the weathercode to use
var locale = "GMXX0027" //Zipcode, Postalcode, or Weathercode
var isCelsius = true //true or false
var useRealFeel = false
var updateInterval = 10 //Minutes
var showForecast = true
// If you would rather use your own Lockscreen Background
// set showBackground to true and overwrite the included
// LockBackground.png file
var showBackground = false
var showWeatherAni = true
[b]Lockbackground.html[/b]
<html>
<head><title>newclock</title>
<!--Moddified by Jose Sampo (Kevlar)
http://www.Facebook.com/jsampo
Version 1.7 Released 1-28-11 -->
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<style>
body {
background-color: black;
margin: 0;
padding: 10px 0 0 0;
}
SPAN#clock
{
font-family: Helvetica;
font-weight: bold;
color: #d1d1d1;
text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.7);
/*text-shadow: #FFFFFF 0px 1px 0px;*/
font-size: 26px;
}
SPAN#ampm
{
font-family: Helvetica;
font-weight: bold;
color: #d1d1d1;
text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.7);
/*text-shadow: #FFFFFF 0px 1px 0px;*/
font-size: 15px;
display:none;
}
TD#dateString
{
font-family: Helvetica;
font-weight: bold;
color: #d1d1d1;
text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.7);
/*text-shadow: #FFFFFF 0px 1px 0px;*/
font-size: 11px;
text-align:center;
}
TABLE#CalendarTable
{
font-family: Helvetica;
font-weight: bold;
color: #d1d1d1;
text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.7);
/*text-shadow: #FFFFFF 0px 1px 0px;*/
font-size: 11px;
text-align:center;
margin-top:6px;
}
SPAN#calendar
{
font-family: Helvetica;
font-weight: bold;
color: #d1d1d1;
text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.7);
/*text-shadow: #FFFFFF 0px 1px 0px;*/
font-size: 14px;
position:absolute;
top:162px;
text-align:right;
width:300px;
}
</style>
<script type="text/javascript" src="configureMe.js"></script>
<base href="Private/"/>
<script type="text/javascript" "charset=ISO-8859-1">
var this_weekday_name_array = new Array("So","Mo","Di","Mi","Do","Fr","Sa")
var this_month_name_array = new Array("Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez") //predefine month names
var this_date_timestamp = new Date()
var this_weekday = this_date_timestamp.getDay()
var this_date = this_date_timestamp.getDate()
var this_month = this_date_timestamp.getMonth()
var this_year = this_date_timestamp.getYear()
if (this_year < 1000)
this_year+= 1900;
if (this_year==101)
this_year=2001;
var this_date_string = this_weekday_name_array[this_weekday] + " " + this_date + " " + this_month_name_array[this_month]//concat long date string
function init ( )
{
timeDisplay = document.createTextNode ( "" );
document.getElementById("clock").appendChild ( timeDisplay );
}
function updateClock ( )
{
var TwentyFourHourClock = true;
var currentTime = new Date ( );
var currentHours = currentTime.getHours ( );
var currentMinutes = currentTime.getMinutes ( );
var currentSeconds = currentTime.getSeconds ( );
// Pad the minutes and seconds with leading zeros, if required
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
if (TwentyFourHourClock == false){
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM"
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
if (timeOfDay == "PM"){
document.getElementById("ampm").src="pm.png"
}
else
{
document.getElementById("ampm").src="am.png"
}
}
// Compose the string for display
var currentTimeString = currentHours + ":" + currentMinutes;
// Update the time display
currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours;
document.getElementById("hr1").src="Digits/"+currentHours.charAt(0)+".png";
document.getElementById("hr2").src="Digits/"+currentHours.charAt(1)+".png";
document.getElementById("min1").src="Digits/"+currentMinutes.charAt(0)+".png";
document.getElementById("min2").src="Digits/"+currentMinutes.charAt(1)+".png";
}
function init2 ( )
{
timeDisplay = document.createTextNode ( "" );
document.getElementById("ampm").appendChild ( timeDisplay );
}
function amPm ( )
{
var currentTime = new Date ( );
var currentHours = currentTime.getHours ( );
// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
// Compose the string for display
var currentTimeString = timeOfDay;
// Update the time display
document.getElementById("ampm").firstChild.nodeValue = currentTimeString;
}
function init3 ( )
{
timeDisplay = document.createTextNode ( "" );
document.getElementById("calendar").appendChild ( timeDisplay );
}
function daysInMonth(iMonth, iYear)
{
return 32 - new Date(iYear, iMonth, 32).getDate();
}
function zeroPad(num,count)
{
var numZeropad = num + '';
while(numZeropad.length < count) {
numZeropad = "0" + numZeropad;
}
return numZeropad;
}
function calendarDate ( )
{
var this_weekday_name_array = new Array("So","Mo","Di","Mi","Do","Fr","Sa")
var this_month_name_array = new Array("Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez") //predefine month names
var this_date_timestamp = new Date()
var this_weekday = this_date_timestamp.getDay()
var this_date = this_date_timestamp.getDate()
var this_month = this_date_timestamp.getMonth()
Current_Month = this_month
document.getElementById("calendar").firstChild.nodeValue = this_weekday_name_array[this_weekday] + ", " + this_date + ". "+ this_month_name_array[this_month]
}
</script>
<script type="text/javascript" src="translation.js"></script>
<script type="text/javascript">
var MiniIcons =
[
"tstorm3", //0 tornado
"tstorm3", //1 tropical storm
"tstorm3", //2 hurricane
"tstorm3", //3 severe thunderstorms
"tstorm3", //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
"shower3", //11 showers
"shower3", //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
"windy", //23 blustery
"windy", //24 windy
"windy", //25 cold
"overcast", //26 cloudy
"cloudy4_night", //27 mostly cloudy (night)
"cloudy4", //28 mostly cloudy (day)
"cloudy1_night", //29 partly cloudy (night)
"cloudy1", //30 partly cloudy (day)
"sunny_night", //31 clear (night)
"sunny", //32 sunny
"fair_night", //33 fair (night)
"fair", //34 fair (day)
"hail", //35 mixed rain and hail
"hot", //36 hot
"tstorm1", //37 isolated thunderstorms
"tstorm2", //38 scattered thunderstorms
"tstorm2", //39 scattered thunderstorms
"shower1", //40 scattered showers
"snow5", //41 heavy snow
"snow3", //42 scattered snow showers
"snow5", //43 heavy snow
"cloudy1", //44 partly cloudy
"tstorm3", //45 thundershowers
"snow2", //46 snow showers
"tstorm1", //47 isolated thundershowers
"dunno", //3200 not available
]
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)
{
if (isCelsius == false){
varUnit = 'f'
}
else
{
varUnit = 'c'
}
url="http://xml.weather.yahoo.com/forecastrss/" //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+'_'+varUnit+'.xml');
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.sunset = request.responseXML.getElementsByTagName("astronomy")[0].getAttribute("sunset");
obj.sunset = obj.sunset.split(' ')[0]
obj.sunsethr = obj.sunset.split(':')[0]*1+12
obj.sunsetmin = obj.sunset.split(':')[1]
obj.Today = request.responseXML.getElementsByTagName("forecast")[0].getAttribute("day");
obj.TodayHi = request.responseXML.getElementsByTagName("forecast")[0].getAttribute("high");
obj.TodayLo = request.responseXML.getElementsByTagName("forecast")[0].getAttribute("low");
obj.TodayCode = request.responseXML.getElementsByTagName("forecast")[0].getAttribute("code");
obj.Day1 = request.responseXML.getElementsByTagName("forecast")[1].getAttribute("day");
obj.Day1Hi = request.responseXML.getElementsByTagName("forecast")[1].getAttribute("high");
obj.Day1Lo = request.responseXML.getElementsByTagName("forecast")[1].getAttribute("low");
obj.Day1Code = request.responseXML.getElementsByTagName("forecast")[1].getAttribute("code");
obj.Day2 = request.responseXML.getElementsByTagName("forecast")[2].getAttribute("day");
obj.Day2Hi = request.responseXML.getElementsByTagName("forecast")[2].getAttribute("high");
obj.Day2Lo = request.responseXML.getElementsByTagName("forecast")[2].getAttribute("low");
obj.Day2Code = request.responseXML.getElementsByTagName("forecast")[2].getAttribute("code");
obj.Day3 = request.responseXML.getElementsByTagName("forecast")[3].getAttribute("day");
obj.Day3Hi = request.responseXML.getElementsByTagName("forecast")[3].getAttribute("high");
obj.Day3Lo = request.responseXML.getElementsByTagName("forecast")[3].getAttribute("low");
obj.Day3Code = request.responseXML.getElementsByTagName("forecast")[3].getAttribute("code");
obj.Day4 = request.responseXML.getElementsByTagName("forecast")[4].getAttribute("day");
obj.Day4Hi = request.responseXML.getElementsByTagName("forecast")[4].getAttribute("high");
obj.Day4Lo = request.responseXML.getElementsByTagName("forecast")[4].getAttribute("low");
obj.Day4Code = request.responseXML.getElementsByTagName("forecast")[4].getAttribute("code");
forecastTag = findChild(findChild(effectiveRoot, "item"), "yweather:forecast");
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}; //Not very clever, are we?
callback (obj);
}
var LangTranslate = German // or English
var stylesheet = 'myopiaAlt' //'originalBubble'|'myopia'|'iconOnly'|'split'
var iconSet = "HTC" //'klear'|'tango'|null (null makes iconSet = stylesheet)
var iconExt = ".png" //'.png'|.'gif' etc.
var source = 'yahooWeather' //'appleAccuweatherStolen'|'yahooWeather'
</script>
<script type="text/javascript">
var postal;
if(iconSet == null || iconSet == 'null'){
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(){
//document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+"dunno"+iconExt;
validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)
setInterval('fetchWeatherData(dealWithWeather,postal)', 1000*60*updateInterval);
}
function setPostal(obj){
if (obj.error == false){
if(obj.cities.length > 0){
postal = escape(obj.cities[0].zip).replace(/^%u/g, "%")
fetchWeatherData(dealWithWeather,postal);
}else{
document.getElementById("city").innerText="Not Found";
}
}else{
document.getElementById("city").innerText=obj.errorString;
}
}
function dealWithWeather(obj){
if (obj.error == false){
document.getElementById("city").innerText=obj.city.substring(0,11);
if (LangTranslate == English)
{
document.getElementById("desc").innerText=obj.description; //+" ("+obj.icon+")";
}
else
{
document.getElementById("desc").innerText = LangTranslate[obj.icon*1]; }
if(useRealFeel == true){
tempValue = obj.realFeel;
}else{
tempValue = obj.temp;
}
var currentTime = new Date ( );
var currentHours = currentTime.getHours ( );
var currentMinutes = currentTime.getMinutes ( );
if(obj.sunsethr < currentHours){
obj.TOD = "Tonight"
}
else if(obj.sunsethr < currentHours)
{
obj.TOD = "Tonight"
}
else if(currentHours < 2)
{
obj.TOD = "Tonight"
}
else
{
obj.TOD = "Today"
}
if (isCelsius == true) {
document.getElementById("temp").innerHTML=tempValue+ "° C";
} else {
document.getElementById("temp").innerHTML=tempValue+ "° F";
}
document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+obj.icon+iconExt;
if (showBackground == false){
document.getElementById("mainbk").src="Icon Sets/mnidhk"+"/"+obj.icon+iconExt;
}
if (showForecast == true){
document.getElementById("Today").innerHTML=ForecastDayNames(obj.TOD);
document.getElementById("TodayIcon").src="Icon Sets/"+iconSet+"/"+obj.TodayCode+'_small'+iconExt;
document.getElementById("TodayHiLo").innerHTML=obj.TodayHi+ "° / <font color=#a8a8a8>"+obj.TodayLo+ "°</font>";
document.getElementById("Day1").innerHTML=ForecastDayNames(obj.Day1);
document.getElementById("Day1Icon").src="Icon Sets/"+iconSet+"/"+obj.Day1Code+'_small'+iconExt;
document.getElementById("Day1HiLo").innerHTML=obj.Day1Hi+ "° / <font color=#a8a8a8>"+obj.Day1Lo+ "°</font>";
document.getElementById("Day2").innerHTML=ForecastDayNames(obj.Day2);
document.getElementById("Day2Icon").src="Icon Sets/"+iconSet+"/"+obj.Day2Code+'_small'+iconExt;
document.getElementById("Day2HiLo").innerHTML=obj.Day2Hi+ "° / <font color=#a8a8a8>"+obj.Day2Lo+ "°</font>";
document.getElementById("Day3").innerHTML=ForecastDayNames(obj.Day3);
document.getElementById("Day3Icon").src="Icon Sets/"+iconSet+"/"+obj.Day3Code+'_small'+iconExt;
document.getElementById("Day3HiLo").innerHTML=obj.Day3Hi+ "° / <font color=#a8a8a8>"+obj.Day3Lo+ "°</font>";
document.getElementById("Day4").innerHTML=ForecastDayNames(obj.Day4);
document.getElementById("Day4Icon").src="Icon Sets/"+iconSet+"/"+obj.Day4Code+'_small'+iconExt;
document.getElementById("Day4HiLo").innerHTML=obj.Day4Hi+ "° / <font color=#a8a8a8>"+obj.Day4Lo+ "°</font>";
}
var currentTime = new Date ( );
var currentHours = currentTime.getHours ( );
var currentMinutes = currentTime.getMinutes ( );
var currentSeconds = currentTime.getSeconds ( );
// Pad the minutes and seconds with leading zeros, if required
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
// Compose the string for display
var currentTimeString = currentHours + ":" + currentMinutes;
var Conditions = ["thunderstorm",
"rain",
"rain",
"thunderstorm",
"thunderstorm",
"sleet",
"sleet",
"sleet",
"sleet",
"showers_cloud",
"sleet",
"showers_cloud",
"showers_cloud",
"snow",
"snow",
"snow",
"snow",
"hail",
"sleet",
"fog",
"fog",
"Haze",
"fog",
"wind",
"wind",
"frost",
"cloud",
"partlymoon",
"partlysunny",
"partlymoon",
"partlysunny",
"moon",
"sun",
"partlymoon",
"partlysunny",
"sleet",
"sun",
"thunderstorm",
"thunderstorm",
"thunderstorm",
"thunderstorm",
"snow",
"snow",
"snow",
"cloud",
"thunderstorm",
"snow",
"thunderstorm",
"blank"];
if (showWeatherAni == true){
document.getElementById("animationFrame").src="Animations/"+Conditions[obj.icon]+".html";
//debugging weather codes / animations
//document.getElementById("desc").innerText=obj.description +" ("+obj.icon+")" + " / ("+Conditions[obj.icon] +")"
}
}
}
</script>
</head>
<body onLoad="onLoad()" style="margin-left: 0; background-color:black">
<div id="weatherFrame">
<iframe id="animationFrame" name="animation" src="Animations/blank.html" width="320" height="480" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" allowtransparency="true"></iframe>
</div>
<script type="text/javascript">
if (showBackground == false){
document.write("<img name=\"mainbk\" id=\"mainbk\" height=\"568\" style=\"position: absolute; top: 0px; left: -28px; z-index:-1;\">");
} else {
document.write("<img name=\"mainbk\" id=\"mainbk\" src=\"../LockBackground.png\" height=\"568\" style=\"position: absolute; top: 0px; left: -28px; z-index:-1;\">");
}
</script>
<img src="bg.png" style="position: absolute; z-index:-1;top:25; left: 0px;" height="186" width="320">
<img src="" id="ampm" style="position: absolute; z-index:-1;top:135; left: 40px;" width="20">
<table border=0 style="position: absolute; z-index:-1;top:47; left: 37px;"><tr><td><img src="" width="49" height="80" border=0 id="hr1"></td><td><img src="" width="49" height="80" border=0 id="hr2"></td>
<td width=30></td>
<td><img src="" width="49" height="80" border=0 id="min1"></td><td><img src="" width="49" height="80" border=0 id="min2"></td>
</tr>
</table>
<span id="calendar" align=right>
<script language="JavaScript">calendarDate(); setInterval('calendarDate()', 1000 )</script>
</span>
<span id="clock">
<script language="JavaScript">updateClock(); setInterval('updateClock()', 1000 )</script></span> <span id="ampm">
</span>
<div id="WeatherContainer">
<div id="TextContainer">
<img id="weatherIcon" src="" height=108 width=114 style="position:absolute; top:115px;left:103px;z-index:1;">
<a id="city"></a><a id="desc"></a><a id="temp"></a>
<script type="text/javascript">
if (showForecast == true){
document.write("<img src=\"forecast-bg.png\" style=\"position: absolute; z-index:-1;top:225; left: 0px;\" width=\"320\">");
}
</script>
<table cellpadding=0 cellspacing=0 style="position:absolute; top:210px; left:20px;z-index:1" width="280" align=center>
<tr>
<td align=center><img id="TodayIcon" height=50 src=""/></td>
<td align=center><img id="Day1Icon" height=50 src=""/></td>
<td align=center><img id="Day2Icon" height=50 src=""/></td>
<td align=center><img id="Day3Icon" height=50 src=""/></td>
<td align=center><img id="Day4Icon" height=50 src=""/></td>
</tr>
</table>
<table cellpadding=0 cellspacing=0 style="position:absolute; top:250px; left:20px" width="280" align=center>
<tr>
<td align=center><a id="TodayHiLo"></a></td>
<td align=center><a id="Day1HiLo"></a></td>
<td align=center><a id="Day2HiLo"></a></td>
<td align=center><a id="Day3HiLo"></a></td>
<td align=center><a id="Day4HiLo"></a></td>
</tr>
<tr>
<td align=center><a id="Today"></a></td>
<td align=center><a id="Day1"></a></td>
<td align=center><a id="Day2"></a></td>
<td align=center><a id="Day3"></a></td>
<td align=center><a id="Day4"></a></td>
</tr>
</table>
<a id="time" style="position:absolute; top:105px; width:299px;z-index:-1;font-size:8px;display:none;"></a>
</div>
</div>
</body>
</html>