+ Reply
Page 193 of 210 FirstFirst ... 93 143 183191192193194195 203 ... LastLast
Results 3,841 to 3,860 of 4200

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: Widget Weather

is a discussion within the

File Mods

forums, a part of the

iPhone Modding

section;
Originally Posted by nik1975 @Dacal,what exactly delete in the WebKit in main. js !All the above? The red parts.
...
  1. #3841
    Addicted to Code Dacal's Avatar
    Join Date
    Nov 2010
    Posts
    1,928
    Thanks
    3,014
    Thanked 8,723 Times in 1,536 Posts

    Quote Originally Posted by nik1975 View Post
    @Dacal,what exactly delete in the WebKit in main.js!All the above?
    The red parts.


    My themes : Jade HD, Silex HD, BaSalt HD,ToPaz
    All are on Cydia and/or Theme It.

  2. The Following 2 Users Say Thank You to Dacal For This Useful Post:

    King_O_Hill (06-19-2014), nik1975 (06-19-2014)

  3. #3842
    Livin the iPhone Life nik1975's Avatar
    Join Date
    Feb 2008
    Location
    Thessaloniki, Greece
    Posts
    1,331
    Thanks
    2,995
    Thanked 992 Times in 601 Posts

    Default Widget Weather
    Quote Originally Posted by Dacal View Post
    The red parts.
    Thank you!!

  4. #3843
    ----NewD 2.0---- NewdestinyX's Avatar
    Join Date
    Jan 2012
    Posts
    10,053
    Thanks
    4,364
    Thanked 9,145 Times in 4,592 Posts

    Okay - Coding gurus, Dacal,RKO, Marty, King, bombmom, MJ.....

    Is there a simple line of code that allows me to search within multiple objects for a certain string?

    obj.a[1] = "cars";
    obj.a[2] = "boats";
    obj.a[3] = "trucks";
    obj.a[4] = "busses";
    obj.a[5] = "places";

    I need syntax to say <<Look for the string 'busses' from within obj.a[1-5] -- if it's in ANY of those objects -- then do { }

    In know the the long way around -----
    Code:
    if ((obj.a[1].indexOf('busses') > -1) ||
    (obj.a[2].indexOf('busses') > -1) ||
    (obj.a[3].indexOf('busses') > -1) ||
    (obj.a[4].indexOf('busses') > -1) ||
    (obj.a[5].indexOf('busses') > -1))  {  do this    ;}
    Is that the only code available to me?

    I've done a lot of searching on W3 Schools and other code sites.. Not finding what I think should be possible..

    TIA
    Last edited by NewdestinyX; 06-19-2014 at 07:17 PM.
    Here to help if I can. If I can't I know someone who can!

  5. #3844
    Master Theme Creator June'sIphone's Avatar
    Join Date
    Feb 2010
    Location
    DaytonaBeach, FL
    Posts
    6,776
    Thanks
    5,239
    Thanked 10,057 Times in 3,680 Posts

    Quote Originally Posted by NewdestinyX View Post
    Okay - Coding gurus, Dacal,RKO, Marty, King, bombmom, MJ.....

    Is there a simple line of code that allows me to search within multiple objects for a certain string?

    obj.a[1] = "cars";
    obj.a[2] = "boats";
    obj.a[3] = "trucks";
    obj.a[4] = "busses";
    obj.a[5] = "places";

    I need syntax to say <<Look for the string 'busses' from within obj.a[1-5] -- if it's in ANY of those objects -- then do { }

    In know the the long way around -----
    Code:
    if ((obj.a[1].indexOf('busses') > -1) ||
    (obj.a[2].indexOf('busses') > -1) ||
    (obj.a[3].indexOf('busses') > -1) ||
    (obj.a[4].indexOf('busses') > -1) ||
    (obj.a[5].indexOf('busses') > -1))  {  do this    ;}
    Is that the only code available to me?

    I've done a lot of searching on W3 Schools and other code sites.. Not finding what I think should be possible..

    TIA
    Use a for loop to loop over the array within the object.

    Code:
    var a, obj = {a: a = ["cars", "boats", "trucks","busses","places"]}; //your array in the object
    
      for (i = 0; i < obj.a.length; i++) { //how to find the index of busses
        if(obj.a[i]=="busses"){
       	alert(i);
        }
      }
    Whipped up a jsfiddle
    Edit fiddle - JSFiddle


    If you wanted it as a reusable function.

    Code:
    var a, obj = {a: a = ["cars", "boats", "trucks","busses","places"]};
    
    function findname(length,name){
      for (i = 0; i < length; i++) { 
        if(obj.a[i]==name){
       	return i;
        }
      }
    }
    
    var busses=findname(obj.a.length,"busses");
    var cars=findname(obj.a.length,"cars");
    alert(busses);
    alert(cars);
    There are many ways to achieve this, here is just one.
    Last edited by June'sIphone; 06-19-2014 at 07:59 PM.

  6. The Following 2 Users Say Thank You to June'sIphone For This Useful Post:

    lostinthemes (06-20-2014), NewdestinyX (06-19-2014)

  7. #3845
    ----NewD 2.0---- NewdestinyX's Avatar
    Join Date
    Jan 2012
    Posts
    10,053
    Thanks
    4,364
    Thanked 9,145 Times in 4,592 Posts

    Quote Originally Posted by June'sIphone View Post
    Use a for loop to loop over the array within the object.

    Code:
    var a, obj = {a: a = ["cars", "boats", "trucks","busses","places"]}; //your array in the object
    
      for (i = 0; i < obj.a.length; i++) { //how to find the index of busses
        if(obj.a[i]=="busses"){
       	alert(i);
        }
      }
    Whipped up a jsfiddle
    Edit fiddle - JSFiddle


    If you wanted it as a reusable function.

    Code:
    var a, obj = {a: a = ["cars", "boats", "trucks","busses","places"]};
    
    function findname(length,name){
      for (i = 0; i < length; i++) { 
        if(obj.a[i]==name){
       	return i;
        }
      }
    }
    
    var busses=findname(obj.a.length,"busses");
    var cars=findname(obj.a.length,"cars");
    alert(busses);
    alert(cars);
    There are many ways to achieve this, here is just one.
    Thanks, June. Very helpful! Now let's see if I can understand it enough to adapt to my exact variables.

    Is LENGTH part of the equation? I want it to be able to find one specific string of text whether 2 or 18 characters..

    In the precise case I'm working on.. I need find out if the string "Fairbanks North Shore" exists in any of the objects' parsed data from GoogleMaps API..

    Right now - the formatted address fields from Google are returning this:
    obj.add[1] = "Fairbanks";
    obj.add[2] = "Fairbanks";
    obj.add[3] = "Fairbanks";
    obj.add[4] = "Fairbanks";
    obj.add[5] = "Fairbanks North Shore";
    obj.add[6] = "Fairbanks";

    Sometimes Google returns Fairbanks North Shore in obj.add[3] and still other times the coordinates I send to the API returns Fairbanks Northshore in obj.add[6]. It jumps around. I need the equivalent of:

    if ("Fairbanks North Shore" exists in any of the object formatted address output fields [1]-[6]) {obj.county = "Fairbanks North Shore";}

    So..... each 'county' name I'm looking for from within the six obj. fields could be anything from 3-4 characters up to 20 characters. So that's why I need to know if 'length' matters..

    So I'm essentially searching for a certain string of text that could exists in any one of 6 objects. if my text string exists - I want the condition to return TRUE.

    Thanks for taking a look for me.
    Last edited by NewdestinyX; 06-19-2014 at 08:47 PM.
    Here to help if I can. If I can't I know someone who can!

  8. #3846
    Master Theme Creator June'sIphone's Avatar
    Join Date
    Feb 2010
    Location
    DaytonaBeach, FL
    Posts
    6,776
    Thanks
    5,239
    Thanked 10,057 Times in 3,680 Posts

    Quote Originally Posted by NewdestinyX View Post
    Thanks, June. Very helpful! Now let's see if I can understand it enough to adapt to my exact variables.

    Is LENGTH part of the equation? I want it to be able to find one specific string of text whether 2 or 18 characters..

    In the precise case I'm working on.. I need find out if the string "Fairbanks North Shore" exists in any of the objects' parsed data from GoogleMaps API..

    Right now - the formatted address fields from Google are returning this:
    obj.add[1] = "Fairbanks";
    obj.add[2] = "Fairbanks";
    obj.add[3] = "Fairbanks";
    obj.add[4] = "Fairbanks";
    obj.add[5] = "Fairbanks North Shore";
    obj.add[6] = "Fairbanks";

    Sometimes Google returns Fairbanks North Shore in obj.add[3] and still other times the coordinates I send to the API returns Fairbanks Northshore in obj.add[6]. It jumps around. I need the equivalent of:

    if ("Fairbanks North Shore" exists in any of the object formatted address output fields [1]-[6]) {obj.county = "Fairbanks North Shore";}

    So..... each 'county' name I'm looking for from within the six obj. fields could be anything from 3-4 characters up to 20 characters. So that's why I need to know if 'length' matters..

    Thanks for taking a look for me.
    From the looks of it there is only one object. The rest is an array nested within the object. In this case your array is add. (in the code above) So what you are doing with obj.add[1-6] is going through the array.

    Example: add = ["cars", "boats", "trucks","busses","places"]

    here is an array. Now if you go add[0], you will get cars. add[1] boats so on an so forth. Since it is nested in an object its like this.

    Example: var add, obj = {add: add = ["cars", "boats", "trucks","busses","places"]}; Therefore to get to your array you first have to go through the object. So obj.add[0] will give you cars. obj.a[1] boats so on an so forth.

    The use of length, in the function I listed was to get the number of items in that array. This is used for the for loop.

    for (i=0; i< obj.a.length; i++)

    What this for loop does is it takes i then compares it to the length of the array. Say if there is 5 it will loop through each one until it reaches 5. Meaning every time i is less than the length it adds one number to i. Inside the brackets you can add anything really, but this case you are looking for a certain name so you can go if(obj.a[i]=="YourName") then do this {//do something}

    example if you do
    for (i=0; i< obj.add.length; i++){
    alert("test");
    }

    It will alert("test"); as many times until i is equal to the length of the array.

    It loops through each one because i is now really a number, but it is a number that goes through the entire array. It does this because it adds 1 over and over until i is equal to the length of the array. To answer your question .length is needed in this particular function.



    Code:
    <div id="neighborhood"></div>
    
    <script>
    var add, obj = {add: add = ["Fairbanks", "Fairbanks", "Fairbanks North Shore","Fairbanks","Fairbanks"]}; 
    
      for (i = 0; i < obj.add.length; i++) {
        if(obj.add[i]=="Fairbanks North Shores"){
       	document.getElementById("neighborhood").innerHTML=obj.add[i];
        }
      }
    </script>
    With this you will always get Fairbanks North Shores to the div no matter where it is in the array.
    Hope that helps.
    Last edited by June'sIphone; 06-19-2014 at 09:10 PM.

  9. The Following 2 Users Say Thank You to June'sIphone For This Useful Post:

    lostinthemes (06-20-2014), NewdestinyX (06-19-2014)

  10. #3847
    ----NewD 2.0---- NewdestinyX's Avatar
    Join Date
    Jan 2012
    Posts
    10,053
    Thanks
    4,364
    Thanked 9,145 Times in 4,592 Posts

    Quote Originally Posted by June'sIphone View Post
    Code:
    <div id="neighborhood"></div>
    
    <script>
    var add, obj = {add: add = ["Fairbanks", "Fairbanks", "Fairbanks North Star","Fairbanks","Fairbanks"]}; 
    
      for (i = 0; i < obj.add.length; i++) {
        if(obj.add[i]=="Fairbanks North Star"){
       document.getElementById("neighborhood").innerHTML=obj.add[i];
        }
      }
    </script>
    With this you will always get Fairbanks North Star to the div no matter where it is in the array.
    Hope that helps.
    Fabulous, June. For the first time I think I've understood loops and arrays. Thanks for taking the time to help take my coding to the next level. I won't forget it.

    Peace..

    EDITED:
    Here's the final code that accomplished what I needed - based on my tutorial from June about looping. I had several other special case Alaskan Borough names I needed to do different boolean tests for with <else if> after this special case with the "Fairbanks North Star Borough".. So after the loop looked for "Fairbanks North Star", instead of simply reporting obj.add[i] to the <div> I needed to set a variable and then test for that variable if the first <if> -- followed by the other <else if>

    Additionally --> [i] was a variable Dacal had used in a loop he created for me earlier in the code to parse the formatted address data from the Google API in a more efficient way than I had been doing it.. So I chose the variable [s] in this loop June showed me. Early on King_O_Hill taught me you don't duplicate variables that are gonna do different things. So the final result for this section where I'm dealing with the special way Alaska does counties.
    Code:
    var AKdivide = "";
    if (obj.statecode == 'AK') {
      var AKcensusA = ["Yukon-Koyukuk", "Nome", "Aleutians West", "Bethel", "Dillingham",
      "Skagway-Hoonah-Angoon", "Prince of Wales-Outer Ketchikan", "Southeast Fairbanks",
      "Valdez-Cordova", "Wade Hampton"]; //list of Alaskan Census Areas
      if (AKcensusA.indexOf(obj.add[3]) > -1) {var AKdivide = " Census Area";} else {var AKdivide = " Borough";}
      
    //SPECIAL CASE AK BOROUGH NAMING
      for (s = 0; s < obj.add.length; s++) {
         if(obj.add[s] == "Fairbanks North Star") {var FairbanksNS = true;}
      }
      if (FairbanksNS == true) {obj.county = "Fairbanks North Star" + AKdivide;}
      else if (....) {.....}
      else if (......) {.....}
      ........
      else {obj.county = obj.add[3] + AKdivide;}//these are normal cases
    }
    Last edited by NewdestinyX; 06-19-2014 at 11:43 PM.
    Here to help if I can. If I can't I know someone who can!

  11. The Following 2 Users Say Thank You to NewdestinyX For This Useful Post:

    June'sIphone (06-19-2014), lostinthemes (06-20-2014)

  12. #3848
    The BatGirl MamaJaay's Avatar
    Join Date
    Mar 2012
    Location
    @TheMamaJaay
    Posts
    5,198
    Thanks
    4,279
    Thanked 16,790 Times in 4,022 Posts

    Wow. Thank you June. Good stuff here, guys.


    Sent from my iPhone 5S

  13. The Following User Says Thank You to MamaJaay For This Useful Post:

    June'sIphone (06-20-2014)

  14. #3849
    My iPhone is a Part of Me bliken's Avatar
    Join Date
    Apr 2013
    Posts
    756
    Thanks
    712
    Thanked 443 Times in 294 Posts

    Ok i am having a senior moment. I cannot find where I can fix the wind as seen in screen shot. 3mph wind no wind.

    Can someone point out where I am missing it.

    Thanks

    ImageUploadedByModMyi1403296593.103646.jpg

  15. #3850
    King Kong ain't got nothing on me! King_O_Hill's Avatar
    Join Date
    Apr 2011
    Location
    USA
    Posts
    9,483
    Thanks
    41,974
    Thanked 17,876 Times in 6,509 Posts

    It's got to do with the wind direction, not the speed. Look in the main.js for //WINDSPEED the error is in there. I can't remember what the exact fix was, post if you need further help.
    Widget-Weather App Now Available! Also with MyLocation Support!
    Check out the thread here - Widget-Weather
    To install the Widget-Weather app, just go to Cydia and install. This will also remove MyLocation, as it is built in!
    Want to protect your JailBreak! Add this repo http://cydia.myrepospace.com/iLEXiNFO/ & Install "iLEX R.A.T."
    It will allow you to bring your phone back to a fresh jailbroken state!

  16. The Following User Says Thank You to King_O_Hill For This Useful Post:

    bliken (06-20-2014)

  17. #3851
    The Formulator Marty McFly's Avatar
    Join Date
    Mar 2013
    Location
    Barrie
    Posts
    1,347
    Thanks
    4,388
    Thanked 4,770 Times in 1,059 Posts

    Quote Originally Posted by bliken View Post
    Ok i am having a senior moment. I cannot find where I can fix the wind as seen in screen shot. 3mph wind no wind.

    Can someone point out where I am missing it.

    Thanks
    Delete this line in main.js...

    if (direction == 0) var winddir = "No wind";

  18. The Following 4 Users Say Thank You to Marty McFly For This Useful Post:

    bliken (06-20-2014), King_O_Hill (06-20-2014), lostinthemes (06-26-2014), NewdestinyX (06-20-2014)

  19. #3852
    My iPhone is a Part of Me bliken's Avatar
    Join Date
    Apr 2013
    Posts
    756
    Thanks
    712
    Thanked 443 Times in 294 Posts

    Quote Originally Posted by Marty McFly View Post
    Delete this line in main.js...
    Thanks G.....that worked.

    I was missing it when I was looking on my phone....had to wait until I got home and used WINSCP and found it.

    Thanks again.

  20. The Following User Says Thank You to bliken For This Useful Post:

    Marty McFly (06-21-2014)

  21. #3853
    Theme Modder Smitbeat's Avatar
    Join Date
    Feb 2012
    Location
    Engel's
    Posts
    1,602
    Thanks
    3,225
    Thanked 6,917 Times in 1,221 Posts


  22. The Following 7 Users Say Thank You to Smitbeat For This Useful Post:

    Dacal (06-22-2014), Destan (06-23-2014), King_O_Hill (06-22-2014), lostinthemes (06-26-2014), Marty McFly (06-24-2014), Mary48336 (06-22-2014), RKO1195 (06-22-2014)

  23. #3854
    iPhone? More like MyPhone Enmedi00's Avatar
    Join Date
    Feb 2014
    Location
    Ruskin, Florida, United States
    Posts
    209
    Thanks
    50
    Thanked 43 Times in 36 Posts

    ImageUploadedByModMyi1403822728.190391.jpg
    Is this normal? I don't remember seeing this warning when I was JB on 7.06

  24. #3855
    King Kong ain't got nothing on me! King_O_Hill's Avatar
    Join Date
    Apr 2011
    Location
    USA
    Posts
    9,483
    Thanks
    41,974
    Thanked 17,876 Times in 6,509 Posts

    It's normal now with the latest version of cydia installer.
    Widget-Weather App Now Available! Also with MyLocation Support!
    Check out the thread here - Widget-Weather
    To install the Widget-Weather app, just go to Cydia and install. This will also remove MyLocation, as it is built in!
    Want to protect your JailBreak! Add this repo http://cydia.myrepospace.com/iLEXiNFO/ & Install "iLEX R.A.T."
    It will allow you to bring your phone back to a fresh jailbroken state!

  25. The Following 2 Users Say Thank You to King_O_Hill For This Useful Post:

    Marty McFly (06-26-2014), NewdestinyX (06-26-2014)

  26. #3856
    iPhone? More like MyPhone Enmedi00's Avatar
    Join Date
    Feb 2014
    Location
    Ruskin, Florida, United States
    Posts
    209
    Thanks
    50
    Thanked 43 Times in 36 Posts

    Quote Originally Posted by King_O_Hill View Post
    It's normal now with the latest version of cydia installer.
    But the widgets are not working when I set them to read the weather info thru widget weather tweak

  27. #3857
    ----NewD 2.0---- NewdestinyX's Avatar
    Join Date
    Jan 2012
    Posts
    10,053
    Thanks
    4,364
    Thanked 9,145 Times in 4,592 Posts

    Quote Originally Posted by Enmedi00 View Post
    But the widgets are not working when I set them to read the weather info thru widget weather tweak
    Did you set it from Manual to Constant mode? And did you turn on the myLocation switch?
    Here to help if I can. If I can't I know someone who can!

  28. #3858
    iPhone? More like MyPhone Enmedi00's Avatar
    Join Date
    Feb 2014
    Location
    Ruskin, Florida, United States
    Posts
    209
    Thanks
    50
    Thanked 43 Times in 36 Posts

    Quote Originally Posted by NewdestinyX View Post
    Did you set it from Manual to Constant mode? And did you turn on the myLocation switch?
    I did but it's not even showing on the location services section ImageUploadedByModMyi1403828566.065570.jpg

  29. #3859
    My iPhone is a Part of Me oldskoolsk8r's Avatar
    Join Date
    Dec 2010
    Location
    Orem, UT
    Posts
    549
    Thanks
    628
    Thanked 696 Times in 303 Posts

    Mine is not working either


    Sent from my iPhone using Tapatalk

  30. #3860
    ----NewD 2.0---- NewdestinyX's Avatar
    Join Date
    Jan 2012
    Posts
    10,053
    Thanks
    4,364
    Thanked 9,145 Times in 4,592 Posts

    Quote Originally Posted by oldskoolsk8r View Post
    Mine is not working either


    Sent from my iPhone using Tapatalk
    Full Reboot after installing is needed in most cases with WW.
    Here to help if I can. If I can't I know someone who can!

LinkBacks (?)

  1. 08-08-2013, 04:14 PM

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts