1// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT 2// IT'S ALL JUST FOR DOCs OVERVIEW PAGE 3// ++++++++++++++++++++++++++++++++++++++++++ 4 5!function ($) { 6 7 $(function(){ 8 9 var $window = $(window) 10 11 // Disable certain links in docs 12 $('section [href^=#]').click(function (e) { 13 e.preventDefault() 14 }) 15 16 // side bar 17 $('.bs-docs-sidenav').affix({ 18 offset: { 19 top: function () { return $window.width() <= 980 ? 290 : 210 } 20 , bottom: 270 21 } 22 }) 23 24 // make code pretty 25 window.prettyPrint && prettyPrint() 26 27 // add-ons 28 $('.add-on :checkbox').on('click', function () { 29 var $this = $(this) 30 , method = $this.attr('checked') ? 'addClass' : 'removeClass' 31 $(this).parents('.add-on')[method]('active') 32 }) 33 34 // add tipsies to grid for scaffolding 35 if ($('#gridSystem').length) { 36 $('#gridSystem').tooltip({ 37 selector: '.show-grid > div' 38 , title: function () { return $(this).width() + 'px' } 39 }) 40 } 41 42 // tooltip demo 43 $('.tooltip-demo').tooltip({ 44 selector: "a[rel=tooltip]" 45 }) 46 47 $('.tooltip-test').tooltip() 48 $('.popover-test').popover() 49 50 // popover demo 51 $("a[rel=popover]") 52 .popover() 53 .click(function(e) { 54 e.preventDefault() 55 }) 56 57 // button state demo 58 $('#fat-btn') 59 .click(function () { 60 var btn = $(this) 61 btn.button('loading') 62 setTimeout(function () { 63 btn.button('reset') 64 }, 3000) 65 }) 66 67 // carousel demo 68 $('#myCarousel').carousel() 69 70 // javascript build logic 71 var inputsComponent = $("#components.download input") 72 , inputsPlugin = $("#plugins.download input") 73 , inputsVariables = $("#variables.download input") 74 75 // toggle all plugin checkboxes 76 $('#components.download .toggle-all').on('click', function (e) { 77 e.preventDefault() 78 inputsComponent.attr('checked', !inputsComponent.is(':checked')) 79 }) 80 81 $('#plugins.download .toggle-all').on('click', function (e) { 82 e.preventDefault() 83 inputsPlugin.attr('checked', !inputsPlugin.is(':checked')) 84 }) 85 86 $('#variables.download .toggle-all').on('click', function (e) { 87 e.preventDefault() 88 inputsVariables.val('') 89 }) 90 91 // request built javascript 92 $('.download-btn').on('click', function () { 93 94 var css = $("#components.download input:checked") 95 .map(function () { return this.value }) 96 .toArray() 97 , js = $("#plugins.download input:checked") 98 .map(function () { return this.value }) 99 .toArray() 100 , vars = {} 101 , img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png'] 102 103 $("#variables.download input") 104 .each(function () { 105 $(this).val() && (vars[ $(this).prev().text() ] = $(this).val()) 106 }) 107 108 $.ajax({ 109 type: 'POST' 110 , url: /\?dev/.test(window.location) ? 'http://localhost:3000' : 'http://bootstrap.herokuapp.com' 111 , dataType: 'jsonpi' 112 , params: { 113 js: js 114 , css: css 115 , vars: vars 116 , img: img 117 } 118 }) 119 }) 120 }) 121 122// Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi 123$.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) { 124 var url = opts.url; 125 126 return { 127 send: function(_, completeCallback) { 128 var name = 'jQuery_iframe_' + jQuery.now() 129 , iframe, form 130 131 iframe = $('<iframe>') 132 .attr('name', name) 133 .appendTo('head') 134 135 form = $('<form>') 136 .attr('method', opts.type) // GET or POST 137 .attr('action', url) 138 .attr('target', name) 139 140 $.each(opts.params, function(k, v) { 141 142 $('<input>') 143 .attr('type', 'hidden') 144 .attr('name', k) 145 .attr('value', typeof v == 'string' ? v : JSON.stringify(v)) 146 .appendTo(form) 147 }) 148 149 form.appendTo('body').submit() 150 } 151 } 152}) 153 154}(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.