From 8545fe97877dc275df40ab98d408f21ce9a362cf Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Wed, 19 Oct 2011 21:56:06 -0700 Subject: greatly simply js plugins - remove js api where reasonable --- docs/assets/js/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/assets/js/application.js') diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index 16a20e068..74024caa1 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -1,4 +1,4 @@ -$(document).ready(function(){ +$(function(){ // table sort example // ================== -- cgit v1.2.3 From 0980a33b4703677e1aaf3cd949c0437512fa6f33 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Tue, 20 Dec 2011 19:37:41 -0800 Subject: update all to new on api + add animation support to tabs --- docs/assets/js/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/assets/js/application.js') diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index 74024caa1..dd759bf8b 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -37,7 +37,7 @@ $(function(){ // POSITION STATIC TWIPSIES // ======================== - $(window).bind( 'load resize', function () { + $(window).on('load resize', function () { $(".twipsies a").each(function () { $(this) .twipsy({ -- cgit v1.2.3 From 20aecb983838422c7b43e20960b10d4d79fefaa3 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Wed, 21 Dec 2011 16:22:20 -0600 Subject: updated all docs to jQuery 1.7, move all docs JS to application.js, and move dropdowns css to dedicated file --- docs/assets/js/application.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'docs/assets/js/application.js') diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index 74024caa1..255f624be 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -1,5 +1,36 @@ $(function(){ + // Hide the Mobile Safari address bar once loaded + // ============================================== + + window.addEventListener("load",function() { + // Set a timeout... + setTimeout(function(){ + // Hide the address bar! + window.scrollTo(0, 1); + }, 0); + }); + + + // Docs topbar nav + // =============== + + $('.nav .active').click(function(e) { + e.preventDefault(); + $(this).siblings().toggle(); + }); + + + // Show grid dimensions on hover + // ============================= + + $('.show-grid > div').hover(function() { + var width = $(this).width(); + $(this).attr('title', width); + $(this).twipsy(); + }); + + // table sort example // ================== -- cgit v1.2.3 From efacac0d6c812abffa8a84a48fa760f5f56c92f0 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Wed, 21 Dec 2011 18:42:43 -0800 Subject: clean up all the js across all the doc pages --- docs/assets/js/application.js | 86 ++++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 37 deletions(-) (limited to 'docs/assets/js/application.js') diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index dd759bf8b..c653233e6 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -1,52 +1,64 @@ $(function(){ - // table sort example - // ================== + // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT + // IT'S ALL JUST JUNK FOR OUR DOCS! + // ++++++++++++++++++++++++++++++++++++++++++ - $("#sortTableExample").tablesorter( { sortList: [[ 1, 0 ]] } ) + // make code pretty + prettyPrint && prettyPrint() + // table sort example + if ($.fn.tableSorter) { + $("#sortTableExample").tablesorter( { sortList: [[ 1, 0 ]] } ) + } // add on logic - // ============ - - $('.add-on :checkbox').click(function () { - if ($(this).attr('checked')) { - $(this).parents('.add-on').addClass('active') - } else { - $(this).parents('.add-on').removeClass('active') - } + $('.add-on :checkbox').on('click', function () { + var $this = $(this) + , method = $this.attr('checked') ? 'addClass' : 'removeClass' + $(this).parents('.add-on')[method]('active') }) - // Disable certain links in docs - // ============================= - // Please do not carry these styles over to your projects, it's merely here to prevent button clicks form taking you away from your spot on page + // Please do not carry these styles over to your projects + // it's merely here to prevent button clicks form taking you + // away from your spot on page!! - $('ul.tabs a, ul.pills a, .pagination a, .well .btn, .actions .btn, .alert-message .btn, a.close').click(function (e) { + $('[href^=#]').click(function (e) { e.preventDefault() }) // Copy code blocks in docs - $(".copy-code").focus(function () { - var el = this; - // push select to event loop for chrome :{o - setTimeout(function () { $(el).select(); }, 1); - }); - - - // POSITION STATIC TWIPSIES - // ======================== - - $(window).on('load resize', function () { - $(".twipsies a").each(function () { - $(this) - .twipsy({ - live: false - , placement: $(this).attr('title') - , trigger: 'manual' - , offset: 2 - }) - .twipsy('show') - }) + $(".copy-code").on('focus', function () { + var el = this + setTimeout(function () { $(el).select() }, 0) }) -}); + + if ($.fn.twipsy) { + + // position static twipsies for components page + if ($(".twipsies a").length) { + $(window).on('load resize', function () { + $(".twipsies a").each(function () { + $(this) + .twipsy({ + placement: $(this).attr('title') + , trigger: 'manual' + }) + .twipsy('show') + }) + }) + } + + // add tipsies to grid for scaffolding + if ($('#grid-system').length) { + + $('#grid-system').twipsy({ + selector: '.show-grid > div' + , title: function () { return $(this).width() + 'px' } + }) + + } + } + +}) \ No newline at end of file -- cgit v1.2.3 From 3396fc0542a5fbbed658a95f931472fc24feee56 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Thu, 22 Dec 2011 19:17:41 -0800 Subject: check for prettyprint on window --- docs/assets/js/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/assets/js/application.js') diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index c8e796a39..eae84b138 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -17,7 +17,7 @@ $(function(){ // ================== // make code pretty - prettyPrint && prettyPrint() + window.prettyPrint && prettyPrint() // table sort example if ($.fn.tableSorter) { -- cgit v1.2.3 From 90e3a706ba8c01462516efd3c60cd124620950b9 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Thu, 5 Jan 2012 16:03:05 -0800 Subject: add jank js back to docs application.js for responsive dropdown in topbar --- docs/assets/js/application.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'docs/assets/js/application.js') diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index eae84b138..63791bd37 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -4,6 +4,7 @@ $(function(){ // IT'S ALL JUST JUNK FOR OUR DOCS! // ++++++++++++++++++++++++++++++++++++++++++ + // Hide the Mobile Safari address bar once loaded // ============================================== @@ -13,6 +14,16 @@ $(function(){ window.scrollTo(0, 1); }, 0); + + // Docs topbar nav + // =============== + + $('.nav .active').on('click', function (e) { + e.preventDefault() + $(this).siblings().toggle() + }); + + // table sort example // ================== -- cgit v1.2.3 From 314feb702f9a95ee473e529650e16654714cd9f4 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Thu, 5 Jan 2012 18:32:08 -0800 Subject: listen to window for dropdown clear --- docs/assets/js/application.js | 9 --------- 1 file changed, 9 deletions(-) (limited to 'docs/assets/js/application.js') diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index 63791bd37..6194b88db 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -15,15 +15,6 @@ $(function(){ }, 0); - // Docs topbar nav - // =============== - - $('.nav .active').on('click', function (e) { - e.preventDefault() - $(this).siblings().toggle() - }); - - // table sort example // ================== -- cgit v1.2.3 From c56e9d2d35299b4c9e4e3d1aabcf59cedc9143f2 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Thu, 5 Jan 2012 21:43:28 -0800 Subject: massive docs update, mostly to all our new forms, and to the buttons --- docs/assets/js/application.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/assets/js/application.js') diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index 63791bd37..5fe8b53ef 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -9,10 +9,10 @@ $(function(){ // ============================================== // Set a timeout... - setTimeout(function(){ - // Hide the address bar! - window.scrollTo(0, 1); - }, 0); + // setTimeout(function(){ + // // Hide the address bar! + // window.scrollTo(0, 1); + // }, 0); // Docs topbar nav -- cgit v1.2.3 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/js/application.js | 83 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 79 insertions(+), 4 deletions(-) (limited to 'docs/assets/js/application.js') 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 = $('