From 517c4c70953fea04b3e7f050edb7ab895774a5a4 Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Fri, 21 Dec 2018 10:57:08 -0500 Subject: Update --- script.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'script.js') diff --git a/script.js b/script.js index c9ad800..7fa77db 100644 --- a/script.js +++ b/script.js @@ -342,7 +342,7 @@ function ready() { if (compat_facs) { let other_facs = compat_facs .filter(f => f != state["fac"]) - .map(f => `${f}/${state["subj"]}`) + .map(f => `${f}/${state["subj"]}`) .join(", "); if (other_facs.length) return "other options: " + other_facs; @@ -353,11 +353,11 @@ function ready() { // 1. most recent faculty for this course if (state["crsn"] && cached_ycq_s.course_facs[state["subj"] + state["crsn"]]) { state["fac"] = cached_ycq_s.course_facs[state["subj"] + state["crsn"]]; - add_li(warn, `assuming ${state["subj"]} ${state["crsn"]} is ${state["fac"]}/${state["subj"]}, because you last used ${state["fac"]} for ${state["subj"]} ${state["crsn"]}. ${other_options()}`); + add_li(warn, `assuming ${state["subj"]} ${state["crsn"]} is ${state["fac"]}/${state["subj"]} because you last used ${state["fac"]} for ${state["subj"]} ${state["crsn"]}. ${other_options()}`); } else if (cached_ycq_s.subj_facs[state["subj"]]) { // 2. most recent faculty for this subject state["fac"] = cached_ycq_s.subj_facs[state["subj"]]; - add_li(warn, `assuming ${state["subj"]} means ${state["fac"]}/${state["subj"]}, because you last used ${state["fac"]} for ${state["subj"]}. ${other_options()}`); + add_li(warn, `assuming ${state["subj"]} means ${state["fac"]}/${state["subj"]} because you last used ${state["fac"]} for ${state["subj"]}. ${other_options()}`); } else if (compat_facs) { // 3. most recent compatible faculty if (cached_ycq_s.default_facs) @@ -366,14 +366,14 @@ function ready() { state["fac"] = cached_ycq_s.default_facs[i]; if (state["fac"]) { - add_li(warn, `assuming ${state["subj"]} means ${state["fac"]}/${state["subj"]}, because you recently used ${state["fac"]}. ${other_options()}`); + add_li(warn, `assuming ${state["subj"]} means ${state["fac"]}/${state["subj"]} because you recently used ${state["fac"]}. ${other_options()}`); } else { // 4. first compatible faculty state["fac"] = compat_facs[0]; if (compat_facs.length > 1) - add_li(warn, `assuming ${state["subj"]} means ${state["fac"]}/${state["subj"]}, because we set that as the default for ${state["subj"]}. ${other_options()}`); + add_li(warn, `assuming ${state["subj"]} means ${state["fac"]}/${state["subj"]}. ${other_options()}`); else - add_li(warn, `assuming ${state["subj"]} means ${state["fac"]}/${state["subj"]}, because we only know ${state["fac"]} for ${state["subj"]}.`); + add_li(warn, `assuming ${state["subj"]} means ${state["fac"]}/${state["subj"]}`); } } else { add_li(error, "no faculty provided and unknown subject"); @@ -430,12 +430,13 @@ function ready() { } else if (e.target.closest(".prepend-query")) { e.preventDefault(); let r = false; + let t = e.target.hasAttribute("data-query") ? e.target.getAttribute("data-query") : e.target.textContent; if (document.execCommand) { input.setSelectionRange(0, 0); - r = document.execCommand("insertText", false, e.target.textContent + " "); + r = document.execCommand("insertText", false, t + " "); } if (!r) - input.value = e.target.textContent + " " + input.value; + input.value = t + " " + input.value; apply(); } }); -- cgit v1.2.3-54-g00ecf