[Web4lib] Hours of Operation display -Javascript

oliverg oliverg at newpaltz.edu
Thu Jun 10 12:41:15 EDT 2010


I sent this as attachements before and it did not get on the list
Below in this message is a Javascript I cobbled together for displaying

our hours at Sojourner Truth Library.

The script reads the Hours from a tab delimited text file that any staff 
member can maintain with any spreadsheet program.
It can display the hours as a single day OR up to calendars of as many 
months as you want.

It also uses a CSS file for formatting calendars so you can change the 
format to suit your site. Feel free to modify all the files to suit your 
needs.

Ours is set up to display reference desk coverage hours and hours for a 
special late night room we have but you can easily tell the script not 
to include those when you call it.

Here is a link to our demo site that explains how to use it on a web 
page. If you like it send me a link so I can see how you used it. 
http://library.newpaltz.edu/libcalendardemo.html

File list:
LibraryHoursScript.js
LibraryHoursTable.txt
4calendarscript2.css

Feel free to contact me if you have questions.


Gary Oliver
PC SERVICE AND REPAIR TECH
SOJOURNER TRUTH LIBRARY
SUNY at NEW PALTZ
300 HAWK DR
NEW PALTZ, NY 12561-2493 oliverg at newpaltz.edu 845-257-3704

             Summer Hours - OFF: Sunday Monday
             Working: Teu-Sat 10 am - 6 pm




------------------------------------------------------------------------

_______________________________ Tab delimited text file format of hours each day
------------------------------------------------------------------------

Day#	Date	Type	Day	Open	close	RefOpen	RefClose	Latenight
1	8/24/2009	Library Hours	Monday	8am	11:30pm	9am	10pm	Closed
2	8/25/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	Closed
3	8/26/2009	Library Hours	Wednesday	8am	11:30pm	9am	10pm	Closed
4	8/27/2009	Library Hours	Thursday	8am	11:30pm	9am	10pm	Closed
5	8/28/2009	Library Hours	Friday	8am	9pm	9am	5pm	Closed
6	8/29/2009	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
7	8/30/2009	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	Closed
8	8/31/2009	Library Hours	Monday	8am	11:30pm	9am	10pm	Closed
9	9/1/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	Closed
10	9/2/2009	Library Hours	Wednesday	8am	11:30pm	9am	10pm	Closed
11	9/3/2009	Library Hours	Thursday	8am	11:30pm	9am	10pm	Closed
12	9/4/2009	Library Hours	Friday	8am	9pm	9am	5pm	Closed
13	9/5/2009	Library Closed	Saturday	Closed	0	0	0	Closed
14	9/6/2009	Library Closed	Sunday	Closed	0	0	0	Closed
15	9/7/2009	Library Closed	Monday	Closed	0	0	0	Closed
16	9/8/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
17	9/9/2009	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
18	9/10/2009	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
19	9/11/2009	Library Hours	Friday	8am	9pm	9am	5pm	Closed
20	9/12/2009	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
21	9/13/2009	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
22	9/14/2009	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
23	9/15/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
24	9/16/2009	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
25	9/17/2009	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
26	9/18/2009	Library Hours	Friday	8am	5pm	9am	5pm	Closed
27	9/19/2009	Library Closed	Saturday	Closed	0	0	0	Closed
28	9/20/2009	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
29	9/21/2009	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
30	9/22/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
31	9/23/2009	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
32	9/24/2009	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
33	9/25/2009	Library Hours	Friday	8am	9pm	9am	5pm	Closed
34	9/26/2009	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
35	9/27/2009	Library Closed	Sunday	Closed	0	0	0	Closed
36	9/28/2009	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
37	9/29/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
38	9/30/2009	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
39	10/1/2009	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
40	10/2/2009	Library Hours	Friday	8am	9pm	9am	5pm	Closed
41	10/3/2009	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
42	10/4/2009	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
43	10/5/2009	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
44	10/6/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
45	10/7/2009	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
46	10/8/2009	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
47	10/9/2009	Library Hours	Friday	8am	9pm	9am	5pm	Closed
48	10/10/2009	Library Hours	Saturday	9:30am	9pm	1pm	5pm	Closed
49	10/11/2009	Mid-Semester Late Hours	Sunday	1pm	12:30am	1pm	5pm	3am
50	10/12/2009	Mid-Semester Late Hours	Monday	8am	12:30am	9am	10pm	3am
51	10/13/2009	Mid-Semester Late Hours	Tuesday	8am	12:30am	9am	10pm	3am
52	10/14/2009	Mid-Semester Late Hours	Wednesday	8am	12:30am	9am	10pm	3am
53	10/15/2009	Mid-Semester Late Hours	Thursday	8am	12:30am	9am	10pm	3am
54	10/16/2009	Mid-Semester Late Hours	Friday	8am	9pm	9am	5pm	Closed
55	10/17/2009	Mid-Semester Late Hours	Saturday	10am	9pm	1pm	5pm	Closed
56	10/18/2009	Mid-Semester Late Hours	Sunday	1pm	12:30am	1pm	5pm	3am
57	10/19/2009	Mid-Semester Late Hours	Monday	8am	12:30am	9am	10pm	3am
58	10/20/2009	Mid-Semester Late Hours	Tuesday	8am	12:30am	9am	10pm	3am
59	10/21/2009	Mid-Semester Late Hours	Wednesday	8am	12:30am	9am	10pm	3am
60	10/22/2009	Mid-Semester Late Hours	Thursday	8am	12:30am	9am	10pm	3am
61	10/23/2009	Library Hours	Friday	8am	9pm	9am	5pm	Closed
62	10/24/2009	Library Hours	Saturday	9:30am	9pm	1pm	5pm	Closed
63	10/25/2009	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
64	10/26/2009	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
65	10/27/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
66	10/28/2009	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
67	10/29/2009	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
68	10/30/2009	Library Hours	Friday	8am	9pm	9am	5pm	Closed
69	10/31/2009	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
70	11/1/2009	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
71	11/2/2009	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
72	11/3/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
73	11/4/2009	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
74	11/5/2009	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
75	11/6/2009	Library Hours	Friday	8am	9pm	9am	5pm	Closed
76	11/7/2009	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
77	11/8/2009	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
78	11/9/2009	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
79	11/10/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
80	11/11/2009	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
81	11/12/2009	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
82	11/13/2009	Library Hours	Friday	8am	9pm	9am	5pm	Closed
83	11/14/2009	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
84	11/15/2009	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
85	11/16/2009	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
86	11/17/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
87	11/18/2009	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
88	11/19/2009	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
89	11/20/2009	Library Hours	Friday	8am	9pm	9am	5pm	Closed
90	11/21/2009	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
91	11/22/2009	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
92	11/23/2009	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
93	11/24/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	Closed
94	11/25/2009	Thanksgiving Holiday Hours	Wednesday	8am	5pm	9am	5pm	Closed
95	11/26/2009	Thanksgiving Holiday Closed	Thursday	Closed	0	0	0	Closed
96	11/27/2009	Thanksgiving Holiday Closed	Friday	Closed	0	0	0	Closed
97	11/28/2009	Thanksgiving Holiday Closed	Saturday	Closed	0	0	0	Closed
98	11/29/2009	Thanksgiving Holiday Hours	Sunday	1pm	9pm	1pm	5pm	Closed
99	11/30/2009	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
100	12/1/2009	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
101	12/2/2009	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
102	12/3/2009	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
103	12/4/2009	Library Hours	Friday	8am	9pm	9am	5pm	Closed
104	12/5/2009	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
105	12/6/2009	End of Semester Hours	Sunday	1pm	12:30am	1pm	5pm	3am
106	12/7/2009	End of Semester Hours	Monday	8am	12:30am	9am	10pm	3am
107	12/8/2009	End of Semester Hours	Tuesday	8am	12:30am	9am	10pm	3am
108	12/9/2009	End of Semester Hours	Wednesday	8am	12:30am	9am	10pm	3am
109	12/10/2009	End of Semester Hours	Thursday	8am	12:30am	9am	10pm	3am
110	12/11/2009	End of Semester Hours	Friday	8am	9pm	9am	5pm	Closed
111	12/12/2009	End of Semester Hours	Saturday	10am	9pm	1pm	5pm	Closed
112	12/13/2009	End of Semester Hours	Sunday	1pm	12:30am	1pm	5pm	3am
113	12/14/2009	End of Semester Hours	Monday	8am	12:30am	9am	10pm	3am
114	12/15/2009	End of Semester Hours	Tuesday	8am	12:30am	9am	10pm	3am
115	12/16/2009	End of Semester Hours	Wednesday	8am	9pm	9am	5pm	Closed
116	12/17/2009	End of Semester Hours	Thursday	8am	5pm	9am	5pm	Closed
117	12/18/2009	End of Semester Hours	Friday	8am	5pm	9am	5pm	Closed
118	12/19/2009	Intersession Closed	Saturday	Closed	0	0	0	Closed
119	12/20/2009	Intersession Closed	Sunday	Closed	0	0	0	Closed
120	12/21/2009	Intersession Hours	Monday	8am	5pm	0	0	Closed
121	12/22/2009	Intersession Hours	Tuesday	8am	5pm	0	0	Closed
122	12/23/2009	Intersession Closed	Wednesday	Closed	0	0	0	Closed
123	12/24/2009	Intersession Closed	Thursday	Closed	0	0	0	Closed
124	12/25/2009	Christmas Closed	Friday	Closed	0	0	0	Closed
125	12/26/2009	Intersession Closed	Saturday	Closed	0	0	0	Closed
126	12/27/2009	Intersession Closed	Sunday	Closed	0	0	0	Closed
127	12/28/2009	Intersession Closed	Monday	Closed	0	0	0	Closed
128	12/29/2009	Intersession Closed	Tuesday	Closed	0	0	0	Closed
129	12/30/2009	Intersession Closed	Wednesday	Closed	0	0	0	Closed
130	12/31/2009	Intersession Closed	Thursday	Closed	0	0	0	Closed
131	1/1/2010	New Year's Day Closed	Friday	Closed	0	0	0	Closed
132	1/2/2010	Intersession Closed	Saturday	Closed	0	0	0	Closed
133	1/3/2010	Intersession Closed	Sunday	Closed	0	0	0	Closed
134	1/4/2010	Intersession Hours	Monday	8am	5pm	0	0	Closed
135	1/5/2010	Intersession Hours	Tuesday	8am	5pm	0	0	Closed
136	1/6/2010	Intersession Hours	Wednesday	8am	5pm	0	0	Closed
137	1/7/2010	Intersession Hours	Thursday	8am	5pm	0	0	Closed
138	1/8/2010	Intersession Hours	Friday	8am	5pm	0	0	Closed
139	1/9/2010	Intersession Closed	Saturday	Closed	0	0	0	Closed
140	1/10/2010	Intersession Closed	Sunday	Closed	0	0	0	Closed
141	1/11/2010	Intersession Hours	Monday	8am	5pm	0	0	Closed
142	1/12/2010	Intersession Hours	Tuesday	8am	5pm	0	0	Closed
143	1/13/2010	Intersession Hours	Wednesday	8am	5pm	0	0	Closed
144	1/14/2010	Intersession Hours	Thursday	8am	5pm	0	0	Closed
145	1/15/2010	Intersession Hours	Friday	8am	5pm	0	0	Closed
146	1/16/2010	Intersession Closed	Saturday	Closed	0	0	0	Closed
147	1/17/2010	Intersession Closed	Sunday	Closed	0	0	0	Closed
148	1/18/2010	Martin Luther King Day Closed	Monday	Closed	0	0	0	Closed
149	1/19/2010	Intersession Hours	Tuesday	8am	5pm	0	0	Closed
150	1/20/2010	Intersession Hours	Wednesday	8am	5pm	0	0	Closed
151	1/21/2010	Intersession Hours	Thursday	8am	5pm	0	0	Closed
152	1/22/2010	Intersession Hours	Friday	8am	5pm	0	0	Closed
153	1/23/2010	Intersession Closed	Saturday	Closed	0	0	0	Closed
154	1/24/2010	Intersession Closed	Sunday	Closed	0	0	0	Closed
155	1/25/2010	Library Hours	Monday	8am	11:30pm	9am	10pm	Closed
156	1/26/2010	Library Hours	Tuesday	8am	11:30pm	9am	10pm	Closed
157	1/27/2010	Library Hours	Wednesday	8am	11:30pm	9am	10pm	Closed
158	1/28/2010	Library Hours	Thursday	8am	11:30pm	9am	10pm	Closed
159	1/29/2010	Library Hours	Friday	8am	9pm	9am	5pm	Closed
160	1/30/2010	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
161	1/31/2010	Library Hours	Sunday	1pm	9pm	1pm	5pm	3am
162	2/1/2010	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
163	2/2/2010	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
164	2/3/2010	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
165	2/4/2010	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
166	2/5/2010	Library Hours	Friday	8am	9pm	9am	5pm	Closed
167	2/6/2010	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
168	2/7/2010	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
169	2/8/2010	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
170	2/9/2010	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
171	2/10/2010	Library Hours Snow Closing	Wednesday	8am	5pm	9am	5pm	Closed
172	2/11/2010	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
173	2/12/2010	Library Hours	Friday	8am	9pm	9am	5pm	Closed
174	2/13/2010	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
175	2/14/2010	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
176	2/15/2010	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
177	2/16/2010	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
178	2/17/2010	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
179	2/18/2010	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
180	2/19/2010	Library Hours	Friday	8am	9pm	9am	5pm	Closed
181	2/20/2010	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
182	2/21/2010	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
183	2/22/2010	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
184	2/23/2010	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
185	2/24/2010	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
186	2/25/2010	SNOW CLOSING 3PM - Hours 	Thursday	8am	3pm	9am	3pm	Closed
187	2/26/2010	SNOW CLOSING 	Friday	Closed	0	0	0	Closed
188	2/27/2010	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
189	2/28/2010	Library Hours	Sunday	1pm	12:30am	1pm	5pm	3am
190	3/1/2010	Library Hours	Monday	8am	12:30am	9am	10pm	3am
191	3/2/2010	Library Hours	Tuesday	8am	12:30am	9am	10pm	3am
192	3/3/2010	Library Hours	Wednesday	8am	12:30am	9am	10pm	3am
193	3/4/2010	Library Hours	Thursday	8am	12:30am	9am	10pm	3am
194	3/5/2010	Library Hours	Friday	8am	9pm	9am	5pm	Closed
195	3/6/2010	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
196	3/7/2010	Library Hours  Mid-Semester	Sunday	1pm	12:30am	1pm	5pm	3am
197	3/8/2010	Library Hours  Mid-Semester	Monday	8am	12:30am	9am	10pm	3am
198	3/9/2010	Library Hours  Mid-Semester	Tuesday	8am	12:30am	9am	10pm	3am
199	3/10/2010	Library Hours  Mid-Semester	Wednesday	8am	12:30am	9am	10pm	3am
200	3/11/2010	Library Hours  Mid-Semester	Thursday	8am	12:30am	9am	10pm	3am
201	3/12/2010	Library Hours Spring Break	Friday	8am	5pm	9am	5pm	Closed
202	3/13/2010	Library Closed Spring Break	Saturday	Closed	0	0	0	Closed
203	3/14/2010	Library Closed Spring Break	Sunday	Closed	0	0	0	Closed
204	3/15/2010	Library Hours Spring Break	Monday	8am	5pm	9am	5pm	Closed
205	3/16/2010	Library Hours Spring Break	Tuesday	8am	5pm	9am	5pm	Closed
206	3/17/2010	Library Hours Spring Break	Wednesday	8am	5pm	9am	5pm	Closed
207	3/18/2010	Library Hours Spring Break	Thursday	8am	5pm	9am	5pm	Closed
208	3/19/2010	Library Hours Spring Break	Friday	8am	5pm	9am	5pm	Closed
209	3/20/2010	Library Closed Spring Break	Saturday	Closed	0	0	0	Closed
210	3/21/2010	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
211	3/22/2010	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
212	3/23/2010	Library Hours	Tuesday	8am	11:30pm	9pm	10pm	3am
213	3/24/2010	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
214	3/25/2010	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
215	3/26/2010	Library Hours Passover	Friday	8am	5pm	9am	5pm	Closed
216	3/27/2010	Library Hours Passover	Saturday	10am	5pm	0	0	Closed
217	3/28/2010	Library Closed Passover	Sunday	Closed	0	0	0	Closed
218	3/29/2010	Library Hours Passover	Monday	8am	9pm	9am	5pm	Closed
219	3/30/2010	Library Hours Passover	Tuesday	8am	9pm	9am	5pm	Closed
220	3/31/2010	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
221	4/1/2010	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
222	4/2/2010	Library Hours Easter	Friday	8am	5pm	9am	5pm	Closed
223	4/3/2010	Library Closed Easter	Saturday	Closed	0	0	0	Closed
224	4/4/2010	Library Hours Easter	Sunday	1pm	9pm	0	0	Closed
225	4/5/2010	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
226	4/6/2010	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
227	4/7/2010	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
228	4/8/2010	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
229	4/9/2010	Library Hours	Friday	8am	9pm	9am	5pm	Closed
230	4/10/2010	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
231	4/11/2010	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
232	4/12/2010	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
233	4/13/2010	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
234	4/14/2010	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
235	4/15/2010	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
236	4/16/2010	Library Hours	Friday	8am	9pm	9am	5pm	Closed
237	4/17/2010	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
238	4/18/2010	Library Hours	Sunday	10am	11:30pm	1pm	5pm	3am
239	4/19/2010	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
240	4/20/2010	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
241	4/21/2010	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
242	4/22/2010	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
243	4/23/2010	Library Hours	Friday	8am	9pm	9am	5pm	Closed
244	4/24/2010	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
245	4/25/2010	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
246	4/26/2010	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
247	4/27/2010	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
248	4/28/2010	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
249	4/29/2010	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
250	4/30/2010	Library Hours	Friday	8am	9pm	9am	5pm	Closed
251	5/1/2010	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
252	5/2/2010	Library Hours	Sunday	1pm	11:30pm	1pm	5pm	3am
253	5/3/2010	Library Hours	Monday	8am	11:30pm	9am	10pm	3am
254	5/4/2010	Library Hours	Tuesday	8am	11:30pm	9am	10pm	3am
255	5/5/2010	Library Hours	Wednesday	8am	11:30pm	9am	10pm	3am
256	5/6/2010	Library Hours	Thursday	8am	11:30pm	9am	10pm	3am
257	5/7/2010	Library Hours	Friday	8am	9pm	9am	5pm	Closed
258	5/8/2010	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
259	5/9/2010	Library Hours End of Semester	Sunday	1pm	12:30am	1pm	5pm	3am
260	5/10/2010	Library Hours End of Semester	Monday	8am	12:30am	9am	10pm	3am
261	5/11/2010	Library Hours End of Semester	Tuesday	8am	12:30am	9am	10pm	3am
262	5/12/2010	Library Hours End of Semester	Wednesday	8am	12:30am	9am	10pm	3am
263	5/13/2010	Library Hours End of Semester	Thursday	8am	12:30am	9am	10pm	3am
264	5/14/2010	Library Hours	Friday	8am	9pm	9am	5pm	Closed
265	5/15/2010	Library Hours	Saturday	10am	9pm	1pm	5pm	Closed
266	5/16/2010	Library Hours End of Semester	Sunday	1pm	12:30am	1pm	5pm	3am
267	5/17/2010	Library Hours End of Semester	Monday	8am	12:30am	9am	10pm	3am
268	5/18/2010	Library Hours End of Semester	Tuesday	8am	12:30am	9am	10pm	3am
269	5/19/2010	Library Hours End of Semester	Wednesday	8am	12:30am	9am	10pm	3am
270	5/20/2010	Library Hours End of Semester	Thursday	8am	9:00pm	9am	5pm	Closed
271	5/21/2010	Library Hours End of Semester	Friday	8am	5pm	9am	5pm	Closed
272	5/22/2010	Library Closed Intersession	Saturday	Closed	0	0	0	Closed
273	5/23/2010	Library Closed Intersession	Sunday	Closed	0	0	0	Closed
274	5/24/2010	Library Hours Intersession	Monday	8am	5pm	0	0	Closed
275	5/25/2010	Library Hours Intersession	Tuesday	8am	5pm	0	0	Closed
276	5/26/2010	Hours Summer Session 1 Begins	Wednesday	8am	9pm	9am	5pm	Closed
277	5/27/2010	Library Hours	Thursday	8am	9pm	9am	5pm	Closed
278	5/28/2010	Library Hours	Friday	8am	5pm	9am	5pm	Closed
279	5/29/2010	Library Closed	Saturday	Closed	0	0	0	Closed
280	5/30/2010	Library Closed Memorial Day 	Sunday	Closed	0	0	0	Closed
281	5/31/2010	Library Closed Memorial Day 	Monday	Closed	0	0	0	Closed
282	6/1/2010	Library Hours	Tuesday	8am	9pm	9am	5pm	Closed
283	6/2/2010	Library Hours	Wednesday	8am	9pm	9am	5pm	Closed
284	6/3/2010	Library Hours	Thursday	8am	9pm	9am	5pm	Closed
285	6/4/2010	Library Hours	Friday	8am	5pm	9am	5pm	Closed
286	6/5/2010	Library Closed	Saturday	Closed	0	0	0	Closed
287	6/6/2010	Library Hours	Sunday	1pm	9pm	1pm	5pm	Closed
288	6/7/2010	Library Hours	Monday	8am	9pm	9am	5pm	Closed
289	6/8/2010	Library Hours	Tuesday	8am	9pm	9am	5pm	Closed
290	6/9/2010	Library Hours	Wednesday	8am	9pm	9am	5pm	Closed
291	6/10/2010	Library Hours	Thursday	8am	9pm	9am	5pm	Closed
292	6/11/2010	Library Hours	Friday	8am	5pm	9am	5pm	Closed
293	6/12/2010	Library Closed	Saturday	Closed	0	0	0	Closed
294	6/13/2010	Library Hours	Sunday	1pm	9pm	1pm	5pm	Closed
295	6/14/2010	Library Hours	Monday	8am	9pm	9am	5pm	Closed
296	6/15/2010	Library Hours	Tuesday	8am	9pm	9am	5pm	Closed
297	6/16/2010	Library Hours	Wednesday	8am	9pm	9am	5pm	Closed
298	6/17/2010	Library Hours	Thursday	8am	9pm	9am	5pm	Closed
299	6/18/2010	Library Hours	Friday	8am	5pm	9am	5pm	Closed
300	6/19/2010	Library Closed	Saturday	Closed	0	0	0	Closed
301	6/20/2010	Library Hours	Sunday	1pm	9pm	1pm	5pm	Closed
302	6/21/2010	Library Hours	Monday	8am	9pm	9am	5pm	Closed
303	6/22/2010	Library Hours	Tuesday	8am	9pm	9am	5pm	Closed
304	6/23/2010	Library Hours	Wednesday	8am	9pm	9am	5pm	Closed
305	6/24/2010	Library Hours	Thursday	8am	9pm	9am	5pm	Closed
306	6/25/2010	Library Hours	Friday	8am	5pm	9am	5pm	Closed
307	6/26/2010	Library Closed	Saturday	Closed	0	0	0	Closed
308	6/27/2010	Library Hours	Sunday	1pm	9pm	1pm	5pm	Closed
309	6/28/2010	Library Hours	Monday	8am	9pm	9am	5pm	Closed
310	6/29/2010	Library Hours	Tuesday	8am	9pm	9am	5pm	Closed
311	6/30/2010	Library Hours End of Summer Session 1	Wednesday	8am	9pm	9am	5pm	Closed
312	7/1/2010	Library Hours Intersession	Thursday	8am	5pm	0	0	Closed
313	7/2/2010	Library Hours Intersession	Friday	8am	5pm	0	0	Closed
314	7/3/2010	Library Closed Intersession	Saturday	Closed	0	0	0	Closed
315	7/4/2010	Library Closed 4th of July	Sunday	Closed	0	0	0	Closed
316	7/5/2010	Library Closed 4th of July	Monday	Closed	0	0	0	Closed
317	7/6/2010	Library Hours Intersession	Tuesday	8am	5pm	0	0	Closed
318	7/7/2010	Hours Summer Session 2 Begins	Wednesday	8am	9pm	9am	5pm	Closed
319	7/8/2010	Library Hours	Thursday	8am	9pm	9am	5pm	Closed
320	7/9/2010	Library Hours	Friday	8am	5pm	9am	5pm	Closed
321	7/10/2010	Library Closed	Saturday	Closed	0	0	0	Closed
322	7/11/2010	Library Hours	Sunday	1pm	9pm	1pm	5pm	Closed
323	7/12/2010	Library Hours	Monday	8am	9pm	9am	5pm	Closed
324	7/13/2010	Library Hours	Tuesday	8am	9pm	9am	5pm	Closed
325	7/14/2010	Library Hours	Wednesday	8am	9pm	9am	5pm	Closed
326	7/15/2010	Library Hours	Thursday	8am	9pm	9am	5pm	Closed
327	7/16/2010	Library Hours	Friday	8am	5pm	9am	5pm	Closed
328	7/17/2010	Library Closed	Saturday	Closed	0	0	0	Closed
329	7/18/2010	Library Hours	Sunday	1pm	9pm	1pm	5pm	Closed
330	7/19/2010	Library Hours	Monday	8am	9pm	9am	5pm	Closed
331	7/20/2010	Library Hours	Tuesday	8am	9pm	9am	5pm	Closed
332	7/21/2010	Library Hours	Wednesday	8am	9pm	9am	5pm	Closed
333	7/22/2010	Library Hours	Thursday	8am	9pm	9am	5pm	Closed
334	7/23/2010	Library Hours	Friday	8am	5pm	9am	5pm	Closed
335	7/24/2010	Library Closed	Saturday	Closed	0	0	0	Closed
336	7/25/2010	Library Hours	Sunday	1pm	9pm	1pm	5pm	Closed
337	7/26/2010	Library Hours	Monday	8am	9pm	9am	5pm	Closed
338	7/27/2010	Library Hours	Tuesday	8am	9pm	9am	5pm	Closed
339	7/28/2010	Library Hours	Wednesday	8am	9pm	9am	5pm	Closed
340	7/29/2010	Library Hours	Thursday	8am	9pm	9am	5pm	Closed
341	7/30/2010	Library Hours	Friday	8am	5pm	9am	5pm	Closed
342	7/31/2010	Library Closed	Saturday	Closed	0	0	0	Closed
343	8/1/2010	Library Hours	Sunday	1pm	9pm	1pm	5pm	Closed
344	8/2/2010	Library Hours	Monday	8am	9pm	9am	5pm	Closed
345	8/3/2010	Library Hours	Tuesday	8am	9pm	9am	5pm	Closed
346	8/4/2010	Library Hours	Wednesday	8am	9pm	9am	5pm	Closed
347	8/5/2010	Library Hours	Thursday	8am	9pm	9am	5pm	Closed
348	8/6/2010	Library Hours	Friday	8am	5pm	9am	5pm	Closed
349	8/7/2010	Library Closed	Saturday	Closed	0	0	0	Closed
350	8/8/2010	Library Hours	Sunday	1pm	9pm	1pm	5pm	Closed
351	8/9/2010	Library Hours	Monday	8am	9pm	9am	5pm	Closed
352	8/10/2010	Hours End of Summer Session 2	Tuesday	8am	9pm	9am	5pm	Closed
353	8/11/2010	Library Hours Intersession	Wednesday	8am	5pm	0	0	Closed
354	8/12/2010	Library Hours Intersession	Thursday	8am	5pm	0	0	Closed
355	8/13/2010	Library Hours Intersession	Friday	8am	5pm	0	0	Closed
356	8/14/2010	Library Closed Intersession	Saturday	Closed	0	0	0	Closed
357	8/15/2010	Library Closed Intersession	Sunday	Closed	0	0	0	Closed
358	8/16/2010	Library Hours Intersession	Monday	8am	5pm	0	0	Closed
359	8/17/2010	Library Hours Intersession	Tuesday	8am	5pm	0	0	Closed
360	8/18/2010	Library Hours Intersession	Wednesday	8am	5pm	0	0	Closed
361	8/19/2010	Library Hours Intersession	Thursday	8am	5pm	0	0	Closed
362	8/20/2010	Library Hours Intersession	Friday	8am	5pm	0	0	Closed
363	8/21/2010	Library Closed Intersession	Saturday	Closed	0	0	0	Closed
364	8/22/2010	Library Closed Intersession	Sunday	Closed	0	0	0	Closed


_______________  CSS we use to format the calendar output for printing
------------------------------------------------------------------------

div.main { width:860px; height:auto;}
table.main  {border-collapse:separate;}
br.breakhere {line-height:3em;}
td.month {padding: 4px;
background-color:navy;
font:bold 16px verdana;
color:white;
text-align: center; }

td.daysofweek {
background-color:darkorange;
font:bold 12px verdana;
color:white;
width:14%;
text-align: center; }

td.days {
border-style:solid;
border-width:1px;
border-color:#555555;
text-align:left; vertical-align:top;
font: normal 12px verdana;
color: black;
background-color: lightyellow;
padding: 2px; 
height: 6em; }
b {color:darkblue;}
.days a:link {font: bold 12px verdana; text-decoration: none; color: red;  }
.days a:visited {font: bold 12px verdana; text-decoration: none; color: red;  }
.days a:active {font: bold 12px verdana; text-decoration: none; color: red; } 
.days a:hover {font: bold 12px verdana; text-decoration: none; } 
.days #today{font-weight: bold; color: red;}
.specialday {color:#aa0055; }
/* all the parts were given a class to modify */
.notset {color: silver;}
.closed {color: red;line-height:2em;}
.specialday {font-weight: bold;color: darkblue;}
.specialhours {font-weight: bold;color: #ce0000;line-height:1.6em;}
.regularday {color: black;}
.regularhours {line-height:1.6em;}
.ref {color: gray;}
.refhours {font-weight: bold;color: gray;}
.lateclosed {font-weight: bold;color: black;}
.lateroom {}
.latehours {font-weight: bold;}

@media print {

div.main {width: 98%;height:98%;border: 1px dotted white;}
Table.main {width: 100%;height:100%;}
br.breakhere {page-break-before: always;line-height: .2em;}
td.month {font: bold 18px verdana;color: navy;background-color:transparent;}
td.daysofweek {font: bold 14px verdana;color:darkorange;background-color:transparent;}
td.days {font: 14px verdana;height:auto;line-height: 90%;}

b {color:#003e7e;}
.days a:link {font: bold 14px verdana; text-decoration: none; color: red;line-height: 85%;border-bottom: none white; }
.days a:visited {font: bold 14px verdana; text-decoration: none; color: red; border-bottom: none white; }
.days a:active {font: bold 14px verdana; text-decoration: none; color: red; border-bottom: none white; } 
.days a:hover {font: bold 14px verdana; text-decoration: none;border-bottom: none white; } 
.days #today {display: none;}
.days .hoursbox {position:relative;height:auto; }
.days .hoursdata {text-align: center;vertical-align: middle;}
.specialday {font-weight: bold; color: #f58426;}
DIV.hoursbox {height:auto; padding-bottom: 1px;}
DIV.hoursdata {text-align: center;padding-bottom: 2px;}


}


____________________ Javascript to read the text file and show hours for a day days or a calendar of months
------------------------------------------------------------------------

// Provide the XMLHttpRequest class for IE 5.x-6.x:
// Other browsers (including IE 7.x-8.x) ignore this
//   when XMLHttpRequest is predefined
if (typeof(XMLHttpRequest)  === "undefined") {
 XMLHttpRequest = function() {
   try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
     catch(e) {}
   try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
     catch(e) {}
   try { return new ActiveXObject("Msxml2.XMLHTTP"); }
     catch(e) {}
   try { return new ActiveXObject("Microsoft.XMLHTTP"); }
     catch(e) {}
   //throw new Error("This browser does not support XMLHttpRequest.");
 };
}


//new ActiveXObject("Microsoft.XMLHTTP")
var filecontents; 
oRequest = new XMLHttpRequest();
var sURL  = "/LibraryHoursTable.txt";
oRequest.open("GET",sURL,false);
oRequest.setRequestHeader("User-Agent",navigator.userAgent);
oRequest.send(null);
filecontents = oRequest.responseText;
// if the datatable is missing or can't load write a link to our hours page
if (oRequest.status==200) {document.write ("");}
else {var nodata = "Yes";}
//document.write (filecontents);
//split file into array
//split data file string into an array at line breaks
var s, ss;
var s = filecontents;
// Split at each line return character.
ss = s.split("\n");


var todaydate=new Date()
var m=todaydate.getMonth()+1 //get current month (1-12)
var y=todaydate.getFullYear() //get current year
var day=todaydate.getDate() //get day of the month today
//var MsorDs="days"
var nTimes=1
var ShowRef=0
var ShowLate=1

//This draws the calendar and and puts the correct date in the correct box
function buildCal(m, y, day, MsorDs, nTimes, ShowRef , ShowLate){
var t=""
if (nodata == "Yes") {document.write('<Center><a href="http://library.newpaltz.edu/library_hours.html">Library Hours Page</a></center>');return;}
document.write ('')
for (g = 1; g <= nTimes; g++)
{
if (MsorDs=="days") {var newdate = new Date (y, m-1, day);
newdate.setDate(newdate.getDate()+(g-1));
var easydate = ((newdate.getMonth() + 1) + "/"+ (newdate.getDate()) + "/"+ (newdate.getFullYear()));
var alinebreak = " ";
t+=("<br />"+newdate.toLocaleDateString()+"<br />");
t+=libhours(easydate,ShowRef,ShowLate, alinebreak, MsorDs);}
else {
var mn=['January','February','March','April','May','June','July','August','September','October','November','December'];
var dim=[31,0,31,30,31,30,31,31,30,31,30,31];
var Day_names = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"); 

var oD = new Date(y, m-1, 1); //DD replaced line to fix date bug when current day is 31st
oD.od=oD.getDay()+1; //DD replaced line to fix date bug when current day is 31st
if (m >= 13) {
m = m-12; 
y++;
}

var todaydate=new Date() //DD added
var alinebreak = "<br />"
var scanfortoday=(y==todaydate.getFullYear() && m==todaydate.getMonth()+1)? todaydate.getDate() : 0 //DD added
dim[1]=(((oD.getFullYear()%100!=0)&&(oD.getFullYear()%4==0))||(oD.getFullYear()%400==0))?29:28;
t+='<html>\n<head>\n<LINK REL=StyleSheet HREF="http://library.newpaltz.edu/css/4calendarscript2.css" TYPE="text/css"></link>\n</head>\n<body>';
t+='<center>\n<div class="main">\n<table class="main" cols="7" cellpadding="0" cellspacing="3">\n<tr>';
t+='<td colspan="7" align="center" class="month">' + mn[m-1] + ' - ' + y + '<BR \> Sojourner Truth Library Hours</td>\n</tr>\n<tr>';
for(s=0;s<7;s++)
t+='<td class="daysofweek">'+Day_names[s]+'</td>\n';
t+='</tr>\n<tr>';
var all42=35
for(i=1;i<=42;i++){
var x=((i-oD.od>=0)&&(i-oD.od<dim[m-1]))? i-oD.od+1 : '&nbsp;';
if (x!='&nbsp;')var easydate = m+"/"+x+"/"+y;
else easydate = "";
if (easydate != "") var thehours = libhours(trim(easydate),ShowRef,ShowLate, alinebreak);
else var thehours = "";
if (x==scanfortoday) x=x+'<span id="today"> TODAY</span>' //DD added

if (x != '&nbsp;' && i==36){t+='</tr>\n<tr>\n';all42 = 42;}
if (x!='&nbsp;') t+='<td class="days"><b>'+x+'</b>\n<br />\n<center><div class="hoursbox"><div class="hoursdata">'+ thehours + '</div></div></center></td>\n';
else if (x == '&nbsp;'&& i<=all42) t+='<td> </td>\n';
if (((i)%7==0)&&(i<=34)) t+='</tr>\n<tr>\n';
}
//document.write ("<br />\n",m," ",g,"<br />\n")
++m;
t+='</tr></table></div></center>\n<br class="breakhere">\n';
}
}
return t;
}
// set function to trim junk characters from any variable for matching via if statements
function trim(stringToTrim) { 	return stringToTrim.replace(/^\s+|\s+$/g,"");}

//get hours out of data table

function libhours(HoursOfTheDay, ShowRef, ShowLate, alinebreak, MsorDs) {
var mydate = HoursOfTheDay;

var foundIt = "";
var theline = "0\tNA\tHours Not Set\t0\t0\t0\t0\t0\t0";
// look through the array for the simple date asign the line it is on to a variable
for ( var i=0, len=ss.length; i<len; ++i ){
 foundIt = ss[i].match(mydate);
 if (foundIt == mydate){
  theline = ss[i]; 
//document.write (mydate + foundIt);
//document.write ("<br />");
//document.write (theline);
//document.write ("<br />");
 }
}

//split the line from the table string by the tab character into an array then
// assign each field to its correct variable 

  var datastring, datastringS;
  // Split at each tab character.
  datastringS = theline.split("\t");
   var LineNum = datastringS[0] + " ";
   var linedate = datastringS[1] + " ";
   var DayType = datastringS[2] + " ";
   var dayoWeek = datastringS[3];
   var LibOpen = datastringS[4] + " ";
   var LibClose = datastringS[5];
   var RefOpen = datastringS[6];
   var RefClose = datastringS[7];
   var Latenight = datastringS[8];

// Check to see if the library is open format line accordingly
 if (dayoWeek=='0'){ var  Thelibhours =('<span class="notset">' +DayType + '</span><br />\n');}
 //else if (MsorDs == 'days'){ var Thelibhours =(DayType + alinebreak + '<b>' + LibOpen + '-' + LibClose + '</b><br />\n');}
 else if (trim(LibOpen) == 'Closed')    {  var  Thelibhours =('\n<b><span class="closed">' +DayType + '</span></b>\n<br />\n'); }
 else if (trim(DayType) != 'Library Hours')    {  var  Thelibhours =('<span class="specialday">' + DayType + alinebreak + '</span>\n<span class="specialhours">' + LibOpen + '-' + LibClose + '</span>\n\n<br />\n'); }
 else { var Thelibhours =('<span class="regularday">' + DayType + alinebreak + '\n<b><span class="regularhours">' + LibOpen + '-' + LibClose + '</span></b></span>\n<br />\n');}
// Check to see if refdesk is open format line accordingly
  if (dayoWeek=='0'){ Thelibhours += alinebreak;}
  else if (ShowRef=='0'){ }
  else if (trim(RefOpen) == '0') {Thelibhours +=(' ');}
  else  { Thelibhours += ('<span class="ref">Reference Desk<span class="refhours">' + alinebreak +  RefOpen + '- ' + RefClose + '</span><br /></span>\n');}
// Check to see if the latenight room is open format line accordingly
 var itisclosed = 'Closed'
 if (dayoWeek=='0'){ Thelibhours += alinebreak;}
 else if (ShowLate=='0'){ }
 else if (trim(Latenight) == itisclosed && trim(LibOpen) == 'Closed') {}
 else if (trim(Latenight) == itisclosed) {Thelibhours += ('<span class="lateclosed">Late Room ' +  trim(Latenight) + '</span><br />\n');}
 else { Thelibhours += ('<span class="lateroom">Late Room </span><span class="latehours">' + alinebreak + 'until ' +  trim(Latenight) + '</span><br />\n');}
return Thelibhours;

} 

------------------------------------------------------------------------
Original message
Howdy folks,
I'm feeling particularly stumped by this problem: I want to display a
simple box on our library website that, based on today's date, will
display the hours that we're open. Our website is built on ColdFusion,
so I'm looking for a solution that utilizes that, or javascript. You'd
think this would be a simple thing to do, but I'm even having a hard
time formulating a search query that pulls up anything useful.

I'm fairly new to javascript and VERY new to CF, so the simpler the
solution, the better.

Thanks in advice for any advice anyone can offer,

Laura

-- Laura Krier

http://www.lauraek.net
http://kitchenilliterate.wordpress.com


_______________________________________________ Web4lib mailing list
Web4lib at webjunction.org
http://lists.webjunction.org/web4lib/



-- 

    *Summer Hours
    Off: Sunday & Monday*
    Working: Teu - Sat 10 am - 6 pm
    oliverg at newpaltz.edu <Mailto:oliverg at newpaltz.edu> 845-257-3704
    Gary Oliver
    PC SERVICE AND REPAIR TECH
    SOJOURNER TRUTH LIBRARY
    SUNY at NEW PALTZ
    300 HAWK DR
    NEW PALTZ, NY 12561-2493

         Quote:
    /Nothing in all the world is more dangerous than sincere ignorance
    and conscientious stupidity./
    Martin Luther King Jr. 

------------------------------------------------------------------------




More information about the Web4lib mailing list