1 // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2 // IT'S ALL JUST JUNK FOR OUR DOCS!
3 // ++++++++++++++++++++++++++++++++++++++++++
9 var $window = $(window)
11 // Disable certain links in docs
12 $('section [href^=#]').click(function (e) {
17 setTimeout(function () {
18 $('.bs-docs-sidenav').affix({
20 top: function () { return $window.width() <= 980 ? 290 : 210 }
27 window.prettyPrint && prettyPrint()
30 $('.add-on :checkbox').on('click', function () {
32 , method = $this.attr('checked') ? 'addClass' : 'removeClass'
33 $(this).parents('.add-on')[method]('active')
36 // add tipsies to grid for scaffolding
37 if ($('#gridSystem').length) {
38 $('#gridSystem').tooltip({
39 selector: '.show-grid > [class*="span"]'
40 , title: function () { return $(this).width() + 'px' }
45 $('.tooltip-demo').tooltip({
46 selector: "a[data-toggle=tooltip]"
49 $('.tooltip-test').tooltip()
50 $('.popover-test').popover()
53 $("a[data-toggle=popover]")
64 setTimeout(function () {
70 $('#myCarousel').carousel()
72 // javascript build logic
73 var inputsComponent = $("#components.download input")
74 , inputsPlugin = $("#plugins.download input")
75 , inputsVariables = $("#variables.download input")
77 // toggle all plugin checkboxes
78 $('#components.download .toggle-all').on('click', function (e) {
80 inputsComponent.attr('checked', !inputsComponent.is(':checked'))
83 $('#plugins.download .toggle-all').on('click', function (e) {
85 inputsPlugin.attr('checked', !inputsPlugin.is(':checked'))
88 $('#variables.download .toggle-all').on('click', function (e) {
90 inputsVariables.val('')
93 // request built javascript
94 $('.download-btn .btn').on('click', function () {
96 var css = $("#components.download input:checked")
97 .map(function () { return this.value })
99 , js = $("#plugins.download input:checked")
100 .map(function () { return this.value })
103 , img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png']
105 $("#variables.download input")
107 $(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
112 , url: /\?dev/.test(window.location) ? 'http://localhost:3000' : 'http://bootstrap.herokuapp.com'
124 // Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
125 $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
129 send: function(_, completeCallback) {
130 var name = 'jQuery_iframe_' + jQuery.now()
133 iframe = $('<iframe>')
138 .attr('method', opts.type) // GET or POST
140 .attr('target', name)
142 $.each(opts.params, function(k, v) {
145 .attr('type', 'hidden')
147 .attr('value', typeof v == 'string' ? v : JSON.stringify(v))
151 form.appendTo('body').submit()