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.tokenAttributeBuilder = new TokenAttributeBuilderFunctionsQueryBuilder(this.elements);
|
|
|
|
this.structuralAttributeBuilder = new StructuralAttributeBuilderFunctionsQueryBuilder(this.elements);
|
2022-07-13 12:06:22 +00:00
|
|
|
|
2023-08-02 12:14:46 +00:00
|
|
|
this.elements.closeQueryBuilder.addEventListener('click', () => {this.generalFunctions.closeQueryBuilderModal(this.elements.concordanceQueryBuilder);});
|
|
|
|
this.elements.concordanceQueryBuilderButton.addEventListener('click', () => {this.generalFunctions.clearAll();});
|
|
|
|
this.elements.insertQueryButton.addEventListener('click', () => {this.generalFunctions.insertQuery();});
|
|
|
|
this.elements.positionalAttrButton.addEventListener('click', () => {this.generalFunctions.showPositionalAttrArea();});
|
|
|
|
this.elements.structuralAttrButton.addEventListener('click', () => {this.generalFunctions.showStructuralAttrArea();});
|
2022-09-07 07:06:21 +00:00
|
|
|
|
|
|
|
//#region Structural Attribute Event Listeners
|
2023-08-02 12:14:46 +00:00
|
|
|
this.elements.sentence.addEventListener('click', () => {this.structuralAttributeBuilder.addSentence();});
|
|
|
|
this.elements.entity.addEventListener('click', () => {this.structuralAttributeBuilder.addEntity();});
|
|
|
|
this.elements.textAnnotation.addEventListener('click', () => {this.structuralAttributeBuilder.addTextAnnotation();});
|
2022-09-07 07:06:21 +00:00
|
|
|
|
2023-08-02 12:14:46 +00:00
|
|
|
this.elements.englishEntType.addEventListener('change', () => {this.structuralAttributeBuilder.englishEntTypeHandler();});
|
|
|
|
this.elements.germanEntType.addEventListener('change', () => {this.structuralAttributeBuilder.germanEntTypeHandler();});
|
|
|
|
this.elements.emptyEntity.addEventListener('click', () => {this.structuralAttributeBuilder.emptyEntityButton();});
|
2022-07-13 12:06:22 +00:00
|
|
|
|
2023-08-02 12:14:46 +00:00
|
|
|
this.elements.textAnnotationSubmit.addEventListener('click', () => {this.structuralAttributeBuilder.textAnnotationSubmitHandler();});
|
2022-07-13 12:06:22 +00:00
|
|
|
|
2022-09-07 07:06:21 +00:00
|
|
|
//#endregion
|
2022-07-13 12:06:22 +00:00
|
|
|
|
2022-09-07 07:06:21 +00:00
|
|
|
//#region Token Attribute Event Listeners
|
2023-08-02 12:14:46 +00:00
|
|
|
this.elements.queryBuilderTutorialInfoIcon.addEventListener('click', () => {this.tokenAttributeBuilder.tutorialIconHandler('#query-builder-tutorial-start');});
|
|
|
|
this.elements.tokenTutorialInfoIcon.addEventListener('click', () => {this.tokenAttributeBuilder.tutorialIconHandler('#add-new-token-tutorial');});
|
|
|
|
this.elements.editTokenTutorialInfoIcon.addEventListener('click', () => {this.tokenAttributeBuilder.tutorialIconHandler('#edit-options-tutorial');});
|
|
|
|
this.elements.structuralAttributeTutorialInfoIcon.addEventListener('click', () => {this.tokenAttributeBuilder.tutorialIconHandler('#add-structural-attribute-tutorial');});
|
|
|
|
this.elements.generalOptionsQueryBuilderTutorialInfoIcon.addEventListener('click', () => {this.tokenAttributeBuilder.tutorialIconHandler('#general-options-query-builder');});
|
|
|
|
|
|
|
|
this.elements.positionalAttr.addEventListener('change', () => {this.tokenAttributeBuilder.tokenTypeSelector();});
|
|
|
|
this.elements.tokenSubmitButton.addEventListener('click', () => {this.tokenAttributeBuilder.addTokenToQuery();});
|
|
|
|
|
|
|
|
this.elements.wordInput.addEventListener('input', () => {this.tokenAttributeBuilder.inputFieldHandler();});
|
|
|
|
this.elements.lemmaInput.addEventListener('input', () => {this.tokenAttributeBuilder.inputFieldHandler();});
|
|
|
|
this.elements.ignoreCase.addEventListener('change', () => {this.tokenAttributeBuilder.inputOptionHandler(this.elements.ignoreCase);});
|
|
|
|
this.elements.wildcardChar.addEventListener('click', () => {this.tokenAttributeBuilder.inputOptionHandler(this.elements.wildcardChar);});
|
|
|
|
this.elements.optionGroup.addEventListener('click', () => {this.tokenAttributeBuilder.inputOptionHandler(this.elements.optionGroup);});
|
|
|
|
|
|
|
|
this.elements.oneOrMore.addEventListener('click', () => {this.tokenAttributeBuilder.incidenceModifiersHandler(this.elements.oneOrMore);});
|
|
|
|
this.elements.zeroOrMore.addEventListener('click', () => {this.tokenAttributeBuilder.incidenceModifiersHandler(this.elements.zeroOrMore);});
|
|
|
|
this.elements.zeroOrOne.addEventListener('click', () => {this.tokenAttributeBuilder.incidenceModifiersHandler(this.elements.zeroOrOne);});
|
|
|
|
this.elements.nSubmit.addEventListener('click', () => {this.tokenAttributeBuilder.nSubmitHandler();});
|
|
|
|
this.elements.nmSubmit.addEventListener('click', () => {this.tokenAttributeBuilder.nmSubmitHandler();});
|
|
|
|
|
|
|
|
this.elements.or.addEventListener('click', () => {this.tokenAttributeBuilder.orHandler();});
|
|
|
|
this.elements.and.addEventListener('click', () => {this.tokenAttributeBuilder.andHandler();});
|
2022-09-07 07:06:21 +00:00
|
|
|
|
|
|
|
//#endregion Token Attribute Event Listeners
|
2023-07-25 12:56:07 +00:00
|
|
|
let selectInstances = this.elements.concordanceQueryBuilder.querySelectorAll('select');
|
|
|
|
M.FormSelect.init(
|
|
|
|
selectInstances,
|
|
|
|
{
|
|
|
|
dropdownOptions: {
|
|
|
|
alignment: 'bottom',
|
|
|
|
coverTrigger: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
let dropdownContents = this.elements.concordanceQueryBuilder.querySelectorAll('.dropdown-content');
|
|
|
|
dropdownContents.forEach((dropdownContent) => {
|
|
|
|
dropdownContent.style.paddingBottom = '15px';
|
|
|
|
});
|
2022-09-07 07:06:21 +00:00
|
|
|
}
|
2022-07-13 12:06:22 +00:00
|
|
|
}
|