Skip to content

Instantly share code, notes, and snippets.

@martymcguire
Created November 19, 2009 17:36
Show Gist options
  • Select an option

  • Save martymcguire/238922 to your computer and use it in GitHub Desktop.

Select an option

Save martymcguire/238922 to your computer and use it in GitHub Desktop.
Wordpress widget for displaying the status of the lights at HackPittsburgh
<div id="light_status"
style="width: 209px; height: 88px; margin-bottom: 10px; background: url('wp-content/themes/azul/images/shopClosed.png'); display:none;">&nbsp;</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