class ConcordanceQueryBuilder { constructor() { this.elements = new ElementReferencesQueryBuilder(); this.generalFunctions = new GeneralFunctionsQueryBuilder(this.elements); this.tokenAttributeBuilderFunctions = new TokenAttributeBuilderFunctionsQueryBuilder(this.elements); this.structuralAttributeBuilderFunctions = new StructuralAttributeBuilderFunctionsQueryBuilder(this.elements); document.querySelectorAll('.incidence-modifier-selection').forEach(button => { if (button.parentNode.parentNode.id === 'corpus-analysis-concordance-token-incidence-modifiers-dropdown') { button.addEventListener('click', () => { this.generalFunctions.tokenIncidenceModifierHandler(button.dataset.token, button.innerHTML);}); } else if (button.parentNode.parentNode.id === 'corpus-analysis-concordance-character-incidence-modifiers-dropdown') { button.addEventListener('click', () => {this.tokenAttributeBuilderFunctions.characterIncidenceModifierHandler(button);}); } }); document.querySelectorAll('.n-m-submit-button').forEach(button => { if (button.dataset.modalId === 'corpus-analysis-concordance-exactly-n-token-modal' || button.dataset.modalId === 'corpus-analysis-concordance-between-nm-token-modal') { button.addEventListener('click', () => { this.generalFunctions.tokenNMSubmitHandler(button.dataset.modalId); }); } else if (button.dataset.modalId === 'corpus-analysis-concordance-exactly-n-character-modal' || button.dataset.modalId === 'corpus-analysis-concordance-between-nm-character-modal') { button.addEventListener('click', () => { this.generalFunctions.characterNMSubmitHandler(button.dataset.modalId); }); } }); this.elements.positionalAttrModal = M.Modal.init( document.querySelector('#corpus-analysis-concordance-positional-attr-modal'), { onOpenStart: () => { this.tokenAttributeBuilderFunctions.optionToggleHandler(); } } ); } }