nopaque/app/static/js/CorpusAnalysis/QueryBuilder.js

40 lines
2.0 KiB
JavaScript
Raw Normal View History

2022-07-13 12:06:22 +00:00
class ConcordanceQueryBuilder {
2022-09-07 07:06:21 +00:00
constructor() {
2023-08-02 12:14:46 +00:00
this.elements = new ElementReferencesQueryBuilder();
this.generalFunctions = new GeneralFunctionsQueryBuilder(this.elements);
this.tokenAttributeBuilderFunctions = new TokenAttributeBuilderFunctionsQueryBuilder(this.elements);
this.structuralAttributeBuilderFunctions = new StructuralAttributeBuilderFunctionsQueryBuilder(this.elements);
2022-09-07 07:06:21 +00:00
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(
2023-08-08 14:00:30 +00:00
document.querySelector('#corpus-analysis-concordance-positional-attr-modal'),
2023-07-25 12:56:07 +00:00
{
onOpenStart: () => {
this.tokenAttributeBuilderFunctions.optionToggleHandler();
2023-07-25 12:56:07 +00:00
}
}
);
2022-09-07 07:06:21 +00:00
}
2022-07-13 12:06:22 +00:00
}