Commit d602533f authored by Edith Cannet's avatar Edith Cannet Committed by Jerome Chauveau
Browse files

import TEI màj : tableaux collapsibles, gestion des cas de figures (tableaux, images) sans titre

parent 4c5d4598
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ window.addEventListener('DOMContentLoaded', (event) => {
    initializeCollapsibleLists();
    
    // open new windows
    //openFigureWindow(); 
    openFigureWindow(elementId); 

    //toc hightlighing on scroll
    document.querySelector('.left-contents').addEventListener("scroll", () => {
@@ -160,20 +160,26 @@ function scrollToElementById(elementId) {
	for (let i = 0; i<figTables.length; i++ ) {

    let labels = figTables[i].getElementsByTagName("label");
    let expand = figTables[i].getElementsByClassName("expand");    

    labels[0].setAttribute('onclick', "afficheTableau('"+i+"');");
    expand[0].setAttribute('onclick', "afficheTableau('"+i+"');");
    }    
}


function afficheTableau(numero) {
    let tableCourante = figTables[numero].getElementsByTagName("table")[0];
    let label = figTables[numero].getElementsByTagName("label")[0];
    let triangle = figTables[numero].getElementsByClassName("expand")[0]; 
    
    if (tableCourante.style.display === 'none' || tableCourante.style.display === '') {
        tableCourante.style.display = 'table'; 
        tableCourante.style.backgroundColor = 'white';
        triangle.textContent = "";
    } else {
        tableCourante.style.display = 'none';
        triangle.textContent = ""; 
    }
}

@@ -228,7 +234,8 @@ function openFigureWindow(elementId) {
            margin: 25px 0px;
        }
      label {background-color: #454545;width:90%;}
      table {
      span.expand {display:none;}
      table, img {
            max-width:90%
        }
      td,th {
@@ -266,6 +273,13 @@ function openFigureWindow(elementId) {
    // Clone the element to the new window's document
    const clonedElement = elementToClone.cloneNode(true);

    // Ensure that the cloned table is always visible
    const tableInClone = clonedElement.querySelector('table');
    if (tableInClone) {
        // If a table exists, set its display style to 'table'
        tableInClone.style.display = 'table';
    }

    // Append the cloned element to the new window's document body
    newWindowDocument.body.appendChild(clonedElement);
  }
+27 −3
Original line number Diff line number Diff line
@@ -258,8 +258,6 @@ img {
.fig-call-window,
.fig-call-window a,
.fig-call-window a:visited,
/*.figure-call
.table-call,*/
.table-call-window,
.table-call-window a,
.table-call-window a:visited {
@@ -269,12 +267,18 @@ img {

.table-call-window {
    position: relative;
/*    background-color: red;*/
    top: -10px;
    left: 355px;
    margin-top: -26px;
}

/* right pane */
div[id='figures'] figure {
    border-bottom:1px solid var(--grey-color); 
    padding-bottom: 30px;
    background-color: inherit;
}

/****** formula ******/
.fig-formula {
    background-color:white;
@@ -312,6 +316,26 @@ td,th {
    padding: 10px;
    margin: 0;
    cursor: pointer;
    padding-left: 1em;
    max-width: 80%;
}

.expand {
    color: var(--third-color);
    text-decoration: none;
    position: relative;
    right: 45%;
    top: 37px;
    margin-top: -27px;
}

span[class='expand empty'] {
    color: var(--third-color);
    text-decoration: none;
    position: relative;
    right: 45%;
    top: 20px;
    margin-top: -27px;
}

.credits {
+25 −1
Original line number Diff line number Diff line
@@ -544,6 +544,22 @@
        </img>
    </xsl:template>
    
 
    <xsl:template match="tei:graphic[parent::tei:figure[not(child::tei:head)]]">
        <label class="generated">
            <span class="fig-call" data-target="{parent::tei:figure/@xml:id}">[Ill.]</span>
            <span class="fig-call-window">
            <a href="#" id="openFigureLink">
                <xsl:attribute name="onclick">
                    <xsl:value-of select='concat("openFigureWindow&#40;&apos;",parent::tei:figure/@xml:id,"&apos;&#41;")'/>
                </xsl:attribute>
                <xsl:text></xsl:text>
                </a>
            </span>
        </label>
    </xsl:template>
 
    
    <xsl:template match="tei:p[@rend='caption' or @rend='credits']">
        <p class="{@rend}">
            <xsl:apply-templates/>
@@ -559,10 +575,18 @@
        
    <xsl:template match="tei:table">
        <xsl:if test="parent::tei:figure/tei:head">
            <span class="expand"><xsl:text></xsl:text></span>
            <label><!--span class="table-call"><xsl:text> ↓ </xsl:text></span--><xs:apply-templates select="parent::tei:figure/tei:head" mode="titleUp"/><!--span class="table-call"><xsl:text> ↓ </xsl:text></span--></label>
            <span class="table-call-window"><a href="#" id="openFigureLink">
                <xsl:attribute name="onclick"><xsl:value-of select='concat("openFigureWindow&#40;&apos;main-",parent::tei:figure/@xml:id,"&apos;&#41;")'/></xsl:attribute>
<!--                ="openFigureWindow('main-figure1')">-->
                <xsl:text></xsl:text></a></span>
        </xsl:if>
        <xsl:if test="parent::tei:figure[not(child::tei:head)]">
            <span class="expand empty"><xsl:text></xsl:text>
            </span>
            <label class="generated"/>
            <span class="table-call-window"><a href="#" id="openFigureLink">
                <xsl:attribute name="onclick"><xsl:value-of select='concat("openFigureWindow&#40;&apos;main-",parent::tei:figure/@xml:id,"&apos;&#41;")'/></xsl:attribute>
                <xsl:text></xsl:text></a></span>
        </xsl:if>
        <table>