Commit b20f9441 authored by Charles Bourdot's avatar Charles Bourdot
Browse files

màj ressources

parent 158dee93
Loading
Loading
Loading
Loading
+99 −10
Original line number Diff line number Diff line
const dict = {
    fr : {
        'toc' : 'Table des matières',
        'data' : 'Données',
        'refs': 'Références',
        'figures': 'Figures',
        'notes': 'Notes',
@@ -76,6 +77,7 @@ const dict = {
    },
    en: {
        'toc' : 'Table of contents',
        'data' : 'Data',
        'refs': 'References',
        'figures': 'Figures',
        'notes': 'Notes',
@@ -151,6 +153,7 @@ const dict = {
    },
    es: {
        'toc' : 'Índice',
        'data' : 'Datos',
        'refs': 'Referencias',
        'figures': 'Figuras',
        'notes': 'Notas',
@@ -250,6 +253,10 @@ window.addEventListener('DOMContentLoaded', (event) => {
    initialiseTableaux();
    
    initCitationCopy();

    // Appel fonction pour les indicateurs de scrollbar biblio
    initBibScrollIndicators();

    //toc hightlighing on scroll
    document.querySelector('.left-contents').addEventListener("scroll", () => {
        let scrollTop = document.querySelector('.left-contents').scrollTop;
@@ -321,9 +328,9 @@ function darkMode(bool) {
function bindFootnotesAndImages() {
    let figAppels = document.getElementsByClassName('fig-call');
    let notesAppels = document.getElementsByClassName('xref-call');
    let bibAppels = document.getElementsByClassName('bib-ref-call'); // ← AJOUT
    let bibAppels = document.getElementsByClassName('bib-ref-call');

    let tousLesAppels = [...figAppels, ...notesAppels, ...bibAppels]; // ← AJOUT
    let tousLesAppels = [...figAppels, ...notesAppels, ...bibAppels]; 

    for (let i = 0; i < tousLesAppels.length; i++) {
        let target = tousLesAppels[i].dataset.target;
@@ -339,7 +346,8 @@ function bindFootnotesAndImages() {
                openTab('figures');
                scrollToElementById(targetId);
            } else if (tousLesAppels[i].classList.contains('bib-ref-call')) {
                openTab('refs'); // ← ouvre l'onglet références
                openTab('refs'); 
                showBibOccurrences(targetId); 
            } else {
                openTab('refs');
            }
@@ -377,11 +385,97 @@ function scrollToElementById(elementId) {
}


////////////////////////////////////////////////////////////////////
//////    Indicateurs de scrollbar pour occurrences biblio  [XG] ///
////////////////////////////////////////////////////////////////////

let bibScrollTrack = null;
let bibScrollContainer = null;

function initBibScrollIndicators() {
    bibScrollContainer = document.querySelector('.left-contents');
    if (!bibScrollContainer) return;

    if (getComputedStyle(bibScrollContainer).position === 'static') {
        bibScrollContainer.style.position = 'relative';
    }

    bibScrollTrack = document.getElementById('bib-scroll-track');
    if (!bibScrollTrack) {
        bibScrollTrack = document.createElement('div');
        bibScrollTrack.id = 'bib-scroll-track';
        bibScrollTrack.style.cssText = `
            position: sticky;
            float: right;
            top: 0;
            right: 2px;
            width: 8px;
            height: 100%;
            pointer-events: none;
            z-index: 500;
        `;
        bibScrollContainer.appendChild(bibScrollTrack);
    }

    document.addEventListener('click', (e) => {
        const isBibCall = e.target.closest('.bib-ref-call');
        const isMarker = e.target.closest('.bib-scroll-marker');
        if (!isBibCall && !isMarker) {
            clearBibOccurrences();
        }
    });
}

function clearBibOccurrences() {
    if (bibScrollTrack) {
        bibScrollTrack.innerHTML = '';
    }
}

function showBibOccurrences(targetId) {
    if (!bibScrollTrack || !bibScrollContainer) return;

    clearBibOccurrences();

    const allCalls = document.querySelectorAll(
        `.bib-ref-call[data-target="${targetId}"]`
    );
    if (!allCalls.length) return;

    const scrollableHeight = bibScrollContainer.scrollHeight;

    allCalls.forEach((call) => {
        const offsetTop = call.getBoundingClientRect().top
            - bibScrollContainer.getBoundingClientRect().top
            + bibScrollContainer.scrollTop;

        const ratio = Math.min(Math.max(offsetTop / scrollableHeight, 0), 1);

        const marker = document.createElement('div');
        marker.className = 'bib-scroll-marker';
        marker.title = 'Aller à cette occurrence';
        marker.style.top = `${ratio * 100}%`;

        // Navigation directe vers l'occurrence au clic sur le repère
        marker.addEventListener('click', (e) => {
            e.stopPropagation();
            call.scrollIntoView({ block: 'center', behavior: 'smooth' });
            document.querySelectorAll('.bib-ref-call').forEach(
                (c) => c.classList.remove('focus')
            );
            call.classList.add('focus');
        });

        bibScrollTrack.appendChild(marker);
    });
}


////////////////////////////////////////////////
//////    Fonctions pour les tables   [XG]   ///
////////////////////////////////////////////////

// [EC 4/9/23] table collapsible – v. draft - version XG - même effet, approche différente.
// [EC 4/9/23] table collapsible – v. draft - version XG - même effet, approche différente.

	let figTables;

@@ -581,7 +675,6 @@ function toggleFiguresFilter() {
  const articleWrap = document.querySelector('.article-wrap');
  const btn = document.getElementById('btn-filter-figures');

  // Si déjà actif → simple désactivation
  if (btn.classList.contains('active')) {
    btn.classList.remove('active');
    articleWrap.querySelectorAll('*').forEach(el => el.style.removeProperty('display'));
@@ -592,7 +685,7 @@ function toggleFiguresFilter() {
  deactivateAllFilters('btn-filter-figures');
  btn.classList.add('active');

  articleWrap.querySelectorAll('p, table.linguistic, ul.index-unordered, h1, h2, h3').forEach(el => {
  articleWrap.querySelectorAll('p:not(table p), table.linguistic, ul.index-unordered, h1, h2, h3, h4, a').forEach(el => {
    el.style.display = 'none';
  });
  articleWrap.querySelectorAll('section').forEach(el => {
@@ -615,7 +708,6 @@ function toggleMetadataFilter() {
  const articleWrap = document.querySelector('.article-wrap');
  const btn = document.getElementById('btn-filter-metadata');

  // Si déjà actif → simple désactivation
  if (btn.classList.contains('active')) {
    btn.classList.remove('active');
    const injected = document.getElementById('injected-metadata');
@@ -624,7 +716,6 @@ function toggleMetadataFilter() {
    return;
  }

  // Désactiver les autres filtres puis activer celui-ci
  deactivateAllFilters('btn-filter-metadata');
  btn.classList.add('active');

@@ -659,7 +750,6 @@ async function toggleBibliometrics() {
    return;
  }

  // Désactiver les autres filtres puis activer celui-ci
  deactivateAllFilters('btn-filter-bibliometrics');
  btn.classList.add('active');

@@ -667,7 +757,6 @@ async function toggleBibliometrics() {
    el.style.display = 'none';
  });

  // Créer le bloc injecté (ou le ré-afficher si déjà créé)
  let injected = document.getElementById('injected-bibliometrics');
  if (injected) {
    injected.style.display = 'block';
+5 −5
Original line number Diff line number Diff line
@@ -1842,7 +1842,7 @@
                                            <xsl:text>openFigureWindow('</xsl:text>
                                            <xsl:if test="child::tei:table">main-</xsl:if>
                                            <xsl:value-of select="@xml:id"/>
                                            <xsl:text>')</xsl:text>
                                            <xsl:text>'); return false;</xsl:text>
                                        </xsl:attribute>
                                        <img src="https://img.icons8.com/?size=100&amp;id=60664&amp;format=png&amp;color=0A84FF" 
                                             alt="ouvrir"