From 6559051fd5dfa0eaff1fcdaa3d9ad37d3c0af916 Mon Sep 17 00:00:00 2001 From: Inga Kirschnick Date: Mon, 13 Nov 2023 15:37:19 +0100 Subject: [PATCH] Delete condition logic in token builder --- .../token-attribute-builder-functions.js | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/app/static/js/corpus-analysis/query-builder/token-attribute-builder-functions.js b/app/static/js/corpus-analysis/query-builder/token-attribute-builder-functions.js index 6bbc20f0..9633583b 100644 --- a/app/static/js/corpus-analysis/query-builder/token-attribute-builder-functions.js +++ b/app/static/js/corpus-analysis/query-builder/token-attribute-builder-functions.js @@ -102,36 +102,12 @@ nopaque.corpus_analysis.query_builder.TokenAttributeBuilderFunctions = class Tok notSelectedButton.parentNode.removeChild(notSelectedButton); this.elements.tokenQuery.appendChild(tokenQueryTemplateClone); - // Deleting the options which do not make sense in the context of the condition like "word" AND "word". Also sets selection default. - let selectionDefault = "word"; - let optionDeleteList = ['empty-token']; - if (conditionText === 'and') { - switch (this.elements.positionalAttrSelection.value) { - case 'english-pos' || 'german-pos': - optionDeleteList.push('english-pos', 'german-pos'); - break; - default: - optionDeleteList.push(this.elements.positionalAttrSelection.value); - break; - } - } else { - let originalSelectionList = - ` - - - - - - `; - this.elements.positionalAttrSelection.innerHTML = originalSelectionList; - M.FormSelect.init(this.elements.positionalAttrSelection); - } let lastTokenQueryRow = this.elements.tokenQuery.lastElementChild; if(lastTokenQueryRow.querySelector('[data-kind-of-token="word"]') || lastTokenQueryRow.querySelector('[data-kind-of-token="lemma"]')) { this.appendIgnoreCaseCheckbox(lastTokenQueryRow.querySelector('.token-query-template-content'), this.elements.ignoreCaseCheckbox.checked); } this.elements.ignoreCaseCheckbox.checked = false; - this.setTokenSelection(selectionDefault, optionDeleteList); + this.setTokenSelection(); } deleteTokenQueryRow(deleteButton) { @@ -169,7 +145,7 @@ nopaque.corpus_analysis.query_builder.TokenAttributeBuilderFunctions = class Tok } } - setTokenSelection(selection, optionDeleteList) { + setTokenSelection(selection="word", optionDeleteList=['empty-token']) { optionDeleteList.forEach(option => { if (this.elements.positionalAttrSelection.querySelector(`option[value=${option}]`) !== null) { this.elements.positionalAttrSelection.querySelector(`option[value=${option}]`).remove();