Module: Asciidoctor::Html::Popovers
- Defined in:
- lib/asciidoctor/html/popovers.rb
Overview
Configure the popovers for footnotes and citations.
Constant Summary collapse
- POPOVERS =
<<~JS (function() { const popovers = [] function initPopovers() { document.querySelectorAll('.btn-po[data-contentid]').forEach(el => { const id = el.dataset.contentid; let content = document.getElementById(id); if(content) { if(content.tagName == 'A') { // This is an anchor of a bibitem const bibItem = content.parentElement.cloneNode(true); bibItem.removeChild(bibItem.firstChild); // remove the anchor content = bibItem.innerHTML; } else { content = content.cloneNode(true); } popovers.push(new bootstrap.Popover(el, { content: content, html: true, sanitize: false })); } }); } addEventListener('click', e => { const match = e.target.closest('.btn-po[aria-describedby],.popover'); if(!match) { popovers.forEach(po => po.hide()); } }) MathJax.startup.promise.then(initPopovers); // Enable tooltips document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(el => { bootstrap.Tooltip.getOrCreateInstance(el); }); })(); JS