[主題] 關於主題語法 請大大來幫忙 TimelessHD-AnalogMOD - iPhone4.TW
本站已於 2026 年 5 月轉為靜態存檔  ·  內容凍結,無法登入、發文、回覆、搜尋  ·  想看吉米最新內容? 前往 jimmy4.tw →


顯示結果從 1 到 4 共計 4 條
  1. #1

    新生報到

    註冊日期:02-08-2011
    文章:9
    謝謝你: 0
    在 1篇文章中獲得 1個感謝
    各位大大 小弟我是用TimelessHD-AnalogMOD的主題

    想要把 天氣 改成攝氏 跟 台灣台北的 今天下午就開始爬文 也開過 很多相關文章
    但是 都顯示不出來都是亂碼 我已經不知道該怎麼解決 想請 好心的大大幫我指點迷津
    下面是我改的

    <html><head><title>Weather</title></head>



    <base href=""/>

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







    <script type="text/javascript">



    // Enable Greetings

    var EnableGreeting = false;



    // Enable Weather SpringBoard

    var enableWallpaper = true;





    // The location field should be a relatively machine-legible string

    // if using the default, Apple/AccuWeather parser (originally from Leopard's Weather.wdgt)

    var locale = "TWXX0021" //e.g. 'Defiance, Ohio'|'Moscow, Russia'|'Ledyard, AT'|'London, UK'



    // Set to 'false' if you'd prefer Farenheit

    var isCelsius = false //true|false



    // Use 'Real Feel' temperatures where possible, taking into account Wind Chill, Humidity etc.

    var useRealFeel = false //true|false



    /*????????????????????????????????????????????????*/

    //Enable Wallpaper and/or Lock Screen

    var enableWallpaper = true; //true|false

    var enableLockScreen = true; //true|false [Currently, it is suggested that the lockScreen is disabled.]



    // Supplied styles are 'originalBubble', 'myopia', 'iconOnly' and 'split'.

    // (Add your own to the CSS folder!)

    var stylesheetWall = 'split' //'originalBubble'|'myopia'|'iconOnly'|'split'|'oneLine'

    var stylesheetLock = 'split' //See above.



    // The only supplied icon set is 'tango'

    // Images must follow the same naming schema as the 'springboard' set (borrowed from KWeather)

    var iconSetWall = 'tango' //'springboard'|'Lockscreen'

    var iconExtWall = ".png" //'.png'|.'gif' etc.

    var iconSetLock = 'tango' //See above.

    var iconExtLock = '.png' //See above.





    /*????????????????????????????????????????????????*/



    // The other available source is 'yahooWeather' which for the 'locale'

    // requires a US zip or location code (e.g. UKXX0085 or CHXX0008) from http://weather.yahoo.com

    var source = 'yahooWeather' //'appleAccuweatherStolen'|'yahooWeather'



    // Please endeavour to set this to a sensible value if you really must change it...

    var updateInterval = 35 //Minutes





    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{

    document.getElementById("weatherIcon").src="Icon Sets/"+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=obj.description.toLowerCase();



    if(useRealFeel == true){

    tempValue = convertTemp(obj.realFeel);

    }else{

    tempValue = convertTemp(obj.temp)

    }

    document.getElementById("temp").innerText=tempValue+"º";

    document.getElementById("weatherIcon").src="Icon Sets/"+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);

    }



    var MiniIcons =



    [



    "tstorm3", //0 tornado



    "tstorm3", //1 tropical storm



    "tstorm3", //2 hurricane



    "tstorm3", //3 severe thunderstorms



    "tstorm2", //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



    "overcast", //25 cold



    "cloudy5", //26 cloudy



    "cloudy3_night", //27 mostly cloudy (night)



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



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



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



    "sunny_night", //31 clear (night)



    "sunny", //32 sunny



    "mist_night", //33 fair (night)



    "mist", //34 fair (day)



    "hail", //35 mixed rain and hail



    "sunny", //36 hot



    "tstorm1", //37 isolated thunderstorms



    "tstorm2", //38 scattered thunderstorms



    "tstorm2", //39 scattered thunderstorms



    "tstorm2", //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



    "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)

    {

    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");

    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);

    }

    </script>









    </head>

    <body bgcolor="Transparent" onload="onLoad()">



    <div id="WeatherContainer"> <div id="TextContainer"> <p id="city">Loading...</p> <p id="temp">...</p> <p id="desc">...</p> </div>

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



    </body></html>


  2. #2

    愛用者

    註冊日期:08-23-2009
    文章:145
    謝謝你: 0
    在 0篇文章中獲得 0個感謝
    your weather code is wrong...

    this line...


    var locale = "TWXX0021" //e.g. 'Defiance, Ohio'|'Moscow, Russia'|'Ledyard, AT'|'London, UK'

    "TWXX0021" this is for yahoo...i see u have AccuWeather set....

    for accweather code..for taipei it looks like this..

    ASI|TW|TW018|TAIPEI

    u need to have the correct code for it to work


    天氣 改成攝氏

    this line

    // Set to 'false' if you'd prefer Farenheit

    var isCelsius = false //true|false

    change the false t----> true

    remember after u made the change..u have to respring your devices to see the changes

    引用 作者: huang000 查看文章
    各位大大 小弟我是用TimelessHD-AnalogMOD的主題

    想要把 天氣 改成攝氏 跟 台灣台北的 今天下午就開始爬文 也開過 很多相關文章
    但是 都顯示不出來都是亂碼 我已經不知道該怎麼解決 想請 好心的大大幫我指點迷津
    下面是我改的

    <html><head><title>Weather</title></head>



    <base href=""/>

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







    <script type="text/javascript">



    // Enable Greetings

    var EnableGreeting = false;



    // Enable Weather SpringBoard

    var enableWallpaper = true;





    // The location field should be a relatively machine-legible string

    // if using the default, Apple/AccuWeather parser (originally from Leopard's Weather.wdgt)

    var locale = "TWXX0021" //e.g. 'Defiance, Ohio'|'Moscow, Russia'|'Ledyard, AT'|'London, UK'



    // Set to 'false' if you'd prefer Farenheit

    var isCelsius = false //true|false



    // Use 'Real Feel' temperatures where possible, taking into account Wind Chill, Humidity etc.

    var useRealFeel = false //true|false



    /*????????????????????????????????????????????????*/

    //Enable Wallpaper and/or Lock Screen

    var enableWallpaper = true; //true|false

    var enableLockScreen = true; //true|false [Currently, it is suggested that the lockScreen is disabled.]



    // Supplied styles are 'originalBubble', 'myopia', 'iconOnly' and 'split'.

    // (Add your own to the CSS folder!)

    var stylesheetWall = 'split' //'originalBubble'|'myopia'|'iconOnly'|'split'|'oneLine'

    var stylesheetLock = 'split' //See above.



    // The only supplied icon set is 'tango'

    // Images must follow the same naming schema as the 'springboard' set (borrowed from KWeather)

    var iconSetWall = 'tango' //'springboard'|'Lockscreen'

    var iconExtWall = ".png" //'.png'|.'gif' etc.

    var iconSetLock = 'tango' //See above.

    var iconExtLock = '.png' //See above.





    /*????????????????????????????????????????????????*/



    // The other available source is 'yahooWeather' which for the 'locale'

    // requires a US zip or location code (e.g. UKXX0085 or CHXX0008) from http://weather.yahoo.com

    var source = 'yahooWeather' //'appleAccuweatherStolen'|'yahooWeather'



    // Please endeavour to set this to a sensible value if you really must change it...

    var updateInterval = 35 //Minutes





    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{

    document.getElementById("weatherIcon").src="Icon Sets/"+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=obj.description.toLowerCase();



    if(useRealFeel == true){

    tempValue = convertTemp(obj.realFeel);

    }else{

    tempValue = convertTemp(obj.temp)

    }

    document.getElementById("temp").innerText=tempValue+"º";

    document.getElementById("weatherIcon").src="Icon Sets/"+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);

    }



    var MiniIcons =



    [



    "tstorm3", //0 tornado



    "tstorm3", //1 tropical storm



    "tstorm3", //2 hurricane



    "tstorm3", //3 severe thunderstorms



    "tstorm2", //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



    "overcast", //25 cold



    "cloudy5", //26 cloudy



    "cloudy3_night", //27 mostly cloudy (night)



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



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



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



    "sunny_night", //31 clear (night)



    "sunny", //32 sunny



    "mist_night", //33 fair (night)



    "mist", //34 fair (day)



    "hail", //35 mixed rain and hail



    "sunny", //36 hot



    "tstorm1", //37 isolated thunderstorms



    "tstorm2", //38 scattered thunderstorms



    "tstorm2", //39 scattered thunderstorms



    "tstorm2", //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



    "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)

    {

    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");

    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);

    }

    </script>









    </head>

    <body bgcolor="Transparent" onload="onLoad()">



    <div id="WeatherContainer"> <div id="TextContainer"> <p id="city">Loading...</p> <p id="temp">...</p> <p id="desc">...</p> </div>

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



    </body></html>
    此篇文章於 02-09-2011 05:54 被 cubian 編輯。


  3. #3

    新生報到

    註冊日期:02-08-2011
    文章:9
    謝謝你: 0
    在 1篇文章中獲得 1個感謝
    謝謝 大大 !! 我剛剛修改成功瞜~~


  4. #4
    hans99 的頭像

    愛用者

    註冊日期:08-12-2009
    文章:31
    謝謝你: 0
    在 0篇文章中獲得 0個感謝
    各位大大 小弟我是用TimelessHD-Chronograph MOD的Theme

    但是我還是失敗 想請 好心的大大可以再解釋詳細依些嗎


 

 

發文規則

  • 不可以發表新主題
  • 不可以發表回覆
  • 不可以上傳附件
  • 不可以編輯自己的文章
  •  
回到此頁頂端