Commit cb59104a authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Amélioration affichage des tooltip (jquery)

parent 2256a85b
Loading
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -45,12 +45,22 @@ $useHistorisee = (isset($options['historise']) AND $options['historise'] === tru
        ?>
    <?php endforeach; ?>

    function stripAbbr(html)
    {
        // let tmp = document.createElement("DIV");
        // tmp.innerHTML = html;
        // return tmp.textContent || tmp.innerText || "";

        let txt = html.replace(/(&lt;([^>]+)>)/gi, "");
        return txt;
    }

    function display_definition(text) {
        let definition = dictionnary[text.toLowerCase()];
        if (definition === undefined) {
            definition = "Aucune définition pour ce terme.";
            // return text;
        }
        return "<abbr title='"+definition+"' data-toggle='tooltip' data-html='true'>" + text + "</abbr>";
        let stripped = stripAbbr(definition);
        return stripped;
    }
</script>
 No newline at end of file
+4 −1
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@ $this->headTitle("Glossaire");

<script>
    $("abbr").each(function() {
        $(this).html(display_definition($(this).text()));
        let text = display_definition($(this).text());
        $(this).attr('data-bs-title', text);
        $(this).attr('data-bs-toggle', 'tooltip');
        $(this).attr('data-bs-html', true);
    });
</script>
 No newline at end of file