1// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT 2// IT'S ALL JUST JUNK FOR OUR DOCS! 3// ++++++++++++++++++++++++++++++++++++++++++ 4 5!function ($) { 6 7 $(function(){ 8 9 // Disable certain links in docs 10 $('section [href^=#]').click(function (e) { 11 e.preventDefault() 12 }) 13 14 // make code pretty 15 window.prettyPrint && prettyPrint() 16 17 // add-ons 18 $('.add-on :checkbox').on('click', function () { 19 var $this = $(this) 20 , method = $this.attr('checked') ? 'addClass' : 'removeClass' 21 $(this).parents('.add-on')[method]('active') 22 }) 23 24 // position static twipsies for components page 25 if ($(".twipsies a").length) { 26 $(window).on('load resize', function () { 27 $(".twipsies a").each(function () { 28 $(this) 29 .tooltip({ 30 placement: $(this).attr('title') 31 , trigger: 'manual' 32 }) 33 .tooltip('show') 34 }) 35 }) 36 } 37 38 // add tipsies to grid for scaffolding 39 if ($('#grid-system').length) { 40 $('#grid-system').tooltip({ 41 selector: '.show-grid > div' 42 , title: function () { return $(this).width() + 'px' } 43 }) 44 } 45 46 // fix sub nav on scroll 47 var $win = $(window) 48 , $nav = $('.subnav') 49 , navTop = $('.subnav').length && $('.subnav').offset().top - 40 50 , isFixed = 0 51 52 processScroll() 53 54 $win.on('scroll', processScroll) 55 56 function processScroll() { 57 var i, scrollTop = $win.scrollTop() 58 if (scrollTop >= navTop && !isFixed) { 59 isFixed = 1 60 $nav.addClass('subnav-fixed') 61 } else if (scrollTop <= navTop && isFixed) { 62 isFixed = 0 63 $nav.removeClass('subnav-fixed') 64 } 65 } 66 67 // tooltip demo 68 $('.tooltip-demo.well').tooltip({ 69 selector: "a[rel=tooltip]" 70 }) 71 72 $('.tooltip-test').tooltip() 73 $('.popover-test').popover() 74 75 // popover demo 76 $("a[rel=popover]") 77 .popover() 78 .click(function(e) { 79 e.preventDefault() 80 }) 81 82 // button state demo 83 $('#fat-btn') 84 .click(function () { 85 var btn = $(this) 86 btn.button('loading') 87 setTimeout(function () { 88 btn.button('reset') 89 }, 3000) 90 }) 91 92 // carousel demo 93 $('#myCarousel').carousel() 94 95 // javascript build logic 96 var inputsComponent = $("#components.download input") 97 , inputsPlugin = $("#plugins.download input") 98 , inputsVariables = $("#variables.download input") 99 100 101 //dropdowns 102 $('.dropdown-toggle').dropdown() 103 104 105 // toggle all plugin checkboxes 106 $('#components.download .toggle-all').on('click', function (e) { 107 e.preventDefault() 108 inputsComponent.attr('checked', !inputsComponent.is(':checked')) 109 }) 110 111 $('#plugins.download .toggle-all').on('click', function (e) { 112 e.preventDefault() 113 inputsPlugin.attr('checked', !inputsPlugin.is(':checked')) 114 }) 115 116 $('#variables.download .toggle-all').on('click', function (e) { 117 e.preventDefault() 118 inputsVariables.val('') 119 }) 120 121 // request built javascript 122 $('.download-btn').on('click', function () { 123 124 var css = $("#components.download input:checked") 125 .map(function () { return this.value }) 126 .toArray() 127 , js = $("#plugins.download input:checked") 128 .map(function () { return this.value }) 129 .toArray() 130 , vars = {} 131 , img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png'] 132 133 $("#variables.download input") 134 .each(function () { 135 $(this).val() && (vars[ $(this).prev().text() ] = $(this).val()) 136 }) 137 138 $.ajax({
139 type: 'POST' 140 , url: 'http://bootstrap.herokuapp.com' 141 , dataType: 'jsonpi' 142 , params: { 143 js: js 144 , css: css 145 , vars: vars 146 , img: img 147 } 148 }) 149 }) 150 151 }) 152 153// Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi 154$.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) { 155 var url = opts.url; 156 157 return { 158 send: function(_, completeCallback) { 159 var name = 'jQuery_iframe_' + jQuery.now() 160 , iframe, form 161 162 iframe = $('<iframe>') 163 .attr('name', name) 164 .appendTo('head') 165 166 form = $('<form>') 167 .attr('method', opts.type) // GET or POST 168 .attr('action', url) 169 .attr('target', name) 170 171 $.each(opts.params, function(k, v) { 172 173 $('<input>') 174 .attr('type', 'hidden') 175 .attr('name', k) 176 .attr('value', typeof v == 'string' ? v : JSON.stringify(v)) 177 .appendTo(form) 178 }) 179 180 form.appendTo('body').submit() 181 } 182 } 183}) 184 185}(window.jQuery)
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.