From 6f2f947a4309a8fdeb7067612447c0f1a15dcfd9 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Wed, 11 Jan 2012 21:42:55 -0800 Subject: add build tool for js + rename twipsy to tooltip + lots of little doc cleanup --- docs/assets/css/docs.css | 9 ++- docs/assets/js/application.js | 83 ++++++++++++++++++++-- docs/components.html | 18 ++--- docs/javascript.html | 159 ++++++++++++++++++++++++++---------------- docs/scaffolding.html | 18 ++--- 5 files changed, 203 insertions(+), 84 deletions(-) (limited to 'docs') diff --git a/docs/assets/css/docs.css b/docs/assets/css/docs.css index f37067203..134224e56 100644 --- a/docs/assets/css/docs.css +++ b/docs/assets/css/docs.css @@ -466,7 +466,7 @@ form.well { /* Icons ------------------------- */ .the-icons { - + } .the-icons i { display: block; @@ -481,6 +481,13 @@ form.well { width: 100px; } +#javascript input[type='checkbox'] { +display: inline; +margin-left: 6px; +position: relative; +top: -1px; +} + /* Responsive Docs -------------------------------------------------- */ diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index c31fc97a0..0e14a5350 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -48,18 +48,18 @@ $(function(){ setTimeout(function () { $(el).select() }, 0) }) - if ($.fn.twipsy) { + if ($.fn.tooltip) { // position static twipsies for components page if ($(".twipsies a").length) { $(window).on('load resize', function () { $(".twipsies a").each(function () { $(this) - .twipsy({ + .tooltip({ placement: $(this).attr('title') , trigger: 'manual' }) - .twipsy('show') + .tooltip('show') }) }) } @@ -67,7 +67,7 @@ $(function(){ // add tipsies to grid for scaffolding if ($('#grid-system').length) { - $('#grid-system').twipsy({ + $('#grid-system').tooltip({ selector: '.show-grid > div' , title: function () { return $(this).width() + 'px' } }) @@ -75,4 +75,79 @@ $(function(){ } } + // javascript build logic + + var inputs = $("#javascript input") + + // toggle all plugin checkboxes + $('#selectAll').on('click', function (e) { + e.preventDefault() + inputs.attr('checked', !inputs.is(':checked')) + }) + + // handle build button dropdown + var buildTypes = $('#javascriptBuilder .dropdown-menu li').on('click', function () { + buildTypes.removeClass('active') + $(this).addClass('active') + }) + + // request built javascript + $('#javascriptBuild').on('click', function () { + + var names = $("#javascript input:checked") + .map(function () { return this.value }) + .toArray() + + if (names[names.length - 1] == 'bootstrap-transition.js') { + names.unshift(names.pop()) + } + + $.ajax({ + type: 'POST' + , dataType: 'jsonpi' + , params: { + branch: '2.0-wip' + , dir: 'js' + , filenames: names + , compress: buildTypes.first().hasClass('active') + } + , url: "http://bootstrap.herokuapp.com" + }) + }) + }) + + +// Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi +// by the talented Ben Vinegar +!function($) { + $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) { + var url = opts.url; + + return { + send: function(_, completeCallback) { + var name = 'jQuery_iframe_' + jQuery.now(), + iframe, form; + + iframe = $('