New CSS File

This commit is contained in:
Inga Kirschnick
2022-10-13 15:15:53 +02:00
parent b9e5939c1b
commit 20b1a96862
4 changed files with 194 additions and 71 deletions

View File

@ -210,31 +210,14 @@ class ConcordanceQueryBuilder {
window.location.href = '#query-container';
this.elements.counter += 1;
queryText = encodeURI(queryText);
let chipColor = 'style="background-color:#';
// Sets chip color, depending on the type of element
if (dataType === 'start-sentence' || dataType === 'end-sentence') {
chipColor += 'FD9720';
} else if (dataType === 'start-empty-entity' || dataType === 'start-entity' || dataType === 'end-entity') {
chipColor += 'A6E22D';
} else if (dataType === 'text-annotation') {
chipColor += '2FBBAB';
} else if (dataType === 'token') {
chipColor += '28B3D1';
} else {
chipColor = '';
}
// Creates a chip with the previously selected element. Is first created in the 'BuilderElement' and populated with an EventListener, then moved to 'yourQuery'.
let builderElement = document.createElement('div');
builderElement.innerHTML +=`
<div class='chip' ${chipColor}' data-type='${dataType}' data-query='${queryText}' draggable='true' style='cursor:pointer;' ondragstart='concordanceQueryBuilder.dragStartHandler(event)' ondragend='concordanceQueryBuilder.dragEndHandler(event)'>
${prettyText}
<i class='material-icons close'>close</i>
</div>
`.trim();
let buttonElement = builderElement.firstElementChild;
let buttonElement = Utils.elementFromString(
`
<div class='chip' data-type='${dataType}' data-query='${queryText}' draggable='true' style='cursor:pointer;' ondragstart='concordanceQueryBuilder.dragStartHandler(event)' ondragend='concordanceQueryBuilder.dragEndHandler(event)'>
${prettyText}
<i class='material-icons close'>close</i>
</div>
`
);
buttonElement.addEventListener('click', () => {this.deleteAttr(buttonElement);});
// Ensures that metadata is always at the end of the query:
@ -963,12 +946,6 @@ class ConcordanceQueryBuilder {
this.hideEverything();
}
}
//#endregion Structural Attribute Builder Functions
//#endregion Structural Attribute Builder Functions
}