Dynamic Wallapaper Widget: Time of Day (Code help)

Discussion in 'iOS Themes and Customization' started by Captain*, Jun 6, 2009.

  1. Captain*

    Captain* Member

    Joined:
    Feb 9, 2009
    Messages:
    654
    Likes Received:
    6
    Device:
    iPhone 5S
    I'm currently making a DWPW (Dynamic Wallpaper Widget) that updates an overlay of the iPhone / iPod springboard with a image of the moon / sun that changes throughout the day (moon to sun to moon *an 8 picture loop). I have made all the PNG's and have started on the code. I am trying to do it through CSS, HTML and JS embedded in the HTML.

    The JS is an if code, that finds the current time, compares it between two values and chooses the appropriate background overlay (picture of sun / moon ect.) However when I SSH it and select the widget it doesn't work /figures XD

    Im no programmer so I would really appreciate help with the code and tell me what is wrong (The code is "Open Source" so feel free to use and modify it, although it is useless atm, please don't steal the idea however - its the only thing I ask, as anyone who would want to steal could also be willing to help me and they will be credited in the widget so they have no need to steal

    Please Register or Log in to view images

    )

    HTML (Bold text is JavaScript):
    Code:
    <?xml version="1.0" encoding="UTF-16"?>
    <HTML><head>
    
    	<link rel="stylesheet" href="Backgrounds.css">
    	
    	<base href="./"/>
    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    	<body>
    		<table><tr>
    	
    [B]	<td id="Backgrounds">
    			<script type="text/javascript"> var d = new Date(); var time = d.getHours();
    			if (time > 24 && < 03) 
    			{
    			<img src="Backgrounds/Background1.png"></img>;
    			}
    			}
    			else if (time > 03 && time < 06) 
    			{
    			<img src="Backgrounds/Background2.png"></img>;
    			}
    			}
    			else if (time > 06 && time < 09) 
    			{
    			<img src="Backgrounds/Background3.png"></img>;
    			}
    			} 
    			else if (time > 09 && time < 12) 
    			{
    			<img src="Backgrounds/Background4.png"></img>;
    			}
    			}
    			else if (time > 12 && time < 15) 
    			{
    			<img src="Backgrounds/Background5.png"></img>;
    			}
    			}
    			else if (time > 15 && time < 18) 
    			{
    			<img src="Backgrounds/Background6.png"></img>;
    			}
    			}
    			else if (time > 18 && time < 21) 
    			{
    			<img src="Backgrounds/Background7.png"></img>;
    			}
    			}
    			else if (time > 21 && time < 24) 
    			{
    			<img src="Backgrounds/Background2.png"></img>;
    			}
    			}
    			
    			</script>
    			</td>[/B]
    				
    		</table></tr>
    		
    </body></HTML>
    
    CSS:
    Code:
    body {
                background-color: none;
                margin: 0;
                height: 480px;
                width: 320px;
    }
        td#Backgrounds     			/* Dynamic Wallpapers*/
    {
            position: absolute; top: 0px; right: 0px; down: 0px; left: -1px;
    
    Thank you so much for ANY help, you will be credited in the widget if you do help me with teh coding

    Please Register or Log in to view images

  2. defleopard98

    defleopard98 New Member

    Joined:
    Feb 28, 2009
    Messages:
    74
    Likes Received:
    0
    Device:
    2G iPod touch
    Definitely cool and can't wait to see what people come up with. I'll try and make some images for it. Maybe you also make it change with the day of the week.

Share This Page