mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Fix colors in corpus analysis
This commit is contained in:
parent
a65b1ff578
commit
f1ccda6ad7
@ -498,7 +498,8 @@ nopaque.corpus_analysis.ConcordanceExtension = class ConcordanceExtension {
|
||||
if (cpos !== firstCpos || pAttr.simple_pos !== 'PUNCT') {html += ' ';}
|
||||
// Add entity start
|
||||
if (isEntityStart) {
|
||||
html += `<span class="s-attr" data-cpos="${cpos}" data-id="${pAttr.ent}" data-s-attr-type="ent" data-s-attr-ent-type="${subcorpus.p.lookups.ent_lookup[pAttr.ent].type}">`;
|
||||
html += '<span class="s-attr" data-s-attr="ent">';
|
||||
html += `<span class="s-attr" data-cpos="${cpos}" data-id="${pAttr.ent}" data-s-attr="ent_type" data-s-attr-value="${subcorpus.p.lookups.ent_lookup[pAttr.ent].type}">`;
|
||||
}
|
||||
// Add pAttr
|
||||
html += `<span class="p-attr" data-cpos="${cpos}"></span>`;
|
||||
@ -506,6 +507,7 @@ nopaque.corpus_analysis.ConcordanceExtension = class ConcordanceExtension {
|
||||
if (isEntityEnd) {
|
||||
html += ` <span class="black-text hide new white ent-indicator" data-badge-caption="">${subcorpus.p.lookups.ent_lookup[pAttr.ent].type}</span>`;
|
||||
html += '</span>';
|
||||
html += '</span>';
|
||||
}
|
||||
}
|
||||
return html;
|
||||
@ -522,17 +524,18 @@ nopaque.corpus_analysis.ConcordanceExtension = class ConcordanceExtension {
|
||||
for (let pAttrElement of this.elements.subcorpusItems.querySelectorAll('.p-attr')) {
|
||||
pAttrElement.setAttribute('class', 'p-attr');
|
||||
}
|
||||
// Set basic styling on .s-attr[data-type="ent"] elements
|
||||
for (let entElement of this.elements.subcorpusItems.querySelectorAll('.s-attr[data-s-attr-type="ent"]')) {
|
||||
// Set basic styling on .s-attr[data-s-attr="ent_type"] elements
|
||||
for (let entElement of this.elements.subcorpusItems.querySelectorAll('.s-attr[data-s-attr="ent_type"]')) {
|
||||
entElement.querySelector('.ent-indicator').classList.add('hide');
|
||||
entElement.removeAttribute('style');
|
||||
// TODO: Check why this is here
|
||||
// entElement.removeAttribute('style');
|
||||
entElement.setAttribute('class', 's-attr');
|
||||
}
|
||||
}
|
||||
if (this.settings.textStyle >= 1) {
|
||||
// Set advanced styling on .s-attr[data-type="ent"] elements
|
||||
for (let entElement of this.elements.subcorpusItems.querySelectorAll('.s-attr[data-s-attr-type="ent"]')) {
|
||||
entElement.classList.add('chip');
|
||||
// Set advanced styling on .s-attr[data-s-attr="ent_type"] elements
|
||||
for (let entElement of this.elements.subcorpusItems.querySelectorAll('.s-attr[data-s-attr="ent_type"]')) {
|
||||
entElement.classList.add('chip', 's-attr-color');
|
||||
entElement.querySelector('.ent-indicator').classList.remove('hide');
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ nopaque.corpus_analysis.ReaderExtension = class ReaderExtension {
|
||||
this.clearCorpus();
|
||||
let item = this.data.corpus.p.items[0];
|
||||
this.elements.corpus.innerHTML += `
|
||||
<p>${this.cposRange2HTML(item[0], item[item.length - 1])}</p>
|
||||
<p>${this.cposRange2HTML(item[0], item[item.length - 1])}</p>
|
||||
`.trim();
|
||||
this.setTextStyle();
|
||||
this.setTokenRepresentation();
|
||||
@ -228,7 +228,8 @@ nopaque.corpus_analysis.ReaderExtension = class ReaderExtension {
|
||||
if (cpos !== firstCpos || pAttr.simple_pos !== 'PUNCT') {html += ' ';}
|
||||
// Add entity start
|
||||
if (isEntityStart) {
|
||||
html += `<span class="s-attr" data-cpos="${cpos}" data-id="${pAttr.ent}" data-s-attr-type="ent" data-s-attr-ent-type="${this.data.corpus.p.lookups.ent_lookup[pAttr.ent].type}">`;
|
||||
html += '<span class="s-attr" data-s-attr="ent">';
|
||||
html += `<span class="s-attr" data-cpos="${cpos}" data-id="${pAttr.ent}" data-s-attr="ent_type" data-s-attr-value="${this.data.corpus.p.lookups.ent_lookup[pAttr.ent].type}">`;
|
||||
}
|
||||
// Add pAttr
|
||||
html += `<span class="p-attr" data-cpos="${cpos}"></span>`;
|
||||
@ -236,6 +237,7 @@ nopaque.corpus_analysis.ReaderExtension = class ReaderExtension {
|
||||
if (isEntityEnd) {
|
||||
html += ` <span class="badge black-text hide new white ent-indicator" data-badge-caption="">${this.data.corpus.p.lookups.ent_lookup[pAttr.ent].type}</span>`;
|
||||
html += '</span>';
|
||||
html += '</span>';
|
||||
}
|
||||
}
|
||||
return html;
|
||||
@ -272,17 +274,18 @@ nopaque.corpus_analysis.ReaderExtension = class ReaderExtension {
|
||||
for (let pAttrElement of this.elements.corpus.querySelectorAll('.p-attr')) {
|
||||
pAttrElement.setAttribute('class', 'p-attr');
|
||||
}
|
||||
// Set basic styling on .s-attr[data-type="ent"] elements
|
||||
for (let entElement of this.elements.corpus.querySelectorAll('.s-attr[data-s-attr-type="ent"]')) {
|
||||
// Set basic styling on .s-attr[data-s-attr="ent_type"] elements
|
||||
for (let entElement of this.elements.corpus.querySelectorAll('.s-attr[data-s-attr="ent_type"]')) {
|
||||
entElement.querySelector('.ent-indicator').classList.add('hide');
|
||||
entElement.removeAttribute('style');
|
||||
// TODO: Check why this is here
|
||||
// entElement.removeAttribute('style');
|
||||
entElement.setAttribute('class', 's-attr');
|
||||
}
|
||||
}
|
||||
if (this.settings.textStyle >= 1) {
|
||||
// Set advanced styling on .s-attr[data-type="ent"] elements
|
||||
for (let entElement of this.elements.corpus.querySelectorAll('.s-attr[data-s-attr-type="ent"]')) {
|
||||
entElement.classList.add('chip');
|
||||
// Set advanced styling on .s-attr[data-s-attr="ent_type"] elements
|
||||
for (let entElement of this.elements.corpus.querySelectorAll('.s-attr[data-s-attr="ent_type"]')) {
|
||||
entElement.classList.add('chip', 's-attr-color');
|
||||
entElement.querySelector('.ent-indicator').classList.remove('hide');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user