indvd00m@0: // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT indvd00m@0: // IT'S ALL JUST JUNK FOR OUR DOCS! indvd00m@0: // ++++++++++++++++++++++++++++++++++++++++++ indvd00m@0: indvd00m@0: !function ($) { indvd00m@0: indvd00m@0: $(function(){ indvd00m@0: // oh how stylish! no semicolons. I'm not hipster enough for that. indvd00m@0: // Keep your stumptown coffee and pbr, twats. indvd00m@0: // real-javascript {{ indvd00m@0: /* indvd00m@0: document.body.appendChild(document.createElement('div')).setAttribute('style', [ indvd00m@0: 'position:fixed', indvd00m@0: 'z-index:1000', indvd00m@0: 'top:0', indvd00m@0: 'left:0', indvd00m@0: 'width:100%', indvd00m@0: 'height:100%', indvd00m@0: 'background:url("../img/8x5overlay.png") repeat' indvd00m@0: ].join(';')); indvd00m@0: */ indvd00m@0: // }} indvd00m@0: var $window = $(window) indvd00m@0: indvd00m@0: // Disable certain links in docs indvd00m@0: $('section [href^=#]').click(function (e) { indvd00m@0: e.preventDefault() indvd00m@0: }) indvd00m@0: indvd00m@0: // side bar indvd00m@0: setTimeout(function () { indvd00m@0: $('.bs-docs-sidenav').affix({ indvd00m@0: offset: { indvd00m@0: top: function () { return $window.width() <= 980 ? 290 : 210 } indvd00m@0: , bottom: 270 indvd00m@0: } indvd00m@0: }) indvd00m@0: }, 100) indvd00m@0: indvd00m@0: // make code pretty indvd00m@0: window.prettyPrint && prettyPrint() indvd00m@0: indvd00m@0: // add-ons indvd00m@0: $('.add-on :checkbox').on('click', function () { indvd00m@0: var $this = $(this) indvd00m@0: , method = $this.attr('checked') ? 'addClass' : 'removeClass' indvd00m@0: $(this).parents('.add-on')[method]('active') indvd00m@0: }) indvd00m@0: indvd00m@0: // add tipsies to grid for scaffolding indvd00m@0: if ($('#gridSystem').length) { indvd00m@0: $('#gridSystem').tooltip({ indvd00m@0: selector: '.show-grid > [class*="span"]' indvd00m@0: , title: function () { return $(this).width() + 'px' } indvd00m@0: }) indvd00m@0: } indvd00m@0: indvd00m@0: // tooltip demo indvd00m@0: $('.tooltip-demo').tooltip({ indvd00m@0: selector: "a[data-toggle=tooltip]" indvd00m@0: }) indvd00m@0: indvd00m@0: $('.tooltip-test').tooltip() indvd00m@0: $('.popover-test').popover() indvd00m@0: indvd00m@0: // popover demo indvd00m@0: $("a[data-toggle=popover]") indvd00m@0: .popover() indvd00m@0: .click(function(e) { indvd00m@0: e.preventDefault() indvd00m@0: }) indvd00m@0: indvd00m@0: // button state demo indvd00m@0: $('#fat-btn') indvd00m@0: .click(function () { indvd00m@0: var btn = $(this) indvd00m@0: btn.button('loading') indvd00m@0: setTimeout(function () { indvd00m@0: btn.button('reset') indvd00m@0: }, 3000) indvd00m@0: }) indvd00m@0: indvd00m@0: // carousel demo indvd00m@0: $('#myCarousel').carousel() indvd00m@0: indvd00m@0: // javascript build logic indvd00m@0: var inputsComponent = $("#components.download input") indvd00m@0: , inputsPlugin = $("#plugins.download input") indvd00m@0: , inputsVariables = $("#variables.download input") indvd00m@0: indvd00m@0: // toggle all plugin checkboxes indvd00m@0: $('#components.download .toggle-all').on('click', function (e) { indvd00m@0: e.preventDefault() indvd00m@0: inputsComponent.attr('checked', !inputsComponent.is(':checked')) indvd00m@0: }) indvd00m@0: indvd00m@0: $('#plugins.download .toggle-all').on('click', function (e) { indvd00m@0: e.preventDefault() indvd00m@0: inputsPlugin.attr('checked', !inputsPlugin.is(':checked')) indvd00m@0: }) indvd00m@0: indvd00m@0: $('#variables.download .toggle-all').on('click', function (e) { indvd00m@0: e.preventDefault() indvd00m@0: inputsVariables.val('') indvd00m@0: }) indvd00m@0: indvd00m@0: // request built javascript indvd00m@0: $('.download-btn .btn').on('click', function () { indvd00m@0: indvd00m@0: var css = $("#components.download input:checked") indvd00m@0: .map(function () { return this.value }) indvd00m@0: .toArray() indvd00m@0: , js = $("#plugins.download input:checked") indvd00m@0: .map(function () { return this.value }) indvd00m@0: .toArray() indvd00m@0: , vars = {} indvd00m@0: , img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png'] indvd00m@0: indvd00m@0: $("#variables.download input") indvd00m@0: .each(function () { indvd00m@0: $(this).val() && (vars[ $(this).prev().text() ] = $(this).val()) indvd00m@0: }) indvd00m@0: indvd00m@0: $.ajax({ indvd00m@0: type: 'POST' indvd00m@0: , url: /\?dev/.test(window.location) ? 'http://localhost:3000' : 'http://bootstrap.herokuapp.com' indvd00m@0: , dataType: 'jsonpi' indvd00m@0: , params: { indvd00m@0: js: js indvd00m@0: , css: css indvd00m@0: , vars: vars indvd00m@0: , img: img indvd00m@0: } indvd00m@0: }) indvd00m@0: }) indvd00m@0: }) indvd00m@0: indvd00m@0: // Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi indvd00m@0: $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) { indvd00m@0: var url = opts.url; indvd00m@0: indvd00m@0: return { indvd00m@0: send: function(_, completeCallback) { indvd00m@0: var name = 'jQuery_iframe_' + jQuery.now() indvd00m@0: , iframe, form indvd00m@0: indvd00m@0: iframe = $('