-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtodayshours.js
More file actions
47 lines (38 loc) · 1.59 KB
/
Copy pathtodayshours.js
File metadata and controls
47 lines (38 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Today's Library Hours v.1 (March 30, 2011)
// Grand Valley State University Library Labs, 2011
// by Matthew Reidsma, reidsmam@gvsu.edu
//
// Released under the GPL: http://www.gnu.org/licenses/gpl.html
//
// Configuration:
// ------------------------------------------------------------------
// Enter the time your library opens, starting with Sunday. If your library is closed,
// enter "X" for the time. In the following example, the library is closed on Sunday
// and opens at 9am Monday through Friday. On Saturday, the library opens at 1:30pm.
// The script will print whatever format you decide to use in these variables. Make
// sure to leave the quotes!
//
// EXAMPLE:
//
// var open=["X","9:00am","9:00am","9:00am","9:00am","9:00am","1:30pm"];
var open=["X","7:00am","7:00am","7:00am","7:00am","7:00am","9:00am"]; // Edit this line
// Enter the time your library closes, starting with Sunday. If your library is
// closed, enter "X" for the time.
var close=["X","10:00pm","10:00pm","10:00pm","10:00pm","10:00pm","9:00pm"]; // Edit this line
// Do not edit below this line
// -------------------------------------------------------------------
var currentTime = new Date()
var day = currentTime.getDay()
var openTime = open[day];
var closeTime = close[day];
createHours(openTime,closeTime);
function createHours(openTime, closeTime)
{ // Build the hours string
if(openTime == "X") {
var libhours = "Closed";
document.write(libhours);
} else {
var libhours = "<strong>Today’s hours:</strong> " + openTime + " – " + closeTime;
document.write(libhours);
}
}