Page 589 of 613 FirstFirst ... 89489539579587588589590591599 ... LastLast
Results 11,761 to 11,780 of 12259

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


Thread: UniAW7

  1. #11761
    Default UniAW7
    Look great Jacques!
    I prefer to put variables instead of strings and have the number of the day together with the name of the day... But is a personal preference. So I modified your lines as you can see below and it seems it's working...
    Thank you!!!!



    Last edited by morkino; 2017-02-28 at 02:12 PM.

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

    #m37h{ (2017-02-28), jm26200 (2017-03-01), kristatos (2017-02-28), Marty McFly (2017-02-28), Mary48336 (2017-03-04), mike42 (2017-02-28)

  3. #11762
    Default UniAW7
    This should also work...
    I tried this with the date of yesterday and it shows correctly the passage between two months.
    Will see tomorrow what happens...
    The case for leap years is missing but until 2020 we are safe

    Last edited by morkino; 2017-02-28 at 06:07 PM.

  4. The Following 6 Users Say Thank You to morkino For This Useful Post:

    jm26200 (2017-03-01), kristatos (2017-02-28), Marty McFly (2017-02-28), Mary48336 (2017-03-04), mike42 (2017-02-28), thomasis (2017-02-28)

  5. #11763
    Quote Originally Posted by morkino View Post
    This should also work...
    I tried this with the date of yesterday and it shows correctly the passage between two months.
    Will see tomorrow what happens...
    The case for leap years is missing but until 2020 we are safe

    This one amazing job!🏻🏻

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

    morkino (2017-02-28), niels.altaner (2017-02-28)

  7. #11764
    Code Dependent NewD's Avatar
    Join Date
    Jan 2012
    Location
    Northeast US
    Posts
    5,708
    Thanks
    8,333
    Thanked 16,463 Times in 7,695 Posts

    Default UniAW7
    EXCELLENT CODING JOB, morkino & Jacques!!!
    With your permission I will include this as an option in the UniAW7.1_WW3 base going forward for all mods.

  8. The Following 3 Users Say Thank You to NewD For This Useful Post:

    jm26200 (2017-03-01), Mary48336 (2017-03-04), oswaldo-1985 (2017-03-01)

  9. #11765
    Just one error syntaxe Marco for Day in forecast....

    cas : 1, 3, 5, 7: <---- no work
    must change and all ok
    must put this for swithch


    -img_2879.png

    switch(currentTime.getMonth()+1) {
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
    $("#DayNum" + i).html(currentTime.getDate()+i);
    break;
    case 2:
    if(currentTime.getFullYear() % 4 ==0 && currentTime.getFullYear() % 100 != 0){
    $("#DayNum" + i).html(currentTime.getDate()+i -29);
    }else if(currentTime.getFullYear() % 400 == 0){
    $("#DayNum" + i).html(currentTime.getDate()+i -29);
    }else {
    $("#DayNum" + i).html(currentTime.getDate()+i -28);
    }
    break;
    case 4:
    case 6:
    case 9:
    case 11:
    $("#DayNum" + i).html(currentTime.getDate()+i);
    break;
    }


    or use string ...


    var DayNum = currentTime.getDate();
    switch(currentTime.getMonth()+1) {
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
    DayNum = currentTime.getDate()+i;
    break;
    case 2:
    if(currentTime.getFullYear() % 4 ==0 && currentTime.getFullYear() % 100 != 0){
    DayNum = (currentTime.getDate()+i -29);
    }else if(currentTime.getFullYear() % 400 == 0){
    DayNum = (currentTime.getDate()+i -29);
    }else {
    DayNum = (currentTime.getDate()+i -28);
    }
    break;
    case 4:
    case 6:
    case 9:
    case 11:
    DayNum = currentTime.getDate()+i;
    break;
    }
    $("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,3) + " " + DayNum);
    Last edited by jm26200; 2017-03-01 at 06:34 AM.
    Iphone 7 IOS 10.1.1

  10. The Following 3 Users Say Thank You to jm26200 For This Useful Post:

    Marty McFly (2017-03-01), NewD (2017-03-01), schalker44 (2017-03-01)

  11. #11766
    Quote Originally Posted by NewD View Post
    EXCELLENT CODING JOB, morkino & Jacques!!!
    With your permission I will include this as an option in the UniAW7.1_WW3 base going forward for all mods.
    Sure you can use this code its a pleasure
    sir NewD you have make more for UniaW and in more thread and help all every days
    Best regards
    Iphone 7 IOS 10.1.1

  12. The Following User Says Thank You to jm26200 For This Useful Post:

    Mary48336 (2017-03-04)

  13. #11767
    Yes dear Jacques, thank you!
    I saw it this morning when the month changed.
    So I changed also into my version.
    I think that is important the "game" with the 3 variables DayNum, Today, Tomorrow otherwise at the end of the month we get 31, 32, 33, 34, 35 instead of 31, 1, 2, 3, 4....
    So I coded like this:
    // DAY FORECAST

    var DayNum = currentTime.getDate();
    var Tomorrow = 0;
    var Today = currentTime.getDate();

    for (var i=1; i < 6; i++) {

    $("#Day" + i).removeClass();

    // ADDING NUMBER OF THE DAY


    switch(currentTime.getMonth()+1) {
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
    if(Today > 30) { DayNum = 0; }
    else if (Tomorrow > 30) { DayNum = 1-i; }
    Tomorrow = DayNum+i;
    break;

    case 2:
    if(Today > 27) { DayNum = 0; }
    else if (Tomorrow > 27) { DayNum = 1-i; }
    Tomorrow = DayNum+i;
    break;

    case 4:
    case 6:
    case 9:
    case 11:
    if(Today > 29) { DayNum = 0; }
    else if (Tomorrow > 29) { DayNum = 1-i; }
    Tomorrow = DayNum+i;
    break;
    }

    $("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,3) + " " + Tomorrow );


    Again is missed the part of the leap years.
    I tried to add it but I'm receiving a syntax error that I have not yet solved.
    Maybe you or NewD will find where is the bug...
    See:

    case 2:
    if(currentTime.getFullYear() % 4 ==0 && currentTime.getFullYear() % 100 != 0) && (Today > 28) { DayNum = 0; }
    else if(currentTime.getFullYear() % 4 ==0 && currentTime.getFullYear() % 100 != 0) && (Tomorrow > 28) { DayNum = 0; }
    else if(currentTime.getFullYear() % 400 == 0) && (Today > 28) { DayNum = 0; }
    else if(currentTime.getFullYear() % 400 == 0) && (Tomorrow > 28) { DayNum = 0; }
    else if(Today > 27) { DayNum = 0; }
    else if (Tomorrow > 27) { DayNum = 1-i; }
    Tomorrow = DayNum+i;
    break;


    @NewD
    I will be happy if you add it. I agree with Jacques, you are doing so much for Uniaw and for the jailbreak community! THANK YOU!
    Last edited by morkino; 2017-03-01 at 10:18 AM.

  14. The Following 3 Users Say Thank You to morkino For This Useful Post:

    jm26200 (2017-03-01), Mary48336 (2017-03-04), schalker44 (2017-03-01)

  15. #11768
    Quote Originally Posted by morkino View Post
    Yes dear Jacques, thank you!
    I saw it this morning when the month changed.
    So I changed also into my version.
    I think that is important the "game" with the 3 variables DayNum, Today, Tomorrow otherwise at the end of the month we get 31, 32, 33, 34, 35 instead of 31, 1, 2, 3, 4....
    So I coded like this:

    I will be happy if you add it. I agree with Jacques, you are doing so much for Uniaw and for the jailbreak community! THANK YOU!
    Thank U very much sir Morkino great code

    And great thanks sir NewD for great work uniaw.ww3 and always here for help
    here on i7 with ios 10.1.1
    -img_0018.png
    Last edited by jm26200; 2017-03-01 at 10:54 AM.
    Iphone 7 IOS 10.1.1

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

    Mary48336 (2017-03-04)

  17. #11769
    Default UniAW7
    Quote Originally Posted by NewD View Post
    EXCELLENT CODING JOB, morkino & Jacques!!!
    With your permission I will include this as an option in the UniAW7.1_WW3 base going forward for all mods.
    Finally I made it work and I think that this can be the final version.
    It is also working with leap years: I put the clock back on the 28th February of last year (a leap one) and it shows correctly the 29th, then I set on the 27h February of this year and the it goes correctly from 28 to 1.
    Thank you Jacques!




    So this is the code:

    // DAY FORECAST

    var DayNum = currentTime.getDate();
    var Tomorrow = 0;
    var Today = currentTime.getDate();

    // Calculating if the year is a leap year
    var Leap = 27;
    if (currentTime.getFullYear() % 4 == 0 && currentTime.getFullYear() % 100 != 0) { Leap = 28; }
    else if (currentTime.getFullYear() % 400 == 0) { Leap = 28; }


    for (var i=1; i < 6; i++) {

    $("#Day" + i).removeClass();

    // ADDING NUMBER OF THE DAY


    switch(currentTime.getMonth()+1) {
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
    if(Today > 30) { DayNum = 0; }
    else if (Tomorrow > 30) { DayNum = 1-i; }
    Tomorrow = DayNum+i;
    break;

    case 2:
    if (Today > Leap) { DayNum = 0; }
    else if (Tomorrow > Leap) { DayNum = 1-i; }
    Tomorrow = DayNum+i;
    break;

    case 4:
    case 6:
    case 9:
    case 11:
    if(Today > 29) { DayNum = 0; }
    else if (Tomorrow > 29) { DayNum = 1-i; }
    Tomorrow = DayNum+i;
    break;
    }

    $("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,3) + " " + Tomorrow );
    Last edited by morkino; 2017-03-01 at 01:45 PM.

  18. The Following 3 Users Say Thank You to morkino For This Useful Post:

    Glawrence33 (2017-03-01), King_O_Hill (2017-03-01), kristatos (2017-03-01)

  19. #11770
    Quote Originally Posted by morkino View Post
    Finally I made it work and I think that this can be the final version.
    It is also working with leap years: I put the clock back on the 28th February of last year (a leap one) and it shows correctly the 29th, then I set on the 27h February of this year and the it goes correctly from 28 to 1.
    Thank you Jacques!




    So this is the code:

    // DAY FORECAST

    var DayNum = currentTime.getDate();
    var Tomorrow = 0;
    var Today = currentTime.getDate();

    // Calculating if the year is a leap year
    var Leap = 27;
    if (currentTime.getFullYear() % 4 == 0 && currentTime.getFullYear() % 100 != 0) { Leap = 28; }
    else if (currentTime.getFullYear() % 400 == 0) { Leap = 28; }


    for (var i=1; i < 6; i++) {

    $("#Day" + i).removeClass();

    // ADDING NUMBER OF THE DAY


    switch(currentTime.getMonth()+1) {
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
    if(Today > 30) { DayNum = 0; }
    else if (Tomorrow > 30) { DayNum = 1-i; }
    Tomorrow = DayNum+i;
    break;

    case 2:
    if (Today > Leap) { DayNum = 0; }
    else if (Tomorrow > Leap) { DayNum = 1-i; }
    Tomorrow = DayNum+i;
    break;

    case 4:
    case 6:
    case 9:
    case 11:
    if(Today > 29) { DayNum = 0; }
    else if (Tomorrow > 29) { DayNum = 1-i; }
    Tomorrow = DayNum+i;
    break;
    }

    $("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,3) + " " + Tomorrow );
    Really great work guys!!

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

    littlelisa63 (2017-03-01), morkino (2017-03-01)

  21. #11771
    Code Dependent NewD's Avatar
    Join Date
    Jan 2012
    Location
    Northeast US
    Posts
    5,708
    Thanks
    8,333
    Thanked 16,463 Times in 7,695 Posts

    Default UniAW7
    Morkino and Jacques,

    I LOVE the final version!! Dacal and Ian would be proud! They always attempted to make the "cleanest" code possible, so using the "switch" (case:, etc) was definitely the right choice! And in the end using variables in place of longer expressions repeatedly is the better choice too.. no need to have currentTime,getDate() appear a bunch of times.

    I've never seen the expression % 4 and % 100 before.. Are they multiplicands? Multipliers?

    Anyway - I will update the U7_WW3 base with this today and reupload to same link in my signature.

    I will also add a variable in config.js to add this feature.

    var Use_Weekday_with_Date = true;

    And then we'll need to make one more code entry:

    if (Use_Weekday_with_Date == true) { ........... }

    And we can't get rid of the "German language exception" either. Their language only uses two characters to abbreviate weekday.

    Good work, guys!!

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

    jm26200 (2017-03-02), Mary48336 (2017-03-04)

  23. #11772
    Quote Originally Posted by NewD View Post
    Morkino and Jacques,

    I LOVE the final version!! Dacal and Ian would be proud! They always attempted to make the "cleanest" code possible, so using the "switch" (case:, etc) was definitely the right choice! And in the end using variables in place of longer expressions repeatedly is the better choice too.. no need to have currentTime,getDate() appear a bunch of times.

    I've never seen the expression % 4 and % 100 before.. Are they multiplicands? Multipliers?

    Anyway - I will update the U7_WW3 base with this today and reupload to same link in my signature.

    I will also add a variable in config.js to add this feature.

    var Use_Weekday_with_Date = true;

    And then we'll need to make one more code entry:

    if (Use_Weekday_with_Date == true) { ........... }

    And we can't get rid of the "German language exception" either. Their language only uses two characters to abbreviate weekday.

    Good work, guys!!
    Great and thank you NewD. Very happy about that!

    The % is the modulus. It gives the rest of the division between two variables or operators.
    I.e. 26 % 3 = 2 because 3 fits 8 times in 26 with the rest of 2 (3*8=24 rest 2).
    Jacques made awesome work for catching the leap years, years that have specific mathematical characteristics.

    See, for instance 2016 divided by four is 504 with rest (modulus) 0. But divided by 100 has rest 16 so not equal to 0. Means is a Leap Year.
    But there are exceptions. I.e. 2000 has no rest in both cases, still is a leap year, that's why there is the additional function: divided by 400 gives no rest or modulus = 0.
    Not leap years don't follow those rules.
    Isn't it great?

  24. The Following User Says Thank You to morkino For This Useful Post:

    jm26200 (2017-03-02)

  25. #11773
    Code Dependent NewD's Avatar
    Join Date
    Jan 2012
    Location
    Northeast US
    Posts
    5,708
    Thanks
    8,333
    Thanked 16,463 Times in 7,695 Posts

    Here is the final code added... Thanks to Morkino and Jacques!

    In Config.js in ModdersOptions - added this:
    Code:
    var Use_Date_with_Weekday = true; // true to use date number after weekday 5-day forecast
    And in DayForecast section of main.js:
    Code:
    // DAY FORECAST
    var DayNum = currentTime.getDate();
    var Tomorrow = 0;
    var Today = currentTime.getDate();
    
    // Calculating if the year is a leap year
    var Leap = 27;
    if (currentTime.getFullYear() % 4 == 0 && currentTime.getFullYear() % 100 != 0) { Leap = 28; }
    else if (currentTime.getFullYear() % 400 == 0) { Leap = 28; }
    
    for (var i=1; i < 6; i++) {
    	$("#Day" + i).removeClass();
    
    	if (Use_Date_with_Weekday == true) {
    	// adding the number of the day		
    		switch(currentTime.getMonth()+1) {
    			case 1:
    			case 3:
    			case 5:
    			case 7:
    			case 8:
    			case 10:
    			case 12:
    				if (Today > 30) { DayNum = 0; }
    				else if (Tomorrow > 30) { DayNum = 1-i; }
    				Tomorrow = DayNum+i;
    			break;
    			case 2:
    				if (Today > Leap) { DayNum = 0; }
    				else if (Tomorrow > Leap) { DayNum = 1-i; }
    				Tomorrow = DayNum + i;
    			break;
    			case 4:
    			case 6:
    			case 9:
    			case 11:
    				if(Today > 29) { DayNum = 0; }
    				else if (Tomorrow > 29) { DayNum = 1-i; }
    				Tomorrow = DayNum+i;
    			break;
    		}
    		if (lang == "ge") {
    			$("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,2) + " " + Tomorrow);
    		} else {
    			$("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,3) + " " + Tomorrow);
    		}
    	} else {
    		if (lang == "ge") {
    			$("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,2));
    		} else {
    			$("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,3));
    		}
    	}
    	$("#Day" + i + "Pop").html(obj.pop[i] + "%");
    	$("#Day" + i + "Icon").attr("src", dualP + "Icon Sets/" + iconSetForForecast+"/" + AdjustIcon(obj.code[i], "day") + ".png");
    	if (Hi_Lo_Reversed == false) {
    		$("#Day" + i + "HiLo").html('<span style= color:' + tempColor(obj.low[i]) + ';>' + obj.low[i]  +  tempUnit_Forecast + " / " + '<span style= color:' + tempColor(obj.high[i]) + ';>' + obj.high[i] + tempUnit_Forecast) + '</span>';
    	} else {
    		$("#Day" + i + "HiLo").html('<span style= color:' + tempColor(obj.high[i]) + ';>' + obj.high[i] +  tempUnit_Forecast + " / " + '<span style= color:' + tempColor(obj.low[i]) + ';>' + obj.low[i] + tempUnit_Forecast) + '</span>';		
    	}
    }

  26. The Following User Says Thank You to NewD For This Useful Post:

    jm26200 (2017-03-02)

  27. #11774
    Where i Can find this Ls Widget ?
    Thx




    Gesendet von iPhone mit Tapatalk

  28. #11775
    Code Dependent NewD's Avatar
    Join Date
    Jan 2012
    Location
    Northeast US
    Posts
    5,708
    Thanks
    8,333
    Thanked 16,463 Times in 7,695 Posts

    There's only '1' remaining problem with the new Day + Date code there ^ ^......

    When you're testing a widget on computer... it won't pull the date from the widgetweather.xml file you're using to test.. It will pull and only working with the 'currentDate' you're actually working on the widget.. in 'real time'.. I had this issue with another aspect of my own NewD_Mod of the U7_WW3.. (coming soon.. I promise.. LOL)..

    So let me look into that small issue..
    OF course the code above will work on the iDevice perfectly... but it will just be off in 'testing mode' on computer. Ian and Dacal always tried to assure that testing mode still worked accurately to whatever xml file was in the test_files folder..

    No big issue..

  29. #11776
    Code Dependent NewD's Avatar
    Join Date
    Jan 2012
    Location
    Northeast US
    Posts
    5,708
    Thanks
    8,333
    Thanked 16,463 Times in 7,695 Posts

    Morkino & Jacques,
    If you wanted to add the 'suffix' (translated for each language U7 supports) to the Date numbers you could add this too..

    $("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,3) + " " + Suffix(Tomorrow));

    Will then look like:
    Mon 1st
    Tue 2nd
    Wed 3rd, etc....

  30. The Following User Says Thank You to NewD For This Useful Post:

    jm26200 (2017-03-02)

  31. #11777
    Code Dependent NewD's Avatar
    Join Date
    Jan 2012
    Location
    Northeast US
    Posts
    5,708
    Thanks
    8,333
    Thanked 16,463 Times in 7,695 Posts

    So.. I added another config.js variable
    Code:
    var Forecast_Date_Suffix = true; // true to use number suffix ('st', 'nd', etc) with date number in 5-day forecast
    And changed the code one last time to...

    Code:
    if (lang == "ge") {
    	$("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,2) + " " + ( Forecast_Date_Suffix == true ? Suffix(Tomorrow) : Tomorrow ));
    } else {
    	$("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,3) + " " + ( Forecast_Date_Suffix == true ? Suffix(Tomorrow) : Tomorrow ));
    }

  32. The Following User Says Thank You to NewD For This Useful Post:

    jm26200 (2017-03-02)

  33. #11778
    Code Dependent NewD's Avatar
    Join Date
    Jan 2012
    Location
    Northeast US
    Posts
    5,708
    Thanks
    8,333
    Thanked 16,463 Times in 7,695 Posts

    Quote Originally Posted by morkino View Post
    Great and thank you NewD. Very happy about that!

    The % is the modulus. It gives the rest of the division between two variables or operators.
    I.e. 26 % 3 = 2 because 3 fits 8 times in 26 with the rest of 2 (3*8=24 rest 2).
    Jacques made awesome work for catching the leap years, years that have specific mathematical characteristics.

    See, for instance 2016 divided by four is 504 with rest (modulus) 0. But divided by 100 has rest 16 so not equal to 0. Means is a Leap Year.
    But there are exceptions. I.e. 2000 has no rest in both cases, still is a leap year, that's why there is the additional function: divided by 400 gives no rest or modulus = 0.
    Not leap years don't follow those rules.
    Isn't it great?
    Ah yes!! I understand now.. In English we say "remainder" (of a division 'modulus' {Eng. 'problem'}) not "rest".. The 'rest' of your English math terms were PERFECT, Morkino!

  34. The Following User Says Thank You to NewD For This Useful Post:

    morkino (2017-03-01)

  35. #11779
    Quote Originally Posted by NewD View Post
    So.. I added another config.js variable
    Code:
    var Forecast_Date_Suffix = true; // true to use number suffix ('st', 'nd', etc) with date number in 5-day forecast
    And changed the code one last time to...

    Code:
    if (lang == "ge") {
    $("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,2) + " " + ( Forecast_Date_Suffix == true ? Suffix(Tomorrow) : Tomorrow ));
    } else {
    $("#Day" + i).html(days[obj.dayofweek[i]-1].substring(0,3) + " " + ( Forecast_Date_Suffix == true ? Suffix(Tomorrow) : Tomorrow ));
    }
    Fantastic NewD!
    So now we have two functions that can be switched on an off.
    Great team work! Very happy!
    Oh yes "reminder" you are right... My math and computing education was all in Italian ...

  36. #11780
    Code Dependent NewD's Avatar
    Join Date
    Jan 2012
    Location
    Northeast US
    Posts
    5,708
    Thanks
    8,333
    Thanked 16,463 Times in 7,695 Posts

    Quote Originally Posted by morkino View Post
    Fantastic NewD!
    So now we have two functions that can be switched on an off.
    Great team work! Very happy!
    Oh yes "reminder" you are right... My math and computing education was all in Italian ...
    "RemAinder".. .. All good, bro!!

  37. The Following User Says Thank You to NewD For This Useful Post:

    morkino (2017-03-01)

Page 589 of 613 FirstFirst ... 89489539579587588589590591599 ... LastLast
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •