first working hours widget

This commit is contained in:
Mark Eaton
2021-02-04 02:46:07 -05:00
parent cd41484de5
commit 5cbe754449
2 changed files with 34 additions and 2 deletions
@@ -124,3 +124,27 @@ img {
}
/* End of Yamm */
</style>
<script type="text/javascript" src="//libapps.s3.amazonaws.com/sites/2365/include/hours.js"></script>
<script type="text/javascript">
window.onload = function () {
const h = JSON.parse(hours)
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
for (var i = 0; i < h.length; i++) {
var targetDate = new Date(h[i]["Date"] + "T00:00:00.000-05:00");
var today = new Date();
if (targetDate.getFullYear() === today.getFullYear() &&
targetDate.getMonth() === today.getMonth() &&
targetDate.getDate() === today.getDate()) {
document.getElementById('hours0').innerHTML = targetDate.toLocaleDateString("en-US", options) + " - " + h[i]["Hours"]
start = true;
count = 1;
};
if (start === true && count < 4) {
document.getElementById('hours' + count).innerHTML = targetDate.toLocaleDateString("en-US", options) + " - " + h[i]["Hours"]
count++
}
};
};
</script>
+10 -2
View File
@@ -137,7 +137,15 @@
<span class="panel-title content-panel-title">LIbrary Hours</span>
</div>
<div class="panel-body">
<div class="hours-div"><h2>Library Hours</h2></div>
<div class="hours-div">
<div id="hours0"></div>
<div id="hours1"></div>
<div id="hours2"></div>
<div id="hours3"></div>
<div id="hours4"></div>
<div id="hours5"></div>
<div id="hours6"></div>
</div>
</div>
</div>
</div>
@@ -147,7 +155,7 @@
<span class="panel-title content-panel-title">Gallery</span>
</div>
<div class="panel-body">
{{content_boxes}}
{{content_boxes}}
</div>
</div>
</div>