顯示結果從 1 到 3 共計 3 條
-
02-06-2012 #1
各位高手'先進,您們好:
小弟使用 iPhone 4S, 32G, IOS 5.0.1 (已越獄)
目前在Cydia上下載了Dreamboard及Rain Theme,使用上遇到一些問題如下,請高手們指點、指教,謝謝!
1). 請教如何更改天氣,轉換成台灣、台北?
檔案文件內容如下:
a. locationHere.js
內容:// Place your zip code below var locale = "11211"; ←這個定義的是 Brooklyn,請問應該如何改成台灣、台北?
b. 與上述文件搭配的是 functions.js,其內容如下:
var EnableGreeting = false;
var enableWallpaper = true;
var isCelsius = true;
var useRealFeel = false;
var enableWallpaper = true;
var enableLockScreen = false;
var stylesheetWall = 'split_wim66mod';
var stylesheetLock = 'split';
var iconSetWall = 'spils';
var iconExtWall = ".png";
var iconSetLock = 'mau';
var iconExtLock = '.png';
var source = 'yahooWeather';
var updateInterval = 25;
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="Icon Sets/"+iconSet+"/"+"cloudy1"+iconExt;
document.getElementById("city").innerText="Somewhere";
document.getElementById("desc").innerText="Partly Cloudy";
document.getElementById("temp").innerText="100繙";
}else{
validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal);
}
}else{
}
}
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, "%");
weatherRefresherTemp();
}else{
}
}else{
setTimeout('validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)', Math.round(1000*60*5));
}
}
function dealWithWeather(obj){
if (obj.error == false){
if(useRealFeel == true){
tempValue = convertTemp(obj.realFeel);
}else{
tempValue = convertTemp(obj.temp);
}
var Conditions = ["thunderstorm","rain","rain","thunderstorm","thunderstorm","rain","rain","snow","snow","rain","snow","rain","rain","snow","snow","snow","snow","snow","snow","fog","fog","fog","fog","cloud","cloud","cloud","cloud","cloud","cloud","cloud","cloud","sun","sun","fog","fog","rain","sun","thunderstorm","thunderstorm","thunderstorm","thunderstorm","snow","snow","snow","cloud","thunderstorm","snow","thunderstorm","blank"];
document.getElementById("animationFrame").src="Animations/"+Conditions[obj.icon]+".html";
}else{
document.getElementById("WeatherContainer").className = "errorWeatherDataFetch";
}
}
function weatherRefresherTemp(){
fetchWeatherData(dealWithWeather,postal);
setTimeout(weatherRefresherTemp, 60*1000*updateInterval);
}
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=";
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");
conditionTag = findChild(findChild(effectiveRoot, "item"), "yweather:condition");
obj.temp = conditionTag.getAttribute("temp");
obj.icon = conditionTag.getAttribute("code");
obj.description = conditionTag.getAttribute("text");
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);
}
請各位高手們協助,謝謝!!
-
02-08-2012 #2
台北的代碼是TWXX0021,另外DreamBoard在4S上面可以用?目前的版本不是不支援嗎? 此篇文章於 02-08-2012 15:31 被 davidlin86 編輯。
-
03-04-2013 #3
主題套用天氣代碼分為兩種 一種是直接以天氣代碼例如台灣: TWXX0013(高雄) TWXX0021(台北)
另一種是以城市代碼來替換
您的主題 "11211" 即是代表紐約Brooklyn區
那該如何查詢城市代碼呢
首先請到
http://weather.yahoo.com/
在Enter city or zip code的地方
以台北為例 輸入taipei 點擊 GO
就進入台北天氣狀況頁面
這時候看上方網址列會顯示如下
http://weather.yahoo.com/taiwan/taipei/taipei-2306179/
後方數字2306179 就是台北城市碼
希望對您有幫助 謝謝
相似的主題
-
[詢問] 請問要如何在iphone桌面上顯示天氣 時間 rss?
由vincent0400論壇中佈景主題專區回覆: 7最後發表: 02-03-2012, 20:06 -
[詢問] 如何更改鎖定畫面的天氣bar顯示位置
由popwpu論壇中佈景主題專區回覆: 0最後發表: 01-30-2012, 02:59 -
[詢問] 如何修改BUUF動態氣象的顯示地點呢?
由sayoonana論壇中佈景主題專區回覆: 0最後發表: 12-29-2011, 09:08 -
[桌布] 天氣主題請問如何改天氣configureMe.js
由liau_sl論壇中佈景主題專區回覆: 2最後發表: 05-26-2010, 21:40 -
請問如何把天氣修改成台灣的天氣~
由Ivy論壇中iPhone 疑難雜症發問區回覆: 2最後發表: 05-08-2008, 00:16



