- 逆向行駛 - https://520.be/ -

HTC One Weather widget@iPhone5

Logo

今天看到一個很簡潔的HTC One版本的天氣預報待機畫面,裝上去比HTC Weather Widget 1.75的還省記憶體,印象中裝HTC Weather Widget 1.75時,重開機好只有4XXMB記憶體,現在用這個,重開機完有553MB記憶體,效果也很不錯,修改也簡單~! ?

htc_one_01 [1]htc_one_02 [2]

*********檔案來源*********
原文:Release – HTC One Weather widget LIVE ON CYDIA [3]
分流下載點:http://db.tt/QiuNHUok [4]

*********必備工具*********

1. 已JB而且能上網的哀鳳5 – 不懂JB的看這→【小胖教學】6.1.2 JB evasi0n 1.5.3 (4/18更新) [5]
2. 已在Cydia安裝WinterBoard佈景主題工具
3. NotePad++ – 免費文字編輯軟體阿榮牌免安裝中文版 [6]
4. iTools [7]或是i-FunBox [8]
5. 一顆勇敢又不怕出錯的心 :er

本佈景主題使用的天氣代碼是Y!的,查詢網頁是:http://weather.yahoo.com/ [9]

台灣地區 – http://weather.yahoo.com/taiwan/ [10]

Changhua 彰化 – 2306183
Chiayi 嘉義 – 2296315
Chungli 中壢 – 2306184
Hsinchu 新竹 – 2306185
Hualien 花蓮 – 2306187
Kaohsiung 高雄 – 2306180
Keelung 基隆 – 2306188
Miaoli 苗栗 – 2301128
Nantou 南投 – 2306204
New Taipei 新北市 – 20070569
Pingtung 屏東 – 2306189
Taichung 台中 – 2306181
Tainan 台南 – 2306182
Taipei 台北 – 2306179
Taitung 台東 – 2306190
Taoyuan 桃園 – 2298866
Yilan 宜蘭 – 2306198
Yunlin 雲林 – 2347346

中國地區 – http://weather.yahoo.com/china/ [11]
Beijing 北京 – 2151330
Hong Kong 香港 – 2165352
Macau 澳門 – 1887901
Shanghai 上海 – 2151849
Shenzhen 深圳 – 2161853

*********安裝說明*********

1. 首先把下列四個資料夾複製到手機上的LibraryThemes

HTC One EU Light springboard.theme ← 白色適用的鎖屏畫面佈景主題
HTC One EU Light Lockscreen.theme ← 白色適用的主畫面佈景主題
HTC One EU Dark springboard.theme ← 黑色適用的鎖屏畫面佈景主題
HTC One EU Dark Lockscreen.theme ← 黑色適用的主畫面佈景主題

EU跟US版本差異點在美制預設是12小時制,溫度單位是華氏;歐版是24小時制,溫度單位是攝氏。 ?

2. 依照個人喜好挑選Light或Dark版本的佈景主題資料夾進去修改兩個檔案

Lockscreen.theme資料夾底下的LockBackground.html從第253行開始修改
springboard.theme資料夾底下的Wallpaper.html是從第252行開始修改

var locale = "12798581" // 地區天氣代碼<br />
var isCelsius = true // 溫度使用攝氏,false則會使用華氏<br />
var useRealFeel = false // 啟用體感溫度<br />
var enableWallpaper = true; // 啟用桌布<br />
var enableLockScreen = true; // 啟用鎖屏<br />
var updateInterval = 60 // 更新頻率

3. 到Cydia點下方的搜尋來找Lockscreen Clock Hide,這個小工具是用來隱藏鎖屏畫面用的時鐘。 ?

4. 在Cydia繼續搜尋Gridlock,需要安裝此工具來自訂桌面的圖示位置。 ?

最後回WinterBoard啟用再Respring即可。 ?

*********備註*********

更換背景圖需要進去Light或Dark版本的佈景主題資料夾找到

Lockscreen.theme資料夾底下的LockBackground.png ← 鎖屏畫面背景圖
springboard.theme資料夾底下的Wallpaper.png ← 主畫面背景圖

注意圖片尺寸是寬640*長1136 :O

LockBackground.html範例

@font-face {
font-family: Default1;
src: url(Default1.otf);
}

#Layer {
width: 321px;
height: 569px;
position: absolute;
top: -1px;
right: 0px;
down: 0px;
left: -1px;
}

.stretch {
width:100%;
height:100%;
}

/* -------------------------------------------------------------------------------------- Digital Clock ------------------- */

SPAN#clock {
font-family: Default1;
color: #1d1d1d;
// letter-spacing: 0.06em;
// text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
font-size: 75px;
// opacity: 0.8;
}

SPAN#ampm {
// display: none;
font-family: Default1;
color: #1d1d1d;
// letter-spacing: 0.06em;
// text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
font-size: 14px;
// opacity: 0.8;
}

/* -------------------------------------------------------------------------------------- Calendar ------------------- */

TD#date {
font-family: Default1;
text-align: right;
color: #1d1d1d;
// letter-spacing: 0.06em;
// text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
font-size: 12px;
text-transform: uppercase;
// opacity: 0.8;
}

TD#season {
font-family: Default1;
text-align: center;
color: #1d1d1d;
letter-spacing: 0.06em;
text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
font-size: 20px;
text-transform: none;
opacity: 0.8;
display: none;
}

/* -------------------------------------------------------------------------------------- Weather ------------------- */

#WeatherContainer {
background-color: rgba(0,0,0,0);
}

#TextContainer {
font-size:55px;
font-family: Default1;
// font-weight: bold;
color:#1d1d1d;
}

#city {
position: absolute; top: 113px; right: 0px; down: 0px; left: 92px; width: 320px; height: 481px;
// display: none;
text-align: left;
font-family: Default1;
font-size: 12px;
// text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
color: #1d1d1d;
text-transform: uppercase;
}

#temp {
position: absolute; top: 100px; right: 0px; down: 0px; left: -23px; width: 320px; height: 481px;
margin-top:0px;
text-align: center;
font-family: Default1;
font-size: 14px;
color: #1d1d1d;
text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
opacity: 0.8;
letter-spacing: 0.06em;
display:none;
}

#desc{
position: absolute; top: 200px; right: 0px; down: 0px; left: 0px; width: 320px; height: 461px;
display: none;
text-align: center;
font-family: Default1;
font-size: 14px;
text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
color: #1d1d1d;
}

#TextContainer p{
margin:0;
}

#weatherIcon{

position: absolute; top: 43px; left: 220px; width: 320px; height: 461px;
height:90;
width:90;
}

&nbsp;

function init ( ) { timeDisplay = document.createTextNode ( "" ); document.getElementById("clock&quot ? .appendChild ( timeDisplay ); } function updateClock ( ) { var currentTime = new Date ( ); var currentHours = currentTime.getHours ( ); var currentMinutes = currentTime.getMinutes ( ); var currentSeconds = currentTime.getSeconds ( ); currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes; currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds; var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM"; //currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours; currentHours = ( currentHours == 0 ) ? 12 : currentHours; currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours; var currentTimeString = currentHours + ":" + currentMinutes; document.getElementById("clock&quot ? .firstChild.nodeValue = currentTimeString; } function init2 ( ) { timeDisplay = document.createTextNode ( "" ); document.getElementById("ampm&quot ? .appendChild ( timeDisplay ); } function amPm ( ) { var currentTime = new Date ( ); var currentHours = currentTime.getHours ( ); var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM"; //currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours; //currentHours = ( currentHours == 0 ) ? 12 : currentHours; var currentTimeString = timeOfDay; document.getElementById("ampm&quot ? .firstChild.nodeValue = currentTimeString; } function init3 ( ) { timeDisplay = document.createTextNode ( "" ); document.getElementById("date&quot ? .appendChild ( timeDisplay ); document.getElementById("season&quot ? .appendChild ( timeDisplay ); } function calendarDate ( ) { var this_weekday_name_array = new Array("周日","周一","周二","周三","周四","周五","周六&quot ? //var this_weekday_name_array = new Array("sun","mon","tue","wed","thu","fri","sat&quot ? var this_month_name_array = new Array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月&quot ? //var this_month_name_array = new Array("jan","feb","mar","apr","may","jun","jul","augus","sep","oct","nov","dec&quot ? var this_season_name_array = new Array("冬","冬","春","春","春","夏","夏","夏","秋","秋","秋","冬&quot ? //var this_season_name_array = new Array("Winter","Winter","Spring","Spring","Spring","Summer","Summer","Summer","Autumn","Autumn","Autumn","Winter&quot ? 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_season = this_date_timestamp.getMonth() document.getElementById("date&quot ? .firstChild.nodeValue = this_weekday_name_array[this_weekday] + ", " + this_month_name_array[this_month] + " " + this_date + ", " //document.getElementById("date&quot ? .firstChild.nodeValue = this_weekday_name_array[this_weekday] + ", " +this_month_name_array[this_month] + " " + this_date + " | " document.getElementById("season&quot ? .firstChild.nodeValue = this_season_name_array[this_season] } var locale = "2306184" var isCelsius = true var useRealFeel = false var enableWallpaper = true; var enableLockScreen = true; var stylesheetWall = 'mini' var stylesheetLock = 'mini' var stylesheet = 'mini' var iconSetWall = 'stardock' var iconExtWall = ".png" var iconSetLock = 'stardock' var iconExtLock = '.png' var source = 'yahooWeather' var updateInterval = 60 var postal; var demoMode = false; var enabled; if (location.href.indexOf("LockBackground&quot ? == -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 == "&quot ? { var iconSet = stylesheet; } var headID = document.getElementsByTagName("head&quot ? [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&quot ? .src="Icon Sets/"+iconSet+"/"+"cloudy1"+iconExt; document.getElementById("city&quot ? .innerText="Somewhere"; document.getElementById("desc&quot ? .innerText="Partly Cloudy"; document.getElementById("temp&quot ? .innerText="100º"; }else{ document.getElementById("weatherIcon&quot ? .src="Icon Sets/"+iconSet+"/"+"dunno"+iconExt; validateWeatherLocation(escape(locale).replace(/^%u/g, "%&quot ? , setPostal) } }else{ document.getElementsByTagName("body&quot ? [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, "%&quot ? document.getElementById("WeatherContainer&quot ? .className = ""; weatherRefresherTemp(); }else{ document.getElementById("city&quot ? .innerText="Not Found"; document.getElementById("WeatherContainer&quot ? .className = "errorLocaleNotFound"; } }else{ document.getElementById("city&quot ? .innerText=obj.errorString; document.getElementById("WeatherContainer&quot ? .className = "errorLocaleValidate"; setTimeout('validateWeatherLocation(escape(locale).replace(/^%u/g, "%&quot ? , setPostal)', Math.round(1000*60*5)); } } function dealWithWeather(obj){ if (obj.error == false){ document.getElementById("desc&quot ? .innerText=obj.description.toLowerCase(); if(useRealFeel == true){ tempValue = convertTemp(obj.realFeel); }else{ tempValue = convertTemp(obj.temp) } document.getElementById("city&quot ? .innerHTML=obj.city + ", " + tempValue + "&#176; C"; document.getElementById("weatherIcon&quot ? .src="Icon Sets/"+iconSet+"/"+MiniIcons[obj.icon]+iconExt; document.getElementById("WeatherContainer&quot ? .className = ""; }else{ //Could be down to any number of things, which is unhelpful... document.getElementById("WeatherContainer&quot ? .className = "errorWeatherDataFetch"; } } function weatherRefresherTemp(){ fetchWeatherData(dealWithWeather,postal); setTimeout(weatherRefresherTemp, 60*1000*updateInterval); } var MiniIcons = [ "0", //0 tornado "1", //1 tropical storm "2", //2 hurricane "3", //3 severe thunderstorms "4", //4 thunderstorms "5", //5 mixed rain and snow "6", //6 mixed rain and sleet "7", //7 mixed snow and sleet "8", //8 freezing drizzle "9", //9 drizzle "10", //10 freezing rain "11", //11 showers "12", //12 showers "13", //13 snow flurries "14", //14 light snow showers "15", //15 blowing snow "16", //16 snow "17", //17 hail "18", //18 sleet "19", //19 dust "20", //20 foggy "21", //21 haze "22", //22 smoky "23", //23 blustery "24", //24 windy "25", //25 cold "26", //26 cloudy "27", //27 mostly cloudy (night) "28", //28 mostly cloudy (day) "29", //29 partly cloudy (night) "30", //30 partly cloudy (day) "31", //31 clear (night) "32", //32 sunny "33", //33 fair (night) "34", //34 fair (day) "35", //35 mixed rain and hail "36", //36 hot "37", //37 isolated thunderstorms "38", //38 scattered thunderstorms "39", //39 scattered thunderstorms "40", //40 scattered showers "41", //41 heavy snow "42", //42 scattered snow showers "43", //43 heavy snow "44", //44 partly cloudy "45", //45 thundershowers "46", //46 snow showers "47", //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) { url="http://weather.yahooapis.com/forecastrss?u=f&w=" //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&quot ? ; xml_request.open("GET", url+zip); xml_request.setRequestHeader("Cache-Control", "no-cache&quot ? ; 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&quot ? , "channel&quot ? ; obj.city = findChild(effectiveRoot, "yweather:location&quot ? .getAttribute("city&quot ? ; obj.realFeel = findChild(effectiveRoot, "yweather:wind&quot ? .getAttribute("chill&quot ? ;//Only accounts for windChill conditionTag = findChild(findChild(effectiveRoot, "item&quot ? , "yweather:condition&quot ? ; obj.temp = conditionTag.getAttribute("temp&quot ? ; obj.icon = conditionTag.getAttribute("code&quot ? ; obj.description = conditionTag.getAttribute("text&quot ? ; 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); }


&nbsp;

Home

°

...


updateClock(); setInterval('updateClock()', 1000 )

amPm(); setInterval('amPm()', 1000 )

calendarDate(); setInterval('calendarDate()', 1000 )

&nbsp;

&nbsp;

Wallpaper.html範例

@font-face {
font-family: Default1;
src: url(Default1.otf);
}

#Layer {
width: 321px;
height: 569px;
position: absolute;
top: -1px;
right: 0px;
down: 0px;
left: -1px;
}

.stretch {
width:100%;
height:100%;
}

/* -------------------------------------------------------------------------------------- Digital Clock ------------------- */

SPAN#clock {
font-family: Default1;
color: #1d1d1d;
// letter-spacing: 0.06em;
// text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
font-size: 75px;
// opacity: 0.8;
}

SPAN#ampm {
// display: none;
font-family: Default1;
color: #1d1d1d;
// letter-spacing: 0.06em;
// text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
font-size: 14px;
// opacity: 0.8;
}

/* -------------------------------------------------------------------------------------- Calendar ------------------- */

TD#date {
font-family: Default1;
text-align: right;
color: #1d1d1d;
// letter-spacing: 0.06em;
// text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
font-size: 12px;
text-transform: uppercase;
// opacity: 0.8;
}

TD#season {
font-family: Default1;
text-align: center;
color: #1d1d1d;
letter-spacing: 0.06em;
text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
font-size: 20px;
text-transform: none;
opacity: 0.8;
display: none;
}

/* -------------------------------------------------------------------------------------- Weather ------------------- */

#WeatherContainer {
background-color: rgba(0,0,0,0);
}

#TextContainer {
font-size:55px;
font-family: Default1;
// font-weight: bold;
color:#1d1d1d;
}

#city {
position: absolute; top: 113px; right: 0px; down: 0px; left: 92px; width: 320px; height: 481px;
// display: none;
text-align: left;
font-family: Default1;
font-size: 12px;
// text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
color: #1d1d1d;
text-transform: uppercase;
}

#temp {
position: absolute; top: 100px; right: 0px; down: 0px; left: -23px; width: 320px; height: 481px;
margin-top:0px;
text-align: center;
font-family: Default1;
font-size: 14px;
color: #1d1d1d;
text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
opacity: 0.8;
letter-spacing: 0.06em;
display:none;
}

#desc{
position: absolute; top: 200px; right: 0px; down: 0px; left: 0px; width: 320px; height: 461px;
display: none;
text-align: center;
font-family: Default1;
font-size: 14px;
text-shadow: 1px 4px 4px rgba(0,0,0,0.5);
color: #1d1d1d;
}

#TextContainer p{
margin:0;
}

#weatherIcon{

position: absolute; top: 43px; left: 220px; width: 320px; height: 461px;
height:90;
width:90;
}

&nbsp;

function init ( ) { timeDisplay = document.createTextNode ( "" ); document.getElementById("clock&quot ? .appendChild ( timeDisplay ); } function updateClock ( ) { var currentTime = new Date ( ); var currentHours = currentTime.getHours ( ); var currentMinutes = currentTime.getMinutes ( ); var currentSeconds = currentTime.getSeconds ( ); currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes; currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds; var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM"; //currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours; currentHours = ( currentHours == 0 ) ? 12 : currentHours; currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours; var currentTimeString = currentHours + ":" + currentMinutes; document.getElementById("clock&quot ? .firstChild.nodeValue = currentTimeString; } function init2 ( ) { timeDisplay = document.createTextNode ( "" ); document.getElementById("ampm&quot ? .appendChild ( timeDisplay ); } function amPm ( ) { var currentTime = new Date ( ); var currentHours = currentTime.getHours ( ); var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM"; //currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours; //currentHours = ( currentHours == 0 ) ? 12 : currentHours; var currentTimeString = timeOfDay; document.getElementById("ampm&quot ? .firstChild.nodeValue = currentTimeString; } function init3 ( ) { timeDisplay = document.createTextNode ( "" ); document.getElementById("date&quot ? .appendChild ( timeDisplay ); document.getElementById("season&quot ? .appendChild ( timeDisplay ); } function calendarDate ( ) { var this_weekday_name_array = new Array("周日","周一","周二","周三","周四","周五","周六&quot ? //var this_weekday_name_array = new Array("sun","mon","tue","wed","thu","fri","sat&quot ? var this_month_name_array = new Array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月&quot ? //var this_month_name_array = new Array("jan","feb","mar","apr","may","jun","jul","augus","sep","oct","nov","dec&quot ? var this_season_name_array = new Array("冬","冬","春","春","春","夏","夏","夏","秋","秋","秋","冬&quot ? //var this_season_name_array = new Array("Winter","Winter","Spring","Spring","Spring","Summer","Summer","Summer","Autumn","Autumn","Autumn","Winter&quot ? 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_season = this_date_timestamp.getMonth() document.getElementById("date&quot ? .firstChild.nodeValue = this_weekday_name_array[this_weekday] + ", " + this_month_name_array[this_month] + " " + this_date + ", " //document.getElementById("date&quot ? .firstChild.nodeValue = this_weekday_name_array[this_weekday] + ", " +this_month_name_array[this_month] + " " + this_date + " | " document.getElementById("season&quot ? .firstChild.nodeValue = this_season_name_array[this_season] } var locale = "2306184" var isCelsius = true var useRealFeel = false var enableWallpaper = true; var enableLockScreen = true; var stylesheetWall = 'mini' var stylesheetLock = 'mini' var stylesheet = 'mini' var iconSetWall = 'stardock' var iconExtWall = ".png" var iconSetLock = 'stardock' var iconExtLock = '.png' var source = 'yahooWeather' var updateInterval = 60 var postal; var demoMode = false; var enabled; if (location.href.indexOf("LockBackground&quot ? == -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 == "&quot ? { var iconSet = stylesheet; } var headID = document.getElementsByTagName("head&quot ? [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&quot ? .src="Icon Sets/"+iconSet+"/"+"cloudy1"+iconExt; document.getElementById("city&quot ? .innerText="Somewhere"; document.getElementById("desc&quot ? .innerText="Partly Cloudy"; document.getElementById("temp&quot ? .innerText="100º"; }else{ document.getElementById("weatherIcon&quot ? .src="Icon Sets/"+iconSet+"/"+"dunno"+iconExt; validateWeatherLocation(escape(locale).replace(/^%u/g, "%&quot ? , setPostal) } }else{ document.getElementsByTagName("body&quot ? [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, "%&quot ? document.getElementById("WeatherContainer&quot ? .className = ""; weatherRefresherTemp(); }else{ document.getElementById("city&quot ? .innerText="Not Found"; document.getElementById("WeatherContainer&quot ? .className = "errorLocaleNotFound"; } }else{ document.getElementById("city&quot ? .innerText=obj.errorString; document.getElementById("WeatherContainer&quot ? .className = "errorLocaleValidate"; setTimeout('validateWeatherLocation(escape(locale).replace(/^%u/g, "%&quot ? , setPostal)', Math.round(1000*60*5)); } } function dealWithWeather(obj){ if (obj.error == false){ document.getElementById("desc&quot ? .innerText=obj.description.toLowerCase(); if(useRealFeel == true){ tempValue = convertTemp(obj.realFeel); }else{ tempValue = convertTemp(obj.temp) } document.getElementById("city&quot ? .innerHTML=obj.city + ", " + tempValue + "&#176; C"; document.getElementById("weatherIcon&quot ? .src="Icon Sets/"+iconSet+"/"+MiniIcons[obj.icon]+iconExt; document.getElementById("WeatherContainer&quot ? .className = ""; }else{ //Could be down to any number of things, which is unhelpful... document.getElementById("WeatherContainer&quot ? .className = "errorWeatherDataFetch"; } } function weatherRefresherTemp(){ fetchWeatherData(dealWithWeather,postal); setTimeout(weatherRefresherTemp, 60*1000*updateInterval); } var MiniIcons = [ "0", //0 tornado "1", //1 tropical storm "2", //2 hurricane "3", //3 severe thunderstorms "4", //4 thunderstorms "5", //5 mixed rain and snow "6", //6 mixed rain and sleet "7", //7 mixed snow and sleet "8", //8 freezing drizzle "9", //9 drizzle "10", //10 freezing rain "11", //11 showers "12", //12 showers "13", //13 snow flurries "14", //14 light snow showers "15", //15 blowing snow "16", //16 snow "17", //17 hail "18", //18 sleet "19", //19 dust "20", //20 foggy "21", //21 haze "22", //22 smoky "23", //23 blustery "24", //24 windy "25", //25 cold "26", //26 cloudy "27", //27 mostly cloudy (night) "28", //28 mostly cloudy (day) "29", //29 partly cloudy (night) "30", //30 partly cloudy (day) "31", //31 clear (night) "32", //32 sunny "33", //33 fair (night) "34", //34 fair (day) "35", //35 mixed rain and hail "36", //36 hot "37", //37 isolated thunderstorms "38", //38 scattered thunderstorms "39", //39 scattered thunderstorms "40", //40 scattered showers "41", //41 heavy snow "42", //42 scattered snow showers "43", //43 heavy snow "44", //44 partly cloudy "45", //45 thundershowers "46", //46 snow showers "47", //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) { url="http://weather.yahooapis.com/forecastrss?u=f&w=" //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&quot ? ; xml_request.open("GET", url+zip); xml_request.setRequestHeader("Cache-Control", "no-cache&quot ? ; 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&quot ? , "channel&quot ? ; obj.city = findChild(effectiveRoot, "yweather:location&quot ? .getAttribute("city&quot ? ; obj.realFeel = findChild(effectiveRoot, "yweather:wind&quot ? .getAttribute("chill&quot ? ;//Only accounts for windChill conditionTag = findChild(findChild(effectiveRoot, "item&quot ? , "yweather:condition&quot ? ; obj.temp = conditionTag.getAttribute("temp&quot ? ; obj.icon = conditionTag.getAttribute("code&quot ? ; obj.description = conditionTag.getAttribute("text&quot ? ; 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); }


&nbsp;

Home

°

...


updateClock(); setInterval('updateClock()', 1000 )

amPm(); setInterval('amPm()', 1000 )

calendarDate(); setInterval('calendarDate()', 1000 )
列印本文 [12] 👨‍👩‍👧‍👦 0 次瀏覽