Commit fe603c57 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

Merge branch 'ag/pluginApparat' into 'dev'

correctif pour lacuna du plugin apparat

See merge request pdn-certic/MaX!84
parents f18a6530 d329cb01
......@@ -13,14 +13,15 @@ class ApparatPlugin extends Plugin{
document.querySelectorAll(".apparat-witnesses").forEach((e) => e.style.display = 'none');
return;
}
this.wrapLacunas();
this.showWitness("lem");
this.witnessTooltiping();
}
showWitness(witnessClass) {
document.querySelectorAll(".apparat").forEach((e) => e.style.display = 'none');
document.querySelectorAll("." + witnessClass).forEach((e) => e.style.display = 'inline');
this.hideLacunas(witnessClass);
document.querySelectorAll(".lacuna, ." + witnessClass).forEach((e) => e.style.display = 'inline');
document.querySelectorAll(".lacuna" + "."+witnessClass).forEach((e) => e.style.display = 'none');
}
witnessTooltiping() {
......@@ -30,17 +31,11 @@ class ApparatPlugin extends Plugin{
})
}
hideLacunas(witId) {
/*masque les lacunas à partir des lacunaStarts
- cherche la lacuneEnd correspondante
- Si la lacunaEnd n'existe pas (elle se trouve dans un autre fragment),
l'intégralité du texte suivant est masqué
*/
wrapLacunas() {
document.querySelectorAll('.lacunaStart').forEach((lstart) => {
if (lstart.getAttribute('data-lacuna-wit').indexOf('\#' + witId) > -1) {
//on echappe les . et # de l'id cible de la lacunaEnd correspondante
let searchedId = lstart.getAttribute('data-lacuna-synch');//.replace(/([#.])/g,'\\$1');
const wit = lstart.getAttribute('data-lacuna-wit').replace('#','');
console.log('wit->',wit);
let searchedId = lstart.getAttribute('data-lacuna-synch');
console.log("searchedid ", searchedId);
let endElement = document.getElementById(searchedId);
console.log('traitement de la lacuna ' + lstart.getAttribute('id'));
......@@ -50,10 +45,11 @@ class ApparatPlugin extends Plugin{
eltsBetween.forEach((elt) => {
let span = document.createElement("span");
span.classList.add('generated_lacuna');
span.classList.add('lacuna');
span.classList.add(wit);
span.append(elt.cloneNode(true));
elt.replaceWith(span);
})
}
})
......
......@@ -38,6 +38,10 @@ For conditions of distribution and use, see the accompanying legal.txt file.
</span>
</xsl:template>
<xsl:template match="//tei:witDetail">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="//tei:lacunaStart | //tei:lacunaEnd">
<span>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment