From 9d7aabce346a44fb8712572383d34cd7a8b86e98 Mon Sep 17 00:00:00 2001 From: martindholmes Date: Sat, 8 Jun 2024 17:33:51 -0700 Subject: [PATCH] A bit of the JS for issue #304. Got interrupted, more later. --- js/StaticSearch.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/js/StaticSearch.js b/js/StaticSearch.js index 9fbcf76..a1e6ba1 100644 --- a/js/StaticSearch.js +++ b/js/StaticSearch.js @@ -29,6 +29,8 @@ * input[type='number'].staticSearch_num (optional; inputs for numerical filters) * input[type='checkbox'].staticSearch_bool (optional: checkboxes for boolean filters) * input[type='text'].staticSearch_text (NOT YET IMPLEMENTED: type-in search filter boxes) + * input[type='checkbox']#ssCaseSensitivePhrasal (optional; checkbox to control case-sensitivity + * in phrasal searches) * * The first is mandatory, although the user is * not required to use it; they may choose simply @@ -114,6 +116,13 @@ class StaticSearch{ this.searchButton2.addEventListener('click', function(){this.doSearch(); return false;}.bind(this)); } + //Optional case-sensitivity checkbox for phrasal searches. + this.chkCaseSensitivePhrasal = document.querySelector("input#ssChkCaseSensitivePhrasal"); + if (this.chkCaseSensitivePhrasal){ + this.queryBox.addEventListener('change', function(){this.showHideCaseSensitivityControl(); return false;}) + } + + //Clear button will be there if there are filter controls. this.clearButton = document.querySelector("button#ssClear"); if (this.clearButton){ @@ -2010,6 +2019,15 @@ if (this.discardedTerms.length > 0){ } } + /** @function StaticSearch~showHideSensitivityControl + * @description This function triggers from the onchange event of the + * query text box; if we find a phrasal search typed in there, we display + * the case-sensitivity checkbox. + * @return {boolean} true on success, false on failure + */ + showHideSensitivityControl(){ + //if (this.queryBox.match) + } /** @function StaticSearch~phraseToRegex * @description This method takes a phrase and converts it