improve hours widget
This commit is contained in:
@@ -84,12 +84,14 @@ img {
|
|||||||
outline: 0;
|
outline: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* style the hours div */
|
/* style the hours */
|
||||||
.hours-div {
|
.hours {
|
||||||
background-color: #bbb;
|
text-align:right;
|
||||||
height: 150px;
|
border-top: solid white 0px !important;
|
||||||
text-align: center;
|
}
|
||||||
padding-top: 35px;
|
|
||||||
|
.date {
|
||||||
|
border-top: solid white 0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* style the yamm menu */
|
/* style the yamm menu */
|
||||||
@@ -132,17 +134,16 @@ window.onload = function () {
|
|||||||
const h = JSON.parse(hours)
|
const h = JSON.parse(hours)
|
||||||
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
|
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
|
||||||
for (var i = 0; i < h.length; i++) {
|
for (var i = 0; i < h.length; i++) {
|
||||||
var targetDate = new Date(h[i]["Date"] + "T00:00:00.000-05:00");
|
let targetDate = new Date(h[i]["Date"] + "T00:00:00.000-05:00");
|
||||||
var today = new Date();
|
let today = new Date();
|
||||||
if (targetDate.getFullYear() === today.getFullYear() &&
|
if (targetDate.getFullYear() === today.getFullYear() &&
|
||||||
targetDate.getMonth() === today.getMonth() &&
|
targetDate.getMonth() === today.getMonth() &&
|
||||||
targetDate.getDate() === today.getDate()) {
|
targetDate.getDate() === today.getDate()) {
|
||||||
document.getElementById('hours0').innerHTML = targetDate.toLocaleDateString("en-US", options) + " - " + h[i]["Hours"]
|
document.getElementById('hours0').innerHTML = "<td class='hours col-xs-7'>" + targetDate.toLocaleDateString("en-US", options) + "</td><td class='date col-xs-5'>" + h[i]["Hours"] + "</td>"
|
||||||
start = true;
|
var start = true;
|
||||||
count = 1;
|
var count = 1
|
||||||
};
|
} else if (start === true && count < 7) {
|
||||||
if (start === true && count < 4) {
|
document.getElementById('hours' + count).innerHTML = "<td class='hours col-xs-7'>" + targetDate.toLocaleDateString("en-US", options) + "</td><td class='date col-xs-5'>" + h[i]["Hours"] + "</td>"
|
||||||
document.getElementById('hours' + count).innerHTML = targetDate.toLocaleDateString("en-US", options) + " - " + h[i]["Hours"]
|
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -137,15 +137,17 @@
|
|||||||
<span class="panel-title content-panel-title">LIbrary Hours</span>
|
<span class="panel-title content-panel-title">LIbrary Hours</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="hours-div">
|
<table class="table">
|
||||||
<div id="hours0"></div>
|
<tbody>
|
||||||
<div id="hours1"></div>
|
<tr id="hours0"></tr>
|
||||||
<div id="hours2"></div>
|
<tr id="hours1"></tr>
|
||||||
<div id="hours3"></div>
|
<tr id="hours2"></tr>
|
||||||
<div id="hours4"></div>
|
<tr id="hours3"></tr>
|
||||||
<div id="hours5"></div>
|
<tr id="hours4"></tr>
|
||||||
<div id="hours6"></div>
|
<tr id="hours5"></tr>
|
||||||
</div>
|
<tr id="hours6"></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user