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

modif du js incomplet

parent fe603c57
Loading
Loading
Loading
Loading
+24 −6
Original line number Diff line number Diff line
@@ -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) => {
@@ -51,7 +54,22 @@ class ApparatPlugin extends Plugin{
                    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: