-
-
Save z3cka/1d1d107c78282a60aa759de1429f6815 to your computer and use it in GitHub Desktop.
open-now.html
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
<!DOCTYPE html> | |
<html> | |
<head lang="en"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta charset="UTF-8"> | |
<script src="https://code.jquery.com/jquery-1.11.3.js"></script> | |
<style> | |
span { | |
color: white; | |
font-family: "Verdana", sans-serif; | |
font-size: 44px; | |
padding: 0; | |
margin: 0; | |
border: 0; | |
/*line-height: 140px;*/ | |
} | |
</style> | |
</head> | |
<body> | |
<span id="others"><br><br> <img src="https://storage.googleapis.com/risemedialibrary-14d37739-5ebf-48da-9a52-4d8b63272675/Backgrounds/loader.gif" height="50" width="50"></img></span> | |
<script type='text/javascript'> | |
var output = ""; | |
var liblids = [ | |
[4691, 0, false, "arts"], | |
[3291, 1, false, "biomed"], | |
[4698, 2, false, "music"], | |
[4705, 5, false, "selboelter"], | |
[4706, 6, false, "selgeo"], | |
[2614, 4, false, "yrl"], | |
]; | |
$.getJSON( "https://webservices.library.ucla.edu/calendar/hours/today/0", function( hours ) { | |
// loop through all specified lid's to find the matches in the returned JSON | |
for (i=0; i<liblids.length; i++){ | |
for (j=0; j<34; j++){ | |
// when a match is found, check if the location is open | |
if (hours.locations[j].lid == liblids[i][0]) { | |
if (hours.locations[j].times.currently_open){ | |
liblids[i][2] = true; | |
} | |
} | |
} | |
} | |
}).done(function() { | |
$.getJSON( "https://webservices.library.ucla.edu/laptops/available", function( lapavail ) { | |
for ( k=0; k<liblids.length; k++ ) { | |
if (liblids[k][2]) { | |
// output += (lapavail.laptops[liblids[k][1]].availableCount+" | "+liblids[k][3]+" | "+"<br />"); | |
output += lapavail.laptops[liblids[k][1]].availableCount+"<br />"; | |
} else { | |
output += "closed<br />"; | |
} | |
} | |
document.getElementById("others").innerHTML = output; | |
}) | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment