// NOTICE!!! Initially embedded in our docs this JavaScript // file contains elements that can help you create reproducible // use cases in StackBlitz for instance. // In a real project please adapt this content to your needs. // ++++++++++++++++++++++++++++++++++++++++++ /*! * JavaScript for Bootstrap's docs (https://getbootstrap.com/) * Copyright 2011-2024 The Bootstrap Authors * Licensed under the Creative Commons Attribution 3.0 Unported License. * For details, see https://creativecommons.org/licenses/by/3.0/. */ /* global bootstrap: false */ (() => { 'use strict' // -------- // Tooltips // -------- // Instantiate all tooltips in a docs or StackBlitz document.querySelectorAll('[data-bs-toggle="tooltip"]') .forEach(tooltip => { new bootstrap.Tooltip(tooltip) }) // -------- // Popovers // -------- // Instantiate all popovers in docs or StackBlitz document.querySelectorAll('[data-bs-toggle="popover"]') .forEach(popover => { new bootstrap.Popover(popover) }) // ------------------------------- // Toasts // ------------------------------- // Used by 'Placement' example in docs or StackBlitz const toastPlacement = document.getElementById('toastPlacement') if (toastPlacement) { document.getElementById('selectToastPlacement').addEventListener('change', function () { if (!toastPlacement.dataset.originalClass) { toastPlacement.dataset.originalClass = toastPlacement.className } toastPlacement.className = `${toastPlacement.dataset.originalClass} ${this.value}` }) } // Instantiate all toasts in docs pages only document.querySelectorAll('.bd-example .toast') .forEach(toastNode => { const toast = new bootstrap.Toast(toastNode, { autohide: false }) toast.show() }) // Instantiate all toasts in docs pages only // js-docs-start live-toast const toastTrigger = document.getElementById('liveToastBtn') const toastLiveExample = document.getElementById('liveToast') if (toastTrigger) { const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample) toastTrigger.addEventListener('click', () => { toastBootstrap.show() }) } // js-docs-end live-toast // ------------------------------- // Alerts // ------------------------------- // Used in 'Show live alert' example in docs or StackBlitz // js-docs-start live-alert const alertPlaceholder = document.getElementById('liveAlertPlaceholder') const appendAlert = (message, type) => { const wrapper = document.createElement('div') wrapper.innerHTML = [ `