iPhone Help me edit this plist

Discussion in 'Jailbreaks and iOS Hacks' started by Maverik3, Jan 3, 2015.

  1. Maverik3 macrumors 6502

    Joined:
    Mar 13, 2012
    Location:
    Meridian Idaho
    #1
    So I want the temperature to update more often for some reason I have had it all day and the temperature has not updated... The little weather icon has but not the degrees. Here is the plist can someone show me where to edit the time before it fetches new data

    <!-- Ported to iWidget by @insanelyi credit to the original author who is unknown -->
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel="stylesheet" href="private/css/style.css" type="text/css" media="screen" />
    <base href="private/"/>
    </head>
    <body>

    <script type="text/javascript">

    function init ( ){

    timeDisplay = document.createTextNode ( "" );

    document.getElementById("clock").appendChild ( timeDisplay );

    }

    function updateClock ( ){

    var currentHours_name_array = new Array ("0", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN", "ELEVEN", "TWELVE", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN", "ELEVEN", "MIDNIGHT")

    var currentMinutes_name_array = new Array ("o'clock", "o'one", "o'two", "o'three", "o'four", "o'five", "o'six", "o'seven", "o'eight", "o'nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twentyONE", "twentyTWO", "twentyTHREE", "twentyFOUR", "twentyFIVE", "twentySIX", "twentySEVEN", "twentyEIGHT","twentyNINE", "thirty", "thirtyONE", "thirtyTWO", "thirtyTHREE", "thirtyFOUR", "thirtyFIVE", "thirtySIX", "thirtySEVEN", "thirtyEIGHT", "thirtyNINE", "forty", "fourtyONE", "fourtyTWO", "fourtyTHREE", "fourtyFOUR", "fourtyFIVE", "fourtySIX", "fourtySEVEN", "fourtyEIGHT", "fourtyNINE", "fifty", "fiftyONE", "fiftyTWO", "fiftyTHREE", "fiftyFOUR", "fiftyFIVE", "fiftySIX", "fiftySEVEN", "fiftyEIGHT", "fiftyNINE", "o'clock")

    var currentTime = new Date ( );

    var currentHours = currentTime.getHours ( );

    var currentMinutes = currentTime.getMinutes ( );

    var currentSeconds = currentTime.getSeconds ( );

    currentHours = ( currentHours < 0 ) ? currentHours + 24 : currentHours;

    currentMinutes = ( currentMinutes < 0 ) ? currentMinutes + 60 : currentMinutes;

    currentSeconds = ( currentSeconds < 0 ) ? currentSeconds + 60 : currentSeconds;

    currentHours = ( currentHours == 0 ) ? currentHours + 24 : currentHours;

    currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;

    currentHours = ( currentHours == 0 ) ? 12 : currentHours;

    var currentTimeString = "[" + currentHours_name_array[currentHours] + "]" + currentMinutes_name_array[currentMinutes];

    document.getElementById("clock").firstChild.nodeValue = currentTimeString;

    }

    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").firstChild.nodeValue = " " + currentTimeString;

    }

    function buildCal(m, y, cM, cH, cDW, cD){

    var this_weekday_name_array = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];

    var this_weekday_name2 = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")

    var mn=['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'];

    var dim=[31,0,31,30,31,30,31,31,30,31,30,31];

    var oD = new Date(y, m-1, 1);

    oD.od=oD.getDay()+1;

    var todaydate=new Date()

    var this_weekday = todaydate.getDay()

    var this_month = todaydate.getMonth()

    var this_date = todaydate.getDate()

    var this_year = todaydate.getYear()

    var startonMonday = false; //Set to "true" if you want the widget to start on Mon.

    if(startonMonday == true) {

    this_weekday_name_array = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];

    if (this_weekday == 0)

    this_weekday = 6;

    else

    this_weekday--;

    }



    if (this_year < 2000){this_year = this_year + 1900;}



    dim[1]=(((oD.getFullYear()%100!=0)&&(oD.getFullYear()%4==0))||(oD.getFullYear()%400==0))?29:28;

    var t = '';

    days_TM=dim[this_month];



    if (this_month==0)

    days_PM=dim[11];

    else

    if (this_date<7)

    days_PM=dim[this_month-1];

    else

    days_PM=dim[this_month];



    if (this_month==11)

    days_NM=dim[0];

    else

    days_NM=dim[this_month+1];



    k=0;



    do{

    k2=this_date-k;

    if(k2<=0)

    wkstart=days_PM+k2;

    else

    wkstart=k2;

    k++;}



    while(k<=this_weekday)



    for (s=0;s<7;s++){

    if (s==this_weekday){

    t+='<span id="today">'+this_weekday_name_array+'</span>';}

    else{

    t+='<span id="daysofweek">'+this_weekday_name_array+'</span>';}

    }



    t+='<span id="daysofweek">· <font size="2">'+mn[this_month]+'</font> ·</span>';



    for (L=0;L<this_weekday;L++){

    L2=L+wkstart;



    if(L2>days_PM) L2=L2-days_PM;

    if(L2==this_date)

    t+='<span id="today">'+L2+'</span>';

    else

    t+='<span id="daysofweek">'+L2+'</span>';}



    for (M=0;M<=6-this_weekday;M++){

    M2=M+this_date;



    if(M2>days_TM) M2=M2-days_TM;

    if (M2==this_date)

    t+='<span id="today">'+M2+'</span>';

    else

    t+='<span id="daysofweek">'+M2+'</span>';}



    t+='<div class="month">'+mn[this_month]+'</div>';

    t+='<div class="year">'+this_year+'</div>';

    return t;

    }



    </script>

    <div id="container">
    <div id="stage">
    <td id="CalendarWidget">

    <div class="CalendarWidget">



    <table style="position: absolute; width: 320px; top:-5px; left:0px;">

    <tr align="center" valign="top" border="0" cellpadding="0">

    <td valign="top">

    <span id="clock">

    <script language="JavaScript">updateClock(); setInterval('updateClock()', 1000 )</script>

    </span>

    </td>

    </tr>

    </table>



    <table style="position: absolute; width:320px; top:0px; left:0px;">

    <tr align="center" valign="top" border="0" cellpadding="0">

    <td valign="top">

    <span id="ampm">

    <script language="JavaScript">amPm(); setInterval('amPm()', 1000 )</script>

    </span>

    </td>

    </tr>

    </table>



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

    <meta http-equiv="refresh" Content="1800">



    <script type="text/javascript">



    var todaydate=new Date();

    var curmonth=todaydate.getMonth()+1;

    var curyear=todaydate.getFullYear();



    document.write(buildCal(curmonth ,curyear, "main", "month", "daysofweek", "days"));



    </script>

    <script language="JavaScript" type="text/javascript">

    var locale = "USID0161"

    var isCelsius = false

    var useRealFeel = false



    var enableWallpaper = true;

    var enableLockScreen = true;



    var stylesheetWall = 'style'

    var stylesheetLock = 'style'

    var stylesheet = 'style'



    var iconSetWall = 'fif7y'

    var iconExtWall = ".png"

    var iconSetLock = 'fif7y'

    var iconExtLock = '.png'



    var source = 'yahooWeather'

    var updateInterval = 25



    var postal;

    var demoMode = false;

    var enabled;



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

    stylesheet = stylesheetLock;

    iconSet = iconSetLock;

    iconExt = iconExtLock;

    enabled = enableLockScreen;

    }else{

    stylesheet = stylesheetWall;

    iconSet = iconSetWall;

    iconExt = iconExtWall;

    enabled = enableWallpaper;

    }

    if(enabled == true){

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

    var iconSet = stylesheet;

    }

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

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

    }



    function onLoad(){

    if (enabled == true){

    if (demoMode == true){

    document.getElementById("weatherIcon").src="icons/"+iconSet+"/"+"26"+iconExt;

    document.getElementById("city").innerText="Chicago, IL";

    document.getElementById("desc").innerText="Partly Cloudy";

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

    }else{

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

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

    if(useRealFeel == true){

    tempValue = convertTemp(obj.realFeel);

    }else{

    tempValue = convertTemp(obj.temp)

    }

    if (isCelsius == true){

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

    }else{

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

    }

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

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

    }else{

    document.getElementById("WeatherContainer").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&p=" //u=Farenheit



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

    callback (obj);

    }

    </script>

    <body onload="onLoad()">
    <div id="WeatherContainer">

    <div id="TextContainer">

    <p id="city">-City</p>

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

    <p id="desc">-Desc</p>

    </div>

    <img id="weatherIcon" src=""/>
    </div>
    </div>
    </div>
    </body>
    </html>
    <!-- Ported to iWidget by @insanelyi credit to the original author who is unknown -->
     
  2. IrishVixen macrumors 68020

    IrishVixen

    Joined:
    Jun 20, 2010
    #2
    I think it's this line:

    var updateInterval = 25

    ... where the number represents the number of minutes before refresh. Note that too frequent refreshing can eat your battery though.

    (It's been a year since I've edited one of these though. I used to set most of mine to 15 minutes.)
     
  3. nwmtnbiker macrumors 68000

    nwmtnbiker

    Joined:
    Apr 5, 2011
    Location:
    Fidalgo Island
    #3
    Agree with IrishVixen. Right under that is var postal; you put your zip code there or do you not do that anymore? I havent played with a weather plist since iOS 5/6...

    **nvm I see your varlocale USID0161 above that are you in Idaho?
     
  4. Maverik3 thread starter macrumors 6502

    Joined:
    Mar 13, 2012
    Location:
    Meridian Idaho
    #4
    Ya I live in idaho and i wasn't sure if that was what the 25 was, I have edited some before and messed them up so I just wanted to double check and I guess the weather just didn't change at all today. It was a solid 23 all day

    I appreciate the help
     
  5. nwmtnbiker macrumors 68000

    nwmtnbiker

    Joined:
    Apr 5, 2011
    Location:
    Fidalgo Island
    #5
    Looks like it's a yahoo weather if I remember. I messed with plists so much back in the day moving everything around I always made a copy of the original. 99.9% positive I'd mess it all up lol...
     

Share This Page