]>
git.ipfire.org Git - ipfire.org.git/blob - src/scss/bootstrap-4.0.0-alpha.6/docs/assets/js/src/application.js
1 // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2 // IT'S ALL JUST JUNK FOR OUR DOCS!
3 // ++++++++++++++++++++++++++++++++++++++++++
6 * JavaScript for Bootstrap's docs (https://getbootstrap.com)
7 * Copyright 2011-2017 The Bootstrap Authors
8 * Copyright 2011-2017 Twitter, Inc.
9 * Licensed under the Creative Commons Attribution 3.0 Unported License. For
10 * details, see https://creativecommons.org/licenses/by/3.0/.
13 /* global Clipboard, anchors */
20 // Tooltip and popover demos
21 $('.tooltip-demo').tooltip({
22 selector
: '[data-toggle="tooltip"]',
26 $('[data-toggle="popover"]').popover()
28 // Demos within modals
29 $('.tooltip-test').tooltip()
30 $('.popover-test').popover()
32 // Indeterminate checkbox example
33 $('.bd-example-indeterminate [type="checkbox"]').prop('indeterminate', true)
35 // Disable empty links in docs examples
36 $('.bd-content [href="#"]').click(function (e
) {
40 // Modal relatedTarget demo
41 $('#exampleModal').on('show.bs.modal', function (event
) {
42 var $button
= $(event
.relatedTarget
) // Button that triggered the modal
43 var recipient
= $button
.data('whatever') // Extract info from data-* attributes
44 // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
45 // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
47 $modal
.find('.modal-title').text('New message to ' + recipient
)
48 $modal
.find('.modal-body input').val(recipient
)
51 // Activate animated progress bar
52 $('.bd-toggle-animated-progress').on('click', function () {
53 $(this).siblings('.progress').find('.progress-bar-striped').toggleClass('progress-bar-animated')
56 // Insert copy to clipboard button before .highlight
57 $('.highlight').each(function () {
58 var btnHtml
= '<div class="bd-clipboard"><span class="btn-clipboard" title="Copy to clipboard">Copy</span></div>'
59 $(this).before(btnHtml
)
60 $('.btn-clipboard').tooltip()
63 var clipboard
= new Clipboard('.btn-clipboard', {
64 target: function (trigger
) {
65 return trigger
.parentNode
.nextElementSibling
69 clipboard
.on('success', function (e
) {
71 .attr('title', 'Copied!')
74 .attr('title', 'Copy to clipboard')
80 clipboard
.on('error', function (e
) {
81 var modifierKey
= /Mac/i.test(navigator
.userAgent
) ? '\u2318' : 'Ctrl-'
82 var fallbackMsg
= 'Press ' + modifierKey
+ 'C to copy'
85 .attr('title', fallbackMsg
)
88 .attr('title', 'Copy to clipboard')
99 anchors
.options
.placement
= 'left'
100 anchors
.add('.bd-content > h1, .bd-content > h2, .bd-content > h3, .bd-content > h4, .bd-content > h5')