2012-01-28 00:36:37 -08:00
|
|
|
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
|
|
|
|
// IT'S ALL JUST JUNK FOR OUR DOCS!
|
|
|
|
// ++++++++++++++++++++++++++++++++++++++++++
|
2013-10-17 14:11:40 -07:00
|
|
|
|
2013-10-17 11:33:04 -07:00
|
|
|
/*!
|
2018-09-18 22:27:46 +03:00
|
|
|
* JavaScript for Bootstrap's docs (https://getbootstrap.com/)
|
2018-09-18 23:04:25 +03:00
|
|
|
* Copyright 2011-2018 Twitter, Inc.
|
2013-10-17 14:11:40 -07:00
|
|
|
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
|
2015-05-17 12:43:04 +03:00
|
|
|
* details, see https://creativecommons.org/licenses/by/3.0/.
|
2013-10-17 11:33:04 -07:00
|
|
|
*/
|
|
|
|
|
2018-09-22 10:53:23 +03:00
|
|
|
/* global ClipboardJS: false, anchors: false */
|
2011-12-21 18:42:43 -08:00
|
|
|
|
2012-01-28 00:36:37 -08:00
|
|
|
!function ($) {
|
2014-03-17 09:12:55 +02:00
|
|
|
'use strict';
|
2011-12-21 18:42:43 -08:00
|
|
|
|
2013-09-18 21:37:55 +03:00
|
|
|
$(function () {
|
2012-01-24 17:13:02 -08:00
|
|
|
|
2014-02-11 00:04:53 -08:00
|
|
|
// Scrollspy
|
2012-08-14 21:06:08 -07:00
|
|
|
var $window = $(window)
|
2013-07-28 22:23:20 -07:00
|
|
|
var $body = $(document.body)
|
2012-08-14 21:06:08 -07:00
|
|
|
|
2013-07-28 22:23:20 -07:00
|
|
|
$body.scrollspy({
|
2014-03-01 18:19:50 +02:00
|
|
|
target: '.bs-docs-sidebar'
|
2013-07-26 19:25:45 -07:00
|
|
|
})
|
2013-08-11 15:03:48 -07:00
|
|
|
$window.on('load', function () {
|
|
|
|
$body.scrollspy('refresh')
|
|
|
|
})
|
|
|
|
|
2014-02-11 00:04:53 -08:00
|
|
|
// Kill links
|
2016-05-26 15:37:25 +03:00
|
|
|
$('.bs-docs-container [href="#"]').click(function (e) {
|
2012-01-23 14:14:16 -08:00
|
|
|
e.preventDefault()
|
|
|
|
})
|
|
|
|
|
2014-02-11 00:04:53 -08:00
|
|
|
// Sidenav affixing
|
2013-05-08 21:56:08 -07:00
|
|
|
setTimeout(function () {
|
2014-02-12 11:02:37 -08:00
|
|
|
var $sideBar = $('.bs-docs-sidebar')
|
2013-07-25 23:30:13 -07:00
|
|
|
|
|
|
|
$sideBar.affix({
|
2013-05-08 21:56:08 -07:00
|
|
|
offset: {
|
2013-07-25 23:30:13 -07:00
|
|
|
top: function () {
|
|
|
|
var offsetTop = $sideBar.offset().top
|
|
|
|
var sideBarMargin = parseInt($sideBar.children(0).css('margin-top'), 10)
|
|
|
|
var navOuterHeight = $('.bs-docs-nav').height()
|
|
|
|
|
|
|
|
return (this.top = offsetTop - navOuterHeight - sideBarMargin)
|
2013-12-21 22:59:40 +02:00
|
|
|
},
|
|
|
|
bottom: function () {
|
2014-02-12 11:02:37 -08:00
|
|
|
return (this.bottom = $('.bs-docs-footer').outerHeight(true))
|
2013-07-25 23:30:13 -07:00
|
|
|
}
|
2013-05-08 21:56:08 -07:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}, 100)
|
2012-08-14 21:06:08 -07:00
|
|
|
|
2013-03-30 18:41:26 -07:00
|
|
|
setTimeout(function () {
|
2013-05-08 22:52:48 -07:00
|
|
|
$('.bs-top').affix()
|
2013-03-30 18:41:26 -07:00
|
|
|
}, 100)
|
|
|
|
|
2016-02-05 10:27:32 -08:00
|
|
|
// Theme toggler
|
2014-04-29 15:54:05 -07:00
|
|
|
;(function () {
|
2015-04-29 12:11:58 +03:00
|
|
|
var $stylesheetLink = $('#bs-theme-stylesheet')
|
|
|
|
var $themeBtn = $('.bs-docs-theme-toggle')
|
2014-06-27 02:08:58 +02:00
|
|
|
|
|
|
|
var activateTheme = function () {
|
2015-04-29 12:11:58 +03:00
|
|
|
$stylesheetLink.attr('href', $stylesheetLink.attr('data-href'))
|
|
|
|
$themeBtn.text('Disable theme preview')
|
2014-06-27 02:08:58 +02:00
|
|
|
localStorage.setItem('previewTheme', true)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (localStorage.getItem('previewTheme')) {
|
|
|
|
activateTheme()
|
|
|
|
}
|
|
|
|
|
2015-04-29 12:11:58 +03:00
|
|
|
$themeBtn.click(function () {
|
|
|
|
var href = $stylesheetLink.attr('href')
|
2014-04-29 15:56:18 -07:00
|
|
|
if (!href || href.indexOf('data') === 0) {
|
2014-06-27 02:08:58 +02:00
|
|
|
activateTheme()
|
|
|
|
} else {
|
2015-04-29 12:11:58 +03:00
|
|
|
$stylesheetLink.attr('href', '')
|
|
|
|
$themeBtn.text('Preview theme')
|
2014-06-27 02:08:58 +02:00
|
|
|
localStorage.removeItem('previewTheme')
|
2014-04-29 15:56:18 -07:00
|
|
|
}
|
2014-04-29 15:54:05 -07:00
|
|
|
})
|
|
|
|
})();
|
|
|
|
|
2014-02-11 00:04:53 -08:00
|
|
|
// Tooltip and popover demos
|
2012-06-05 18:25:46 -07:00
|
|
|
$('.tooltip-demo').tooltip({
|
2014-04-18 18:53:05 -07:00
|
|
|
selector: '[data-toggle="tooltip"]',
|
2013-09-18 19:50:02 +03:00
|
|
|
container: 'body'
|
2012-01-28 00:46:04 -08:00
|
|
|
})
|
2014-06-26 11:41:40 -07:00
|
|
|
$('.popover-demo').popover({
|
|
|
|
selector: '[data-toggle="popover"]',
|
|
|
|
container: 'body'
|
|
|
|
})
|
2012-01-26 16:12:34 -08:00
|
|
|
|
2014-06-26 10:52:12 -07:00
|
|
|
// Demos within modals
|
2012-01-28 12:08:41 -08:00
|
|
|
$('.tooltip-test').tooltip()
|
|
|
|
$('.popover-test').popover()
|
2012-01-28 00:46:04 -08:00
|
|
|
|
2014-07-15 16:57:25 -07:00
|
|
|
// Popover demos
|
2014-02-10 21:34:05 -08:00
|
|
|
$('.bs-docs-popover').popover()
|
|
|
|
|
2014-02-11 00:04:53 -08:00
|
|
|
// Button state demo
|
2014-10-26 06:17:05 +01:00
|
|
|
$('#loading-example-btn').on('click', function () {
|
2015-04-29 12:11:58 +03:00
|
|
|
var $btn = $(this)
|
|
|
|
$btn.button('loading')
|
2014-02-11 00:04:53 -08:00
|
|
|
setTimeout(function () {
|
2015-04-29 12:11:58 +03:00
|
|
|
$btn.button('reset')
|
2014-02-11 00:04:53 -08:00
|
|
|
}, 3000)
|
2014-02-10 21:34:05 -08:00
|
|
|
})
|
2012-01-28 00:46:04 -08:00
|
|
|
|
2014-11-03 13:37:27 -08:00
|
|
|
// Modal relatedTarget demo
|
|
|
|
$('#exampleModal').on('show.bs.modal', function (event) {
|
2015-04-29 12:11:58 +03:00
|
|
|
var $button = $(event.relatedTarget) // Button that triggered the modal
|
|
|
|
var recipient = $button.data('whatever') // Extract info from data-* attributes
|
2014-11-03 13:37:27 -08:00
|
|
|
// If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
|
|
|
|
// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
|
2015-04-29 12:11:58 +03:00
|
|
|
var $modal = $(this)
|
|
|
|
$modal.find('.modal-title').text('New message to ' + recipient)
|
|
|
|
$modal.find('.modal-body input').val(recipient)
|
2014-11-03 13:37:27 -08:00
|
|
|
})
|
|
|
|
|
2014-10-26 06:17:05 +01:00
|
|
|
// Activate animated progress bar
|
|
|
|
$('.bs-docs-activate-animated-progressbar').on('click', function () {
|
|
|
|
$(this).siblings('.progress').find('.progress-bar-striped').toggleClass('active')
|
|
|
|
})
|
2014-02-11 00:04:53 -08:00
|
|
|
|
2014-10-25 01:45:57 +03:00
|
|
|
// Insert copy to clipboard button before .highlight
|
2018-09-22 10:53:23 +03:00
|
|
|
$('figure.highlight, div.highlight').each(function () {
|
|
|
|
var btnHtml = '<div class="bs-clipboard"><button type="button" class="btn-clipboard" title="Copy to clipboard">Copy</button></div>'
|
2014-10-25 01:45:57 +03:00
|
|
|
$(this).before(btnHtml)
|
2018-09-22 10:53:23 +03:00
|
|
|
$('.btn-clipboard')
|
2014-01-08 17:32:35 +05:30
|
|
|
.tooltip()
|
2018-09-22 10:53:23 +03:00
|
|
|
.on('mouseleave', function () {
|
|
|
|
// Explicitly hide tooltip, since after clicking it remains
|
|
|
|
// focused (as it's a button), so tooltip would otherwise
|
|
|
|
// remain visible until focus is moved away
|
|
|
|
$(this).tooltip('hide')
|
|
|
|
})
|
|
|
|
})
|
2014-01-08 17:32:35 +05:30
|
|
|
|
2018-09-22 10:53:23 +03:00
|
|
|
var clipboard = new ClipboardJS('.btn-clipboard', {
|
|
|
|
target: function (trigger) {
|
|
|
|
return trigger.parentNode.nextElementSibling
|
|
|
|
}
|
|
|
|
})
|
2014-01-08 17:32:35 +05:30
|
|
|
|
2018-09-22 10:53:23 +03:00
|
|
|
clipboard.on('success', function (e) {
|
|
|
|
$(e.trigger)
|
|
|
|
.attr('title', 'Copied!')
|
|
|
|
.tooltip('fixTitle')
|
|
|
|
.tooltip('show')
|
|
|
|
.attr('title', 'Copy to clipboard')
|
|
|
|
.tooltip('fixTitle')
|
2015-04-28 14:57:27 +03:00
|
|
|
|
2018-09-22 10:53:23 +03:00
|
|
|
e.clearSelection()
|
2014-01-08 17:32:35 +05:30
|
|
|
})
|
|
|
|
|
2018-09-22 10:53:23 +03:00
|
|
|
clipboard.on('error', function (e) {
|
|
|
|
var modifierKey = /Mac/i.test(navigator.userAgent) ? '\u2318' : 'Ctrl-'
|
|
|
|
var fallbackMsg = 'Press ' + modifierKey + 'C to copy'
|
|
|
|
|
|
|
|
$(e.trigger)
|
|
|
|
.attr('title', fallbackMsg)
|
|
|
|
.tooltip('fixTitle')
|
|
|
|
.tooltip('show')
|
|
|
|
.attr('title', 'Copy to clipboard')
|
|
|
|
.tooltip('fixTitle')
|
2014-01-08 17:32:35 +05:30
|
|
|
})
|
|
|
|
|
2013-09-18 21:37:55 +03:00
|
|
|
})
|
2012-01-28 00:36:37 -08:00
|
|
|
|
2013-11-26 08:43:26 +01:00
|
|
|
}(jQuery)
|
2014-10-28 23:50:22 +02:00
|
|
|
|
|
|
|
;(function () {
|
|
|
|
'use strict';
|
2015-04-29 12:11:58 +03:00
|
|
|
|
2015-05-15 00:37:07 -04:00
|
|
|
anchors.options.placement = 'left';
|
|
|
|
anchors.add('.bs-docs-section > h1, .bs-docs-section > h2, .bs-docs-section > h3, .bs-docs-section > h4, .bs-docs-section > h5')
|
2014-10-28 23:50:22 +02:00
|
|
|
})();
|