diff options
Diffstat (limited to 'vendor/twbs/bootstrap/site/assets/js/application.js')
-rw-r--r-- | vendor/twbs/bootstrap/site/assets/js/application.js | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/vendor/twbs/bootstrap/site/assets/js/application.js b/vendor/twbs/bootstrap/site/assets/js/application.js index 6ff316056..acf859764 100644 --- a/vendor/twbs/bootstrap/site/assets/js/application.js +++ b/vendor/twbs/bootstrap/site/assets/js/application.js @@ -58,6 +58,22 @@ }) } + var alertPlaceholder = document.getElementById('liveAlertPlaceholder') + var alertTrigger = document.getElementById('liveAlertBtn') + + function alert(message, type) { + var wrapper = document.createElement('div') + wrapper.innerHTML = '<div class="alert alert-' + type + ' alert-dismissible" role="alert">' + message + '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button></div>' + + alertPlaceholder.append(wrapper) + } + + if (alertTrigger) { + alertTrigger.addEventListener('click', function () { + alert('Nice, you triggered this alert message!', 'success') + }) + } + // Demos within modals document.querySelectorAll('.tooltip-test') .forEach(function (tooltip) { @@ -78,8 +94,8 @@ // Disable empty links in docs examples document.querySelectorAll('.bd-content [href="#"]') .forEach(function (link) { - link.addEventListener('click', function (e) { - e.preventDefault() + link.addEventListener('click', function (event) { + event.preventDefault() }) }) @@ -101,17 +117,6 @@ }) } - // Activate animated progress bar - var btnToggleAnimatedProgress = document.getElementById('btnToggleAnimatedProgress') - if (btnToggleAnimatedProgress) { - btnToggleAnimatedProgress.addEventListener('click', function () { - btnToggleAnimatedProgress.parentNode - .querySelector('.progress-bar-striped') - .classList - .toggle('progress-bar-animated') - }) - } - // Insert copy to clipboard button before .highlight var btnHtml = '<div class="bd-clipboard"><button type="button" class="btn-clipboard" title="Copy to clipboard">Copy</button></div>' document.querySelectorAll('div.highlight') @@ -137,25 +142,25 @@ } }) - clipboard.on('success', function (e) { - var tooltipBtn = bootstrap.Tooltip.getInstance(e.trigger) + clipboard.on('success', function (event) { + var tooltipBtn = bootstrap.Tooltip.getInstance(event.trigger) - e.trigger.setAttribute('data-bs-original-title', 'Copied!') + event.trigger.setAttribute('data-bs-original-title', 'Copied!') tooltipBtn.show() - e.trigger.setAttribute('data-bs-original-title', 'Copy to clipboard') - e.clearSelection() + event.trigger.setAttribute('data-bs-original-title', 'Copy to clipboard') + event.clearSelection() }) - clipboard.on('error', function (e) { + clipboard.on('error', function (event) { var modifierKey = /mac/i.test(navigator.userAgent) ? '\u2318' : 'Ctrl-' var fallbackMsg = 'Press ' + modifierKey + 'C to copy' - var tooltipBtn = bootstrap.Tooltip.getInstance(e.trigger) + var tooltipBtn = bootstrap.Tooltip.getInstance(event.trigger) - e.trigger.setAttribute('data-bs-original-title', fallbackMsg) + event.trigger.setAttribute('data-bs-original-title', fallbackMsg) tooltipBtn.show() - e.trigger.setAttribute('data-bs-original-title', 'Copy to clipboard') + event.trigger.setAttribute('data-bs-original-title', 'Copy to clipboard') }) anchors.options = { |