Page 1 of 3 123 LastLast
Results 1 to 20 of 52

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


Thread: Request JavaScript Help for Live MoonPhase addition to Vista Bliss

  1. #1
    Default Live MoonPhase addition to Vista Bliss
    090816 - Still trying to parse in Accuweathers Sunrise and Sunset times.


    The above pictures show how the Moon Phase is updated on the screen.



    The above pics illustrate an issue with the appleAccuweatherStolen.js script located in the Zip files below.

    The code that changes the Sun and Moon image is:
    Code:
    (hours >= 6 && hours <= 19)
    (Mine is actually set for 7 and 19).

    Ideally the above line of code would be scrapped and instead parse in the current days sunrise and sunset data from Accuweather to determine which image to post.


    Big Thanks to Doreen and all her efforts with her wonderful themes. View this thread to download her theme package.

    Credit's to Spamdumpster, Gary Scott, Zetetic Apparatchik and iBlade.
    Attached Files Attached Files
    Last edited by radarlove63; 08-16-2009 at 07:57 PM. Reason: Clarification

  2. #2
    iPhone? More like MyPhone
    Join Date
    Jan 2009
    Location
    SoCal
    Posts
    208
    Thanks
    76
    Thanked 27 Times in 22 Posts

    Default Thank you!!
    Thank you for starting this thread. I hope someone has the skills to figure this out also. Ive been waiting for a live moon phase since the theme came out. Thanks and good luck to who ever tries

  3. #3
    Quote Originally Posted by iliveforbball View Post
    Thank you for starting this thread. I hope someone has the skills to figure this out also. Ive been waiting for a live moon phase since the theme came out. Thanks and good luck to who ever tries
    iliveforbball
    I am working with the moon phase theme that is based upon the work of Spamdumpster that iBlade modded and posted at http://www.modmyi.com/forums/new-ski...idebar-50.html and trying to merge it with Doreens vistablissweather theme. I am not having much success.

    Best I have been able to do is to get both on the screen at the same time, unfortunately when I get to that point it the moonphase pushes Doreens theme down the screen instead being rendered directly on top.
    I am learning on the fly and doing most of it by hand coding (cut and paste). Doreen has suggested a couple of people that might help out. I will tackle it as much as I can through the weekend. After that I may directly ask for help unless something develops on this thread.
    Thanks for your interest.
    Last edited by radarlove63; 02-20-2009 at 09:54 AM.

  4. #4
    All -- I created an Almanac widget a few weeks ago with changing moonphase images that easily could be modded to use for this project (EDIT: iBlade's theme referenced above is actually based on my code). It's a widget -- not a MS extension, so it would have to be integrated into Doreen's widget that handles the homescreen background, as radarlove63 suggested. The only thing is that I think it would require the use of the accuweather feed, because yahoo's weather feed does not provide moonphase information.

    Here's the link to the thread at macthemes where I released the widget. Link . Check it out.

    As I said, it very easily could be modded to remove all of the other information and only display the moon image.

    The moon images are small in my widget, but they're beautiful renders that would look great in any size on the iPhone. The images are from the os x app Moondock by Gary C. Matin, used with his permission. He also has a separate set of moon images for viewing from the southern hemisphere. I would be glad to contact him for permission to sue in connection with this project.

    Let me know what you think.
    Last edited by Spamdumpster; 02-20-2009 at 06:22 AM.

  5. The Following User Says Thank You to Spamdumpster For This Useful Post:

    radarlove63 (02-20-2009)

  6. #5
    Spamdumpster,
    I have attached the modified code of what appears to be your work for the almanac. I have since changed it to a widget and adjusted some paramaters. I am using the base file that iBlade posted.

    I emailed Doreen last night for her moonphase icons and a few new background icons that will not include the moon.

    I am still working on the kill display during certain hours.
    I am using the below code from another website as my reference and will be working to change it to work inside the attachment. Unless someone beats me which would be fine cause I am just cut and pasting and reloading all the time.


    Code:
    <script type="text/javascript">
    onload=function(){
    var rightNow = new Date();
    var day = rightNow.getUTCDay();
    var hour = rightNow.getUTCHours();
    var minute = rightNow.getUTCMinutes();
    var newDisplay = 'none'; // unless we see otherwise
    if(day == 3  ||  day==5) {  // if we're on the air these days
        if((hour==3 && minute >= 30)  ||  (hour==4 && minute <= 30))
                newDisplay = 'block';
        }
    document.getElementById('LivePlayerDiv').style.display = newDisplay;
    }
    </script>
    Last edited by radarlove63; 02-25-2009 at 02:57 PM. Reason: Goal Met.. Deleted file attachment

  7. #6
    Default Need to set some time parameters
    [IMG][/IMG]

    This is what it looks like so far.
    As I said I am trying to have the widget only post the image during the evening hours. Been cutting and pasting and trying different code but I am not having any success.

    There will be other issues to resolve later as in the moon being forward of any weather background that may displayed.

    And it looks like I lose the text of my location and weather conditions. I will be working on that also.

    As I am posting this I did a respring and lost the moon widget.

    Lots more work ahead.


    A respring didn't work ended up rebooting and resending the vista html and moon phase widget html. Not sure what happened but I will keep an eye out to see if it occurs again.

    So still looking to figure out the code on hiding the image. No success yet. Also I will look at the refresh code. Want to make sure this shows up and goes away when it's supposed to.
    Last edited by radarlove63; 02-20-2009 at 04:27 PM. Reason: Automerged Doublepost

  8. #7
    radarlove (love that song by thw way, hadn't listend to it in years)

    I've had a chance to look at Doreen's code. The problem I see right off the bat is that Doreen's widget uses the yahoo feed and mine uses the accuweather feed. I know Doreen prefers the yahoo feed (and I'm sure that she's right that it's better), but yahoo doesn't provide moonphase information -- only accuweather does. So either someone needs to port Doreen's widget over the accuweather feed or someone needs to create a parser that pulls data from both yahoo and accuweather. I'm not sure how that would work.

    The simplest thing to do (for my meager skills) would be to rewrite Doreen's widget to use the accuweather source. In this case, (1) The accuweather source would retrieve both weather and moonphase information, (2) the wallpaper.js script would define the weather image and the moonphase image, with the moonphase perhaps defined to be a transparent icon during daylight hours. The good news here is that the accuweather feed also provides the sunset and sunrise time, so conceivably you could define the moon image as a blank icon between sunrise and sunset and as the moon icon otherwise. I'm not sure how to code this, but I'm positive that it could be done. (As an aside, the accuweather widget also provides moonrise and moonset times. In real life, the moon is sometimes up during the day and sometimes not up during the night -- perhaps this should be taken into account. In fact, the accuweather feed provides enough data that someone could code the moonimage to move across the screen as the moon moves across the sky. That would be unbelievable.)


    Another option that would be easier to Code would be to create a giant set of night-weather icons that included moonphase images for the different phases. In this case, the wallpaper.js script could define the image object by reference to both the weather and the moon image. However, accuweather has 44 weather codes (assume 22 night weather codes) and 27 moondays, so you'd need about 600 different images. Not such a good idea.

    A third idea would be to see if you can run both widgets side by side on the springboard. There's a widget/them called L-Conf that allows you to run multiple widgets on the lockscreen. I'm sure that it could be modded to allow multiple widgets to run on the springboard. However, I suspect that running multiple widgets would consume too much resources.

    I hope this helps. I will do more thinking about this later tonight after I put my kids to bed.

  9. #8
    Hi Spamdumpster,
    I have been able to run these both at the same time as seperate themes/widgets, though that might have caused the crash I experienced earlier today. (yahoo v accuweather?) (not everyone blames Clippy LOL).
    I thought about the transparent icon for the daytime hours but had no idea that accuweather was providing more information on the moon phase and its visibility during the day.

    I, personally only want it to show during the evening in conjuction with the screens that depict the night time hours on Doreens theme. This is where I have been trying to learn some javascript.

    My thinking was when I asked Doreen last night for some additional images is that I would sacrifice the weather depictions at night for a static/animated gif starry night background.

    I think that your idea to pull the hourly data and then use transparents for the daytime hour moonicons is sounding like the best way to go. Unfortunately I am clueless on how to make that happen.

    I really apreciate that you have been looking at this. I have been beating myself up the last few days trying to get to this point.

    Looks like I have some new study assignments for this weekends homework.

    Very much appreciate your time in looking at this.

  10. #9
    I have created a version of Doreen's theme that also will display the moonphase. However, Dorren's gifs are numbered according to the yahoo numbering scheme, and my version uses accuweather (as I've said, because yahoo doesn't provide moondata). If someone would rename Doreen's gifs in accordance with the accuweather scheme (sunny, cloudy2, cloudy3, etc.), I will continue to work on this.

  11. #10
    Default Accuweather Background naming
    Quote Originally Posted by Spamdumpster View Post
    I have created a version of Doreen's theme that also will display the moonphase. However, Dorren's gifs are numbered according to the yahoo numbering scheme, and my version uses accuweather (as I've said, because yahoo doesn't provide moondata). If someone would rename Doreen's gifs in accordance with the accuweather scheme (sunny, cloudy2, cloudy3, etc.), I will continue to work on this.
    Spamdumpster
    Here is the link to the files.
    There were some names I couldn't find. Those I left in the yahoo weather format.
    http://www.fileden.com/files/2007/4/...ccuweather.zip

  12. #11





    Radarlove, I;ve taken Doreen's weather widget (based on her gifs that you renamed) and superimposed the current moonphase (from the accuweather date) in the upper right corner of the screen. In this widget, the moonphase will show 24 hours a day.

    As you pointed out, there are a bunch of images that weren't converted over to the accuweather file format, I suspect that if the weathericon calls for one of those images, the widget will just hang.

    Here's the widget. I hope this gives you a good start.Let me know what you think.

    Vista_Weather_+_Moonphase.zip

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

    radarlove63 (02-21-2009)

  14. #12
    Spamdumpster,
    I am downloading it now. Huge file to get and its coming down at 4.3KB/Sec.
    Will this allow for blank moon icon callouts during the daytime hours?
    My ultimate goal is to only have the moon present during the nightime screens.
    Doreen has provided me with a blank starry night background. She is working on an animated one for the twinkling stars.

    I only was able to rename the icons I had using someones other accu icon set. Those were the only icon names they had. Not sure how to get the naming structure that accu uses.
    If it's in your code then I will see if I can change more to reflect.
    From Doreens Vista Bliss/with gadgets thread she sounds like she would be willing create some imaages to match.
    I am a distracted typer. Download has now reached 14 % gonna be a while.
    Thanks tho. I'll let you know how it all goes once I get it and play for a bit.
    Last edited by radarlove63; 02-21-2009 at 04:46 PM.

  15. #13
    It's just a simple widget that pulls the weather icon and the moon icon and places the moon icon over the weather page. That's it. It's a big file because it's got two sets of Doreen's gifs -- the original and the ones you renamed. I don't know how to handle making the moon icons only come at night, but it can't be too complicated. Wish I had more to add.

  16. #14
    Theme Creator Doreen's Avatar
    Join Date
    Jul 2007
    Location
    Southern California
    Posts
    2,615
    Thanks
    2,735
    Thanked 2,566 Times in 1,188 Posts

    Spamdumpster the way it was done before is someone named Storyr did that portion for me and he "hid" the moon during the day w/ an overlay and then the overlay stopped at night another words the moon phase is always there day and night but it's hidden until a certain time at night.
    (It's been two years or so, so I forgot my old theme) hehe

    But I need to go look at it again and see if we can put our heads together and do this.

    I swear I get so caught up in ppl's nicknames that I'm still wondering about your nic Spamdumpster? hehe!
    Once I get that out of my head I'll go find my old theme and look at things again...
    Last edited by Doreen; 02-21-2009 at 05:30 PM. Reason: Automerged Doublepost

  17. #15
    Quote Originally Posted by Doreen View Post
    I swear I get so caught up in ppl's nicknames that I'm still wondering about your nic Spamdumpster? hehe!
    Once I get that out of my head I'll go find my old theme and look at things again...
    I get a lot of spam. What can I say?

    When the gmail beta was first released, I created two accounts. One with my real name, one with Spamdumpster, for use on the internets. I just started using the name in connection with every forum I joined because the name was handy.

  18. #16
    I just tried it out. Still looking to not load that image during certain hours
    I have been looking at the code in my post above and trying to shoe horn it for the moon icon. I am just not getting it at all.
    Thanks though as I see that yours could be a way to load into WB a one step approach.

    Cut and paste .js I shall go.

  19. #17
    Theme Creator Doreen's Avatar
    Join Date
    Jul 2007
    Location
    Southern California
    Posts
    2,615
    Thanks
    2,735
    Thanked 2,566 Times in 1,188 Posts

    Quote Originally Posted by Spamdumpster View Post
    I get a lot of spam. What can I say?

    When the gmail beta was first released, I created two accounts. One with my real name, one with Spamdumpster, for use on the internets. I just started using the name in connection with every forum I joined because the name was handy.
    hehe! okay now I can rest my brain on that! but I've got a really big headache now that I went back and looked at my old theme I remember now how it was done, But it's hard to explain. I will zip up the file and post it for you so you can see to compare w/ the explanation so give me a few mins...

    Alright I've got that file uploading now to a spot for you to d/l and beware it's as big as a house! I love to complicate everything so I animated that theme too (but unlike running ani's on the iPhone's springboard) on ppc you could go crazy w/ frames and I also was able to use .mngs which produce the best quality ani's possible.

    Here's my old theme: VistaAlive.zip

    Don't pay attention to the .wpa's just focus on the structure of the files and hopefully it will make sense, also note that there is a Second Backgrounds folder named "Backgrounds2" which was how we did it. Notice in that folder we have transparent icons of:

    27.png
    29.png
    31.png
    33.png
    45.png
    46.png
    47.png

    These icons represent when a moon would appear in one of Yahoo's weather icons during day hours. (we blocked those w/ transparent icons)

    Also note that the weather icons were pulled apart from the Moons that way the Current weather condition was "overlayed" on top of the current moon phase icon. So things worked like this:

    1. The feed would first display the proper Background wallpaper for the appropriate time and weather condition.
    2. The proper moon phase would display on top of the Background Wallpaper.
    3. Then the proper weather condition such as rain or snow would then display on top of the proper moon phase icon.

    Alright Spamdumpster "I dare you"
    Last edited by Doreen; 02-21-2009 at 06:33 PM. Reason: Automerged Doublepost

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

    radarlove63 (02-21-2009)

  21. #18
    Unhappy Wild goose chase maybe?


    Doreen was kind enough to provide me an animated starry night background.

    I have substituted this into her VistaBlissWeather.theme
    I am using MoonPhaseEditedByiBlade with his wallpaper.html renamed to widget.html

    I have butchered the following in the MoonPhase widget in my attempt to hide the moon to:

    <?xml version="1.0" encoding="UTF-16"?>
    <html><head>
    <base href="Private/"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

    <style>
    body {
    background-color: none;
    margin-top: -120px;
    margin-left: -119px;
    padding: 0px 0 0 0;
    height: 480px;
    width: 320px;
    }
    </style>


    <script type="text/javascript" src="configureMe.js"/>
    <script type="text/javascript" src="Wallpaper.js"/>

    </head>
    <body onload="onLoad()">

    </script>
    <div id="WeatherContainer">

    <script language="JavaScript">

    day=new Date() //..get the date

    x=day.getHours() //..get the hour

    if(x>=19 && x<24) {
    document.getElementById("moonIcon").src="Icon Sets/moonphases/moon-"+obj.moonday+".png";
    }
    </script>
    </div>

    </body></html>
    This doesn't work. I think I am heading in the right direction I am just not getting the syntax correct.


    Maybe if someone takes a look they could rewrite it.

    I am so stuck. Been hunting forums on .js all day.
    Right now the only script I have that works is me unloading the moonphase widget when I wake up and reloading at night.

  22. #19
    Theme Creator Doreen's Avatar
    Join Date
    Jul 2007
    Location
    Southern California
    Posts
    2,615
    Thanks
    2,735
    Thanked 2,566 Times in 1,188 Posts

    /me goes peek out my window and verify that the moon phase is correct. hehe

    (your close though) remember though there needs to be a folder of the diff weather condition images that will overlay the various moon phases so you need rain, snow, clouds etc that have no moon or sun behind them.

    I just remembered one person who did a script up! he added a second location he called it "Twin Cities" do you guys have that widget? If so you set the second location to feed the overlay icons that way they both display but one will display moon and one the weather icon overlays? Might be alot of editing for the correct image placements but it might work. I'm going to go find that one and come back...

    Okay here it is I can't recall where I got it from to put his/her name next to it, but this would have to be heavily edited so it's just to get some ideas flowing, and I'm going to dissect my old theme for the overlay images. I can always do new ones later after we get this working (if we can that is)

    Here's the Twin Cities it will feed two diff icons for two diff locations but since it feeds two diff icons maybe if positioned right this can be used for the overlay folder? What do you guys think?

    TwinCitiesWeather.theme.zip
    Last edited by Doreen; 02-21-2009 at 09:11 PM. Reason: Automerged Doublepost

  23. #20
    Default Baby steps
    I have posted a help request at codingforums
    [ame=http://www.codingforums.com/showthread.php?t=159390]Wanting to only load moon phase image at night - CodingForums.com[/ame]
    Below is a the first response I have recieved from coder "oesxyl".

    I think it's moving in the right direction. I am a bit fuzzy on the placement of the code. Is the html the proper place or should it reside in the .js file.
    I have included the zip if anyone wants to dive in.
    If you can implement the code please post it back. This has sparked some ideas with Doreen. All I can say is if this goes the next steps should be awesome.
    Trudging forward....

    Code:
    <script type="text/javascript">
    onload=function(){
    var rightNow = new Date();
    var hour = rightNow.getUTCHours();
    var newDisplay = 'block';,
    if(hour >= 6 && hour <= 20){
       newDisplay = 'none';
    }
    document.getElementById('moonIcon').style.display = newDisplay;
    }
    </script>
    Last edited by radarlove63; 02-25-2009 at 02:55 PM. Reason: Goal Met.. Deleted file attachment

Page 1 of 3 123 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
  •