linting js

This commit is contained in:
Mark Eaton
2021-02-28 02:41:46 -05:00
parent 641b7077a2
commit a04de57523
+15 -15
View File
@@ -258,26 +258,26 @@ img {
<!-- the code for the hours widget --> <!-- the code for the hours widget -->
<script type="text/javascript"> <script type="text/javascript">
window.onload = function () { window.onload = function () {
const h = JSON.parse(hours) const h = JSON.parse(hours);
const options_weekday = { weekday: 'long' }; const options_weekday = { weekday: 'long' };
const options_date = { month: 'short', day: 'numeric' } const options_date = { month: 'short', day: 'numeric' };
for (var i = 0; i < h.length; i++) { for (var i = 0; i < h.length; i++) {
let 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");
let 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 = "<p><strong>Today</strong><br />" + targetDate.toLocaleDateString("en-US", options_date) + "</p><p>" + h[i]["Hours"] + "</p>" document.getElementById('hours0').innerHTML = "<p><strong>Today</strong><br />" + targetDate.toLocaleDateString("en-US", options_date) + "</p><p>" + h[i].Hours + "</p>";
var start = true; var start = true;
var count = 1; var count = 1;
} else if (start === true && count < 5 && h[i]["Hours"] === "Closed" ) { } else if (start === true && count < 5 && h[i].Hours === "Closed" ) {
document.getElementById('hours' + count).innerHTML = "<span style='color:#666;'><p>" + targetDate.toLocaleDateString("en-US", options_weekday) + "<br />" + targetDate.toLocaleDateString("en-US", options_date) + "</p><p>" + h[i]["Hours"] + "</p></span>" document.getElementById('hours' + count).innerHTML = "<span style='color:#666;'><p>" + targetDate.toLocaleDateString("en-US", options_weekday) + "<br />" + targetDate.toLocaleDateString("en-US", options_date) + "</p><p>" + h[i].Hours + "</p></span>";
count++; count++;
} else if (start === true && count < 5 && h[i]["Hours"] != "Closed") { } else if (start === true && count < 5 && h[i].Hours != "Closed") {
document.getElementById('hours' + count).innerHTML = "<p>" + targetDate.toLocaleDateString("en-US", options_weekday) + "<br />" + targetDate.toLocaleDateString("en-US", options_date) + "</p><p>" + h[i]["Hours"] + "</p>" document.getElementById('hours' + count).innerHTML = "<p>" + targetDate.toLocaleDateString("en-US", options_weekday) + "<br />" + targetDate.toLocaleDateString("en-US", options_date) + "</p><p>" + h[i].Hours + "</p>";
count++; count++;
}; }
}; }
}; };
</script> </script>
@@ -305,9 +305,9 @@ function customizeSearch(facet) {
} else if (facet === "Newspapers") { } else if (facet === "Newspapers") {
document.getElementById("formToAppendInputsTo").setAttribute('action', 'https://onesearch.cuny.edu/discovery/npsearch'); document.getElementById("formToAppendInputsTo").setAttribute('action', 'https://onesearch.cuny.edu/discovery/npsearch');
} else { } else {
console.log("no match") console.log("no match");
}; }
}; }
</script> </script>
<!-- OneSearch widget script from OLS, modified --> <!-- OneSearch widget script from OLS, modified -->
@@ -321,12 +321,12 @@ function addPrimoQuery(e) {
document.getElementById("primoQueryTemp").value = ""; document.getElementById("primoQueryTemp").value = "";
document.getElementById("primoQueryTemp").setAttribute("placeholder", "Please make a selection"); document.getElementById("primoQueryTemp").setAttribute("placeholder", "Please make a selection");
return true; return true;
}; }
// original OLS widget // original OLS widget
document.getElementById("primoQuery").value = "any,contains," + document.getElementById("primoQueryTemp").value.replace(/[,]/g, " "); document.getElementById("primoQuery").value = "any,contains," + document.getElementById("primoQueryTemp").value.replace(/[,]/g, " ");
/* If you changed the form name at the top, change it below to match */ /* If you changed the form name at the top, change it below to match */
document.forms["searchPrimoForm1"].submit(); document.forms.searchPrimoForm1.submit();
} }
</script> </script>