Created
November 19, 2009 17:36
-
-
Save martymcguire/238922 to your computer and use it in GitHub Desktop.
Wordpress widget for displaying the status of the lights at HackPittsburgh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="light_status" | |
| style="width: 209px; height: 88px; margin-bottom: 10px; background: url('wp-content/themes/azul/images/shopClosed.png'); display:none;"> </div> | |
| <script> | |
| function refreshLightStatus() { | |
| $.getJSON("http://iobridge.com/api/feed/key=waStTNuoEvld6t9wsM&callback=?", | |
| function(data){ | |
| if (data["module"]["status"] != "Online") { | |
| $('#light_status').css('display','none'); | |
| } else { | |
| var light_status = data["module"]["channels"][0]["AnalogInput"]; | |
| if(light_status >= 500) { | |
| $('#light_status').css('background', 'url(wp-content/themes/azul/images/shopOpen.png)').css('display', 'block'); | |
| } else { | |
| $('#light_status').css('background', 'url(wp-content/themes/azul/images/shopClosed.png)').css('display', 'block'); | |
| } | |
| } | |
| }); | |
| } | |
| var refreshId = setInterval(refreshLightStatus , 10000); | |
| refreshLightStatus(); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment