From 24a6b8514e7e64c388c17c5d59117d1fd689369a Mon Sep 17 00:00:00 2001 From: 3eef8a28f26fb2bcc514e6f1938929a1f931762 <116031952+3eef8a28f26fb2bcc514e6f1938929a1f931762@users.noreply.github.com> Date: Fri, 10 Feb 2023 15:50:06 -0500 Subject: [PATCH] Start working on search --- css/common.css | 2 +- js/search_helper.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 js/search_helper.js diff --git a/css/common.css b/css/common.css index 1c6aab259..a4226f4dd 100644 --- a/css/common.css +++ b/css/common.css @@ -114,7 +114,7 @@ p a:hover, p a:hover svg { margin-left: 2vmin; } -#header-search { +.header-search { position: relative; right: 1vmin; width: 12rem; diff --git a/js/search_helper.js b/js/search_helper.js new file mode 100644 index 000000000..e26ee3e3d --- /dev/null +++ b/js/search_helper.js @@ -0,0 +1,16 @@ +const search_helper = function() { + const input = document.getElementById("search").value; + console.log(input); +/* + const courseCodeInput = elem.value.replace(" ", "").replace("-", ""); + const subCode = courseCodeInput.substring(0,4).toUpperCase(); + const courseNum = courseCodeInput.substring(courseCodeInput.length-4,courseCodeInput.length); + if(`${subCode}-${courseNum}` in catalog){ + // course exists + window.location.href = "./coursedisplay.html?course="+subCode+"-"+courseNum; + } else { + // course doesn't exist + window.location.href = "./search.html?search="+encodeURIComponent(elem.value); + showSearchResults(); + }*/ +}