2022-07-13 12:06:22 +00:00
|
|
|
class ConcordanceQueryBuilder {
|
|
|
|
|
2022-09-07 07:06:21 +00:00
|
|
|
constructor() {
|
2023-08-08 12:12:07 +00:00
|
|
|
|
2023-08-02 12:14:46 +00:00
|
|
|
this.elements = new ElementReferencesQueryBuilder();
|
|
|
|
this.generalFunctions = new GeneralFunctionsQueryBuilder(this.elements);
|
2023-08-11 11:55:41 +00:00
|
|
|
this.tokenAttributeBuilderFunctions = new TokenAttributeBuilderFunctionsQueryBuilder(this.elements);
|
|
|
|
this.structuralAttributeBuilderFunctions = new StructuralAttributeBuilderFunctionsQueryBuilder(this.elements);
|
2022-09-07 07:06:21 +00:00
|
|
|
|
2023-09-12 14:42:28 +00:00
|
|
|
// Eventlisteners for the incidence modifiers. There are two different types of incidence modifiers: token and character incidence modifiers.
|
2023-08-29 15:06:10 +00:00
|
|
|
document.querySelectorAll('.incidence-modifier-selection').forEach(button => {
|
2023-09-12 14:42:28 +00:00
|
|
|
let dropdownId = button.parentNode.parentNode.id;
|
|
|
|
if (dropdownId === 'corpus-analysis-concordance-token-incidence-modifiers-dropdown') {
|
|
|
|
button.addEventListener('click', () => this.generalFunctions.tokenIncidenceModifierHandler(button.dataset.token, button.innerHTML));
|
|
|
|
} else if (dropdownId === 'corpus-analysis-concordance-character-incidence-modifiers-dropdown') {
|
|
|
|
button.addEventListener('click', () => this.tokenAttributeBuilderFunctions.characterIncidenceModifierHandler(button));
|
2023-08-29 15:06:10 +00:00
|
|
|
}
|
|
|
|
});
|
2023-09-12 14:42:28 +00:00
|
|
|
|
|
|
|
// Eventlisteners for the submit of n- and m-values of the incidence modifier modal for "exactly n" or "between n and m".
|
2023-08-29 15:06:10 +00:00
|
|
|
document.querySelectorAll('.n-m-submit-button').forEach(button => {
|
2023-09-12 14:42:28 +00:00
|
|
|
let modalId = button.dataset.modalId;
|
|
|
|
if (modalId === 'corpus-analysis-concordance-exactly-n-token-modal' || modalId === 'corpus-analysis-concordance-between-nm-token-modal') {
|
|
|
|
button.addEventListener('click', () => this.generalFunctions.tokenNMSubmitHandler(modalId));
|
|
|
|
} else if (modalId === 'corpus-analysis-concordance-exactly-n-character-modal' || modalId === 'corpus-analysis-concordance-between-nm-character-modal') {
|
2023-09-18 15:05:01 +00:00
|
|
|
button.addEventListener('click', () => this.tokenAttributeBuilderFunctions.characterNMSubmitHandler(modalId));
|
2023-08-29 15:06:10 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-09-12 14:42:28 +00:00
|
|
|
document.querySelector('#corpus-analysis-concordance-text-annotation-submit').addEventListener('click', () => this.structuralAttributeBuilderFunctions.textAnnotationSubmitHandler());
|
|
|
|
|
2023-08-08 12:12:07 +00:00
|
|
|
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
|
|
|
{
|
2023-08-08 12:12:07 +00:00
|
|
|
onOpenStart: () => {
|
2023-08-11 11:55:41 +00:00
|
|
|
this.tokenAttributeBuilderFunctions.optionToggleHandler();
|
2023-07-25 12:56:07 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-08 12:12:07 +00:00
|
|
|
);
|
2022-09-07 07:06:21 +00:00
|
|
|
}
|
2022-07-13 12:06:22 +00:00
|
|
|
}
|