1 // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2 // IT'S ALL JUST JUNK FOR OUR DOCS!
3 // ++++++++++++++++++++++++++++++++++++++++++
8 // oh how stylish! no semicolons. I'm not hipster enough for that.
9 // Keep your stumptown coffee and pbr, twats.
12 document.body.appendChild(document.createElement('div')).setAttribute('style', [
19 'background:url("../img/8x5overlay.png") repeat'
23 var $window = $(window)
25 // Disable certain links in docs
26 $('section [href^=#]').click(function (e) {
31 setTimeout(function () {
32 $('.bs-docs-sidenav').affix({
34 top: function () { return $window.width() <= 980 ? 290 : 210 }
41 window.prettyPrint && prettyPrint()
44 $('.add-on :checkbox').on('click', function () {
46 , method = $this.attr('checked') ? 'addClass' : 'removeClass'
47 $(this).parents('.add-on')[method]('active')
50 // add tipsies to grid for scaffolding
51 if ($('#gridSystem').length) {
52 $('#gridSystem').tooltip({
53 selector: '.show-grid > [class*="span"]'
54 , title: function () { return $(this).width() + 'px' }
59 $('.tooltip-demo').tooltip({
60 selector: "a[data-toggle=tooltip]"
63 $('.tooltip-test').tooltip()
64 $('.popover-test').popover()
67 $("a[data-toggle=popover]")
78 setTimeout(function () {
84 $('#myCarousel').carousel()
86 // javascript build logic
87 var inputsComponent = $("#components.download input")
88 , inputsPlugin = $("#plugins.download input")
89 , inputsVariables = $("#variables.download input")
91 // toggle all plugin checkboxes
92 $('#components.download .toggle-all').on('click', function (e) {
94 inputsComponent.attr('checked', !inputsComponent.is(':checked'))
97 $('#plugins.download .toggle-all').on('click', function (e) {
99 inputsPlugin.attr('checked', !inputsPlugin.is(':checked'))
102 $('#variables.download .toggle-all').on('click', function (e) {
104 inputsVariables.val('')
107 // request built javascript
108 $('.download-btn .btn').on('click', function () {
110 var css = $("#components.download input:checked")
111 .map(function () { return this.value })
113 , js = $("#plugins.download input:checked")
114 .map(function () { return this.value })
117 , img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png']
119 $("#variables.download input")
121 $(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
126 , url: /\?dev/.test(window.location) ? 'http://localhost:3000' : 'http://bootstrap.herokuapp.com'
138 // Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
139 $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
143 send: function(_, completeCallback) {
144 var name = 'jQuery_iframe_' + jQuery.now()
147 iframe = $('<iframe>')
152 .attr('method', opts.type) // GET or POST
154 .attr('target', name)
156 $.each(opts.params, function(k, v) {
159 .attr('type', 'hidden')
161 .attr('value', typeof v == 'string' ? v : JSON.stringify(v))
165 form.appendTo('body').submit()