1 // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2 // IT'S ALL JUST JUNK FOR OUR DOCS!
3 // ++++++++++++++++++++++++++++++++++++++++++
9 var $window = $(window)
11 var navHeight = $('.navbar').outerHeight(true) + 10
13 $(document.body).scrollspy({
14 target: '.bs-sidebar',
18 $('[href=#]').click(function (e) {
22 $(document.body).on('click', '.bs-sidenav [href^=#]', function (e) {
23 var $target = $(this.getAttribute('href'))
25 e.preventDefault() // prevent browser scroll
27 document.body.scrollTop =
28 $target.offset().top -
29 navHeight + 5 // offset scroll by nav
33 setTimeout(function () {
34 var $sideBar = $('.bs-sidebar')
39 var offsetTop = $sideBar.offset().top
40 var sideBarMargin = parseInt($sideBar.children(0).css('margin-top'), 10)
41 var navOuterHeight = $('.bs-docs-nav').height()
43 return (this.top = offsetTop - navOuterHeight - sideBarMargin)
45 , bottom: function () {
46 return (this.bottom = $('.bs-footer').outerHeight(true))
52 setTimeout(function () {
57 $('.tooltip-demo').tooltip({
58 selector: "[data-toggle=tooltip]"
61 $('.tooltip-test').tooltip()
62 $('.popover-test').popover()
64 $('.bs-docs-navbar').tooltip({
65 selector: "a[data-toggle=tooltip]",
66 container: ".bs-docs-navbar .nav"
70 $("[data-toggle=popover]")
78 setTimeout(function () {
84 $('.bs-docs-carousel-example').carousel()
86 // javascript build logic
87 var inputsComponent = $("#less input")
88 , inputsPlugin = $("#plugins input")
89 , inputsVariables = $("#less-variables input")
91 // toggle all plugin checkboxes
92 $('#less .toggle').on('click', function (e) {
94 inputsComponent.prop('checked', !inputsComponent.is(':checked'))
97 $('#plugins .toggle').on('click', function (e) {
99 inputsPlugin.prop('checked', !inputsPlugin.is(':checked'))
102 $('#less-variables .toggle').on('click', function (e) {
104 inputsVariables.val('')
107 // request built javascript
108 $('.bs-customize-download .btn').on('click', function (e) {
111 var css = $("#less input:checked")
112 .map(function () { return this.value })
114 , js = $("#plugins input:checked")
115 .map(function () { return this.value })
119 $("#less-variables input")
121 $(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
126 , url: /localhost/.test(window.location) ? 'http://localhost:9001' : 'http://bootstrap.herokuapp.com'
137 // Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
138 $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
142 send: function(_, completeCallback) {
143 var name = 'jQuery_iframe_' + jQuery.now()
146 iframe = $('<iframe>')
151 .attr('method', opts.type) // GET or POST
153 .attr('target', name)
155 $.each(opts.params, function(k, v) {
158 .attr('type', 'hidden')
160 .attr('value', typeof v == 'string' ? v : JSON.stringify(v))
164 form.appendTo('body').submit()