remove old js

This commit is contained in:
Mark Eaton
2023-07-01 18:38:18 -04:00
parent 9158ca40f0
commit 04dfbab736
-140
View File
@@ -443,143 +443,6 @@
}); });
</script> </script>
<!-- polyfills to make .forEach and .includes work in IE10 and IE11 -->
<script type="text/javascript">
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = Array.prototype.forEach;
}
String.prototype.includes = function (match) {
return this.indexOf(match) !== -1;
};
</script>
<!-- script to make OneSearch dropdown work -->
<!-- please forgive the old-timey JS; it is there because we need to support IE10 & IE11 -->
<script type="text/javascript">
function customizeSearch(facet) {
// re-render the dropdown menu with the current pick
document.getElementById("dropdownMenu1").innerHTML =
facet + ' <span class="caret"></span>';
document
.getElementById("primoQueryTemp")
.setAttribute("placeholder", "Enter search term here");
// reset any previously selected facets
document
.querySelectorAll(".deleteWithDropdownChange")
.forEach(function (e) {
e.remove();
});
document
.getElementById("formToAppendInputsTo")
.setAttribute(
"action",
"https://cuny-kb.primo.exlibrisgroup.com/discovery/search"
);
document.getElementById("tabSetting").setAttribute("value", "Everything");
document
.getElementById("SearchScopeSetting")
.setAttribute("value", "IZ_CI_AW");
// add the facet that matches the user's dropdown selection
if (facet === "Books") {
document
.getElementById("formToAppendInputsTo")
.insertAdjacentHTML(
"afterbegin",
'<input name="facet" value="rtype,include,books" type="hidden" class="deleteWithDropdownChange" />'
);
} else if (facet === "Articles") {
document
.getElementById("formToAppendInputsTo")
.insertAdjacentHTML(
"afterbegin",
'<input name="mfacet" value="rtype,include,articles,1" type="hidden" class="deleteWithDropdownChange"/><input name="facet" value="tlevel,include,peer_reviewed" type="hidden" class="deleteWithDropdownChange" />'
);
} else if (facet === "Videos") {
document
.getElementById("formToAppendInputsTo")
.insertAdjacentHTML(
"afterbegin",
'<input name="facet" value="rtype,include,videos" type="hidden" class="deleteWithDropdownChange" />'
);
} else if (facet === "Journals") {
document
.getElementById("formToAppendInputsTo")
.setAttribute(
"action",
"https://cuny-kb.primo.exlibrisgroup.com/discovery/jsearch"
);
document
.getElementById("tabSetting")
.setAttribute("value", "jsearch_slot");
} else if (facet === "Newspapers") {
document
.getElementById("formToAppendInputsTo")
.setAttribute(
"action",
"https://cuny-kb.primo.exlibrisgroup.com/discovery/npsearch"
);
} else if (facet === "Reserves") {
document
.getElementById("tabSetting")
.setAttribute("value", "CourseReserves");
document
.getElementById("SearchScopeSetting")
.setAttribute("value", "CourseReserves");
} else {
console.log("no match");
}
// store the facet, for use on page reload
sessionStorage.facet = facet;
}
// if the stored facet exists on page load, render the dropdown with that facet, then clear the stored facet
function sessionFunction() {
if (sessionStorage.facet && sessionStorage.searchTerms) {
stored_terms = sessionStorage.searchTerms;
document.getElementById("primoQueryTemp").value = stored_terms;
stored_facet = sessionStorage.facet;
customizeSearch(stored_facet);
}
sessionStorage.clear();
}
</script>
<!-- OneSearch widget script from OLS, modified -->
<!-- please forgive the old-timey JS; it is there because we need to support IE10 & IE11 -->
<script type="text/javascript">
function addPrimoQuery(e) {
// prevent the user from submitting the form if no dropdown item has been selected. Added by ME.
e.preventDefault();
e.stopPropagation();
if (
document.getElementById("dropdownMenu1").innerHTML.includes("Define") ===
true
) {
$("#dropdownMenu1").trigger("click.bs.dropdown.data-api");
document.getElementById("primoQueryTemp").value = "";
document
.getElementById("primoQueryTemp")
.setAttribute("placeholder", "Please make a selection");
return true;
}
// save the search terms, for use on page reload
sessionStorage.searchTerms =
document.getElementById("primoQueryTemp").value;
// original OLS widget
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
document.forms.searchPrimoForm1.submit();
}
</script>
<!-- If browser is pre-ES6, show a warning--> <!-- If browser is pre-ES6, show a warning-->
<script> <script>
window.isES6 = false; window.isES6 = false;
@@ -619,9 +482,6 @@
<script type="text/javascript"> <script type="text/javascript">
window.onload = function () { window.onload = function () {
<!-- run the sessionStorage stuff on load -->
sessionFunction();
<!-- display the error message if feature detection flags old browser --> <!-- display the error message if feature detection flags old browser -->
if (window.isES6 == false) { if (window.isES6 == false) {
document.getElementById("obsolete_browser_alert").innerHTML = document.getElementById("obsolete_browser_alert").innerHTML =