From 2a1341b910dfb1187dd9fceebd2b3be14e825e28 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 28 Apr 2023 19:02:23 +0000 Subject: update bootstrap --- vendor/twbs/bootstrap/site/assets/js/snippets.js | 33 ++++++++++++++---------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'vendor/twbs/bootstrap/site/assets/js/snippets.js') diff --git a/vendor/twbs/bootstrap/site/assets/js/snippets.js b/vendor/twbs/bootstrap/site/assets/js/snippets.js index 43b8a095c..66c7a005c 100644 --- a/vendor/twbs/bootstrap/site/assets/js/snippets.js +++ b/vendor/twbs/bootstrap/site/assets/js/snippets.js @@ -6,8 +6,7 @@ /*! * JavaScript for Bootstrap's docs (https://getbootstrap.com/) - * Copyright 2011-2022 The Bootstrap Authors - * Copyright 2011-2022 Twitter, Inc. + * Copyright 2011-2023 The Bootstrap Authors * Licensed under the Creative Commons Attribution 3.0 Unported License. * For details, see https://creativecommons.org/licenses/by/3.0/. */ @@ -20,7 +19,7 @@ // -------- // Tooltips // -------- - // Instantiate all tooltips in a docs or StackBlitz page + // Instantiate all tooltips in a docs or StackBlitz document.querySelectorAll('[data-bs-toggle="tooltip"]') .forEach(tooltip => { new bootstrap.Tooltip(tooltip) @@ -29,7 +28,7 @@ // -------- // Popovers // -------- - // Instantiate all popovers in a docs or StackBlitz page + // Instantiate all popovers in docs or StackBlitz document.querySelectorAll('[data-bs-toggle="popover"]') .forEach(popover => { new bootstrap.Popover(popover) @@ -50,7 +49,7 @@ }) } - // Instantiate all toasts in a docs page only + // Instantiate all toasts in docs pages only document.querySelectorAll('.bd-example .toast') .forEach(toastNode => { const toast = new bootstrap.Toast(toastNode, { @@ -60,24 +59,26 @@ toast.show() }) - // Instantiate all toasts in a docs page only + // 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', () => { - const toast = new bootstrap.Toast(toastLiveExample) - - toast.show() + toastBootstrap.show() }) } + // js-docs-end live-toast // ------------------------------- // Alerts // ------------------------------- - // Used in 'Show live toast' example in docs or StackBlitz - const alertPlaceholder = document.getElementById('liveAlertPlaceholder') - const alertTrigger = document.getElementById('liveAlertBtn') + // 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 = [ @@ -90,16 +91,18 @@ alertPlaceholder.append(wrapper) } + const alertTrigger = document.getElementById('liveAlertBtn') if (alertTrigger) { alertTrigger.addEventListener('click', () => { appendAlert('Nice, you triggered this alert message!', 'success') }) } + // js-docs-end live-alert // -------- // Carousels // -------- - // Instantiate all non-autoplaying carousels in a docs or StackBlitz page + // Instantiate all non-autoplaying carousels in docs or StackBlitz document.querySelectorAll('.carousel:not([data-bs-ride="carousel"])') .forEach(carousel => { bootstrap.Carousel.getOrCreateInstance(carousel) @@ -131,6 +134,7 @@ // Modal // ------------------------------- // Modal 'Varying modal content' example in docs and StackBlitz + // js-docs-start varying-modal-content const exampleModal = document.getElementById('exampleModal') if (exampleModal) { exampleModal.addEventListener('show.bs.modal', event => { @@ -138,6 +142,8 @@ const button = event.relatedTarget // Extract info from data-bs-* attributes const recipient = button.getAttribute('data-bs-whatever') + // If necessary, you could initiate an Ajax request here + // and then do the updating in a callback. // Update the modal's content. const modalTitle = exampleModal.querySelector('.modal-title') @@ -147,6 +153,7 @@ modalBodyInput.value = recipient }) } + // js-docs-end varying-modal-content // ------------------------------- // Offcanvas -- cgit v1.2.3