From fbb7a6294e83bdbd3165b347e34756d637b43e65 Mon Sep 17 00:00:00 2001 From: Anthony Geourjon <anthony.geourjon@tetras-libre.fr> Date: Wed, 15 Jan 2025 21:55:17 +0100 Subject: [PATCH] Reuse bootstrap popover --- macao/assets/_custom.scss | 9 --------- macao/assets/custom.js | 23 ++++++++++++++++++----- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/macao/assets/_custom.scss b/macao/assets/_custom.scss index 9b6b074..a4faeaa 100644 --- a/macao/assets/_custom.scss +++ b/macao/assets/_custom.scss @@ -126,15 +126,6 @@ a.active { text-decoration: underline; } -.commentaireInfo { - padding: 10px; - border-radius: 10px; - background-color: var(--secondary-background-color); - border: 1px solid var(--macao-primary-color); - color: black; - max-width: 500px; -} - em:not(:has(strong)) { background-color: lightgray; diff --git a/macao/assets/custom.js b/macao/assets/custom.js index fa50416..e49595b 100644 --- a/macao/assets/custom.js +++ b/macao/assets/custom.js @@ -8,13 +8,26 @@ $(document).ready(function() { $('.book-header').show(); $('.commentaireInfo').hide(); - $('.commentaireInfo').prop('popover', 'auto'); - $('.commentaireInfoGroup').prop("hidden", false); + // $('.commentaireInfo').prop('popover', 'auto'); + $('.commentaireInfoGroup').show(); // Comment popover - $('[spanid]').addClass('comment-trigger').on('click', function() { - let spanid = $(this).attr('spanid'); - $("[commentaireid=" + spanid + "]").toggle(); + $('[spanid]').addClass('comment-trigger').each(function (){ + const spanid = $(this).attr('spanid'); + + if($("[commentaireid=" + spanid + "]").length !== 0) { + $(this).popover({ + trigger: 'click', + html: true, + placement: 'auto', + content: $("[commentaireid=" + spanid + "]") + }); + $("[commentaireid=" + spanid + "]").toggle() + } + }); + + $(document).on('click', function() { + $('[spanid]').popover('hide'); }); // Simplify th in td -- GitLab