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
Loading
Loading
Loading
Loading
+9 −13
Original line number Diff line number Diff line
@@ -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);
                })
            }
        })


+4 −0
Original line number Diff line number Diff line
@@ -39,6 +39,10 @@ For conditions of distribution and use, see the accompanying legal.txt file.

    </xsl:template>

    <xsl:template match="//tei:witDetail">
      <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="//tei:lacunaStart | //tei:lacunaEnd">    
      <span>
        <xsl:attribute name='class'>