Commit cdf1d8f6 authored by Anne Goloubkoff-Duponchel's avatar Anne Goloubkoff-Duponchel
Browse files

modif du js incomplet

parent fe603c57
......@@ -32,14 +32,17 @@ class ApparatPlugin extends Plugin{
}
wrapLacunas() {
if (document.querySelectorAll("#text .lacunaStart").length > 0) {
document.querySelectorAll('.lacunaStart').forEach((lstart) => {
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'));
endElement = endElement.length === 0 ? document.getElementById('bas_de_page') : endElement
// let endElement = document.getElementById(searchedId);
// console.log('traitement de la lacuna ' + lstart.getAttribute('id'));
// endElement = endElement.length === 0 ? document.getElementById('bas_de_page') : endElement
let endElement = document.querySelector("#" + searchedId);
endElement = endElement === null ? document.querySelector('#bas_de_page') : endElement
let eltsBetween = this.getElementsBetweenTree(lstart, endElement);//$(self.getElementsBetweenTree(($(this))[0], endElement[0]))
console.log("Nombre d'éléments à masquer (lacune " + lstart.getAttribute('id') + ")" + eltsBetween.length);
eltsBetween.forEach((elt) => {
......@@ -50,15 +53,30 @@ class ApparatPlugin extends Plugin{
span.append(elt.cloneNode(true));
elt.replaceWith(span);
})
})
})
}
else {
document.querySelectorAll('.lacunaEnd').forEach((lend) => {
let lstart = document.querySelector('#text')
let endElement = lend
let eltsBetween = this.getElementsBetweenTree(lstart, endElement);
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);
})
})
}
/*Cas où un couple lacunaStart/lacunaEnd se trouve respectivement dans
des fragments qui précédent et suivent le fragment courant:
nécessite une requête sur la DB pour accedéer aux autres noeuds XML*/
}
getElementsBetweenTree(start, end) {
let ancestor = this.commonAncestor(start, end);
......
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