2012-01-28 08:36:37 +00:00
|
|
|
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
|
|
|
|
|
// IT'S ALL JUST JUNK FOR OUR DOCS!
|
|
|
|
|
// ++++++++++++++++++++++++++++++++++++++++++
|
2013-10-17 21:11:40 +00:00
|
|
|
|
2013-10-17 18:33:04 +00:00
|
|
|
/*!
|
2014-01-14 05:58:27 +00:00
|
|
|
* JavaScript for Bootstrap's docs (http://getbootstrap.com)
|
2014-01-07 00:05:24 +00:00
|
|
|
* Copyright 2011-2014 Twitter, Inc.
|
2013-10-17 21:11:40 +00:00
|
|
|
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
|
|
|
|
|
* details, see http://creativecommons.org/licenses/by/3.0/.
|
2013-10-17 18:33:04 +00:00
|
|
|
*/
|
|
|
|
|
|
2014-10-28 21:50:22 +00:00
|
|
|
/* global ZeroClipboard, addAnchors */
|
2011-12-22 02:42:43 +00:00
|
|
|
|
2012-01-28 08:36:37 +00:00
|
|
|
!function ($) {
|
2014-03-17 07:12:55 +00:00
|
|
|
'use strict';
|
2011-12-22 02:42:43 +00:00
|
|
|
|
2013-09-18 18:37:55 +00:00
|
|
|
$(function () {
|
2012-01-25 01:13:02 +00:00
|
|
|
|
2014-02-11 08:04:53 +00:00
|
|
|
// Scrollspy
|
2012-08-15 04:06:08 +00:00
|
|
|
var $window = $(window)
|
2013-07-29 05:23:20 +00:00
|
|
|
var $body = $(document.body)
|
2012-08-15 04:06:08 +00:00
|
|
|
|
2013-07-29 05:23:20 +00:00
|
|
|
$body.scrollspy({
|
2014-03-01 16:19:50 +00:00
|
|
|
target: '.bs-docs-sidebar'
|
2013-07-27 02:25:45 +00:00
|
|
|
})
|
2013-08-11 22:03:48 +00:00
|
|
|
$window.on('load', function () {
|
|
|
|
|
$body.scrollspy('refresh')
|
|
|
|
|
})
|
|
|
|
|
|
2014-02-11 08:04:53 +00:00
|
|
|
// Kill links
|
2013-07-29 05:14:43 +00:00
|
|
|
$('.bs-docs-container [href=#]').click(function (e) {
|
2012-01-23 22:14:16 +00:00
|
|
|
e.preventDefault()
|
|
|
|
|
})
|
|
|
|
|
|
2014-02-11 08:04:53 +00:00
|
|
|
// Sidenav affixing
|
2013-05-09 04:56:08 +00:00
|
|
|
setTimeout(function () {
|
2014-02-12 19:02:37 +00:00
|
|
|
var $sideBar = $('.bs-docs-sidebar')
|
2013-07-26 06:30:13 +00:00
|
|
|
|
|
|
|
|
$sideBar.affix({
|
2013-05-09 04:56:08 +00:00
|
|
|
offset: {
|
2013-07-26 06:30:13 +00: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 20:59:40 +00:00
|
|
|
},
|
|
|
|
|
bottom: function () {
|
2014-02-12 19:02:37 +00:00
|
|
|
return (this.bottom = $('.bs-docs-footer').outerHeight(true))
|
2013-07-26 06:30:13 +00:00
|
|
|
}
|
2013-05-09 04:56:08 +00:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}, 100)
|
2012-08-15 04:06:08 +00:00
|
|
|
|
2013-03-31 01:41:26 +00:00
|
|
|
setTimeout(function () {
|
2013-05-09 05:52:48 +00:00
|
|
|
$('.bs-top').affix()
|
2013-03-31 01:41:26 +00:00
|
|
|
}, 100)
|
|
|
|
|
|
2014-04-29 22:54:05 +00:00
|
|
|
// theme toggler
|
|
|
|
|
;(function () {
|
|
|
|
|
var stylesheetLink = $('#bs-theme-stylesheet')
|
2014-05-23 01:38:43 +00:00
|
|
|
var themeBtn = $('.bs-docs-theme-toggle')
|
2014-06-27 00:08:58 +00:00
|
|
|
|
|
|
|
|
var activateTheme = function () {
|
|
|
|
|
stylesheetLink.attr('href', stylesheetLink.attr('data-href'))
|
|
|
|
|
themeBtn.text('Disable theme preview')
|
|
|
|
|
localStorage.setItem('previewTheme', true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (localStorage.getItem('previewTheme')) {
|
|
|
|
|
activateTheme()
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-29 22:54:05 +00:00
|
|
|
themeBtn.click(function () {
|
2014-06-27 00:08:58 +00:00
|
|
|
var href = stylesheetLink.attr('href')
|
2014-04-29 22:56:18 +00:00
|
|
|
if (!href || href.indexOf('data') === 0) {
|
2014-06-27 00:08:58 +00:00
|
|
|
activateTheme()
|
|
|
|
|
} else {
|
2014-04-29 22:56:18 +00:00
|
|
|
stylesheetLink.attr('href', '')
|
2014-05-23 01:38:43 +00:00
|
|
|
themeBtn.text('Preview theme')
|
2014-06-27 00:08:58 +00:00
|
|
|
localStorage.removeItem('previewTheme')
|
2014-04-29 22:56:18 +00:00
|
|
|
}
|
2014-04-29 22:54:05 +00:00
|
|
|
})
|
|
|
|
|
})();
|
|
|
|
|
|
2014-02-11 08:04:53 +00:00
|
|
|
// Tooltip and popover demos
|
2012-06-06 01:25:46 +00:00
|
|
|
$('.tooltip-demo').tooltip({
|
2014-04-19 01:53:05 +00:00
|
|
|
selector: '[data-toggle="tooltip"]',
|
2013-09-18 16:50:02 +00:00
|
|
|
container: 'body'
|
2012-01-28 08:46:04 +00:00
|
|
|
})
|
2014-06-26 18:41:40 +00:00
|
|
|
$('.popover-demo').popover({
|
|
|
|
|
selector: '[data-toggle="popover"]',
|
|
|
|
|
container: 'body'
|
|
|
|
|
})
|
2012-01-27 00:12:34 +00:00
|
|
|
|
2014-06-26 17:52:12 +00:00
|
|
|
// Demos within modals
|
2012-01-28 20:08:41 +00:00
|
|
|
$('.tooltip-test').tooltip()
|
|
|
|
|
$('.popover-test').popover()
|
2012-01-28 08:46:04 +00:00
|
|
|
|
2014-07-15 23:57:25 +00:00
|
|
|
// Popover demos
|
2014-02-11 05:34:05 +00:00
|
|
|
$('.bs-docs-popover').popover()
|
|
|
|
|
|
2014-02-11 08:04:53 +00:00
|
|
|
// Button state demo
|
2014-10-26 05:17:05 +00:00
|
|
|
$('#loading-example-btn').on('click', function () {
|
2014-02-11 08:04:53 +00:00
|
|
|
var btn = $(this)
|
|
|
|
|
btn.button('loading')
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
btn.button('reset')
|
|
|
|
|
}, 3000)
|
2014-02-11 05:34:05 +00:00
|
|
|
})
|
2012-01-28 08:46:04 +00:00
|
|
|
|
2014-11-03 21:37:27 +00:00
|
|
|
// Modal relatedTarget demo
|
|
|
|
|
$('#exampleModal').on('show.bs.modal', function (event) {
|
|
|
|
|
var button = $(event.relatedTarget) // Button that triggered the modal
|
|
|
|
|
var recipient = button.data('whatever') // Extract info from data-* attributes
|
|
|
|
|
// 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.
|
|
|
|
|
var modal = $(this)
|
|
|
|
|
modal.find('.modal-title').text('New message to ' + recipient)
|
|
|
|
|
modal.find('.modal-body input').val(recipient)
|
|
|
|
|
})
|
|
|
|
|
|
2014-10-26 05:17:05 +00: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 08:04:53 +00:00
|
|
|
|
|
|
|
|
// Config ZeroClipboard
|
|
|
|
|
ZeroClipboard.config({
|
2014-03-20 05:26:37 +00:00
|
|
|
moviePath: '/assets/flash/ZeroClipboard.swf',
|
2014-02-11 08:04:53 +00:00
|
|
|
hoverClass: 'btn-clipboard-hover'
|
|
|
|
|
})
|
|
|
|
|
|
2014-10-24 22:45:57 +00:00
|
|
|
// Insert copy to clipboard button before .highlight
|
2014-03-17 05:42:05 +00:00
|
|
|
$('.highlight').each(function () {
|
2014-02-11 08:04:53 +00:00
|
|
|
var btnHtml = '<div class="zero-clipboard"><span class="btn-clipboard">Copy</span></div>'
|
2014-10-24 22:45:57 +00:00
|
|
|
$(this).before(btnHtml)
|
2014-02-11 08:04:53 +00:00
|
|
|
})
|
|
|
|
|
var zeroClipboard = new ZeroClipboard($('.btn-clipboard'))
|
|
|
|
|
var htmlBridge = $('#global-zeroclipboard-html-bridge')
|
2014-01-08 12:02:35 +00:00
|
|
|
|
|
|
|
|
// Handlers for ZeroClipboard
|
2014-03-17 05:42:05 +00:00
|
|
|
zeroClipboard.on('load', function () {
|
2014-01-08 12:02:35 +00:00
|
|
|
htmlBridge
|
2014-02-11 08:04:53 +00:00
|
|
|
.data('placement', 'top')
|
|
|
|
|
.attr('title', 'Copy to clipboard')
|
2014-01-08 12:02:35 +00:00
|
|
|
.tooltip()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Copy to clipboard
|
2014-03-17 05:42:05 +00:00
|
|
|
zeroClipboard.on('dataRequested', function (client) {
|
2014-01-08 12:02:35 +00:00
|
|
|
var highlight = $(this).parent().nextAll('.highlight').first()
|
|
|
|
|
client.setText(highlight.text())
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Notify copy success and reset tooltip title
|
2014-03-17 05:42:05 +00:00
|
|
|
zeroClipboard.on('complete', function () {
|
2014-01-08 12:02:35 +00:00
|
|
|
htmlBridge
|
2014-02-11 08:04:53 +00:00
|
|
|
.attr('title', 'Copied!')
|
2014-01-08 12:02:35 +00:00
|
|
|
.tooltip('fixTitle')
|
|
|
|
|
.tooltip('show')
|
2014-06-10 06:29:44 +00:00
|
|
|
.attr('title', 'Copy to clipboard')
|
2014-01-08 12:02:35 +00:00
|
|
|
.tooltip('fixTitle')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Notify copy failure
|
2014-03-17 05:42:05 +00:00
|
|
|
zeroClipboard.on('noflash wrongflash', function () {
|
2014-01-08 12:02:35 +00:00
|
|
|
htmlBridge
|
2014-02-11 08:04:53 +00:00
|
|
|
.attr('title', 'Flash required')
|
2014-01-08 12:02:35 +00:00
|
|
|
.tooltip('fixTitle')
|
|
|
|
|
.tooltip('show')
|
|
|
|
|
})
|
|
|
|
|
|
2013-09-18 18:37:55 +00:00
|
|
|
})
|
2012-01-28 08:36:37 +00:00
|
|
|
|
2013-11-26 07:43:26 +00:00
|
|
|
}(jQuery)
|
2014-10-28 21:50:22 +00:00
|
|
|
|
|
|
|
|
;(function () {
|
|
|
|
|
'use strict';
|
|
|
|
|
addAnchors('.bs-docs-container h1, .bs-docs-container h2, .bs-docs-container h3, .bs-docs-container h4, .bs-docs-container h5');
|
|
|
|
|
})();
|