From 5f4e30ed1d33f83b0fad3afc9174e193e6c3fdf4 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Fri, 9 Sep 2011 22:47:49 -0700 Subject: move js plugins to root dir, begin writing tests, and change modal plugin to be more boss like --- bootstrap-1.3.0.css | 6 +- bootstrap-1.3.0.min.css | 2 +- docs/assets/js/application.js | 2 +- docs/assets/js/bootstrap-alerts.js | 72 -- docs/assets/js/bootstrap-dropdown.js | 26 - docs/assets/js/bootstrap-modal.js | 157 ---- docs/assets/js/bootstrap-popover.js | 67 -- docs/assets/js/bootstrap-scrollspy.js | 0 docs/assets/js/bootstrap-tabs.js | 38 - docs/assets/js/bootstrap-twipsy.js | 288 ------- docs/index.html | 2 +- docs/javascript.html | 128 +-- js/bootstrap-alerts.js | 72 ++ js/bootstrap-dropdown.js | 26 + js/bootstrap-modal.js | 162 ++++ js/bootstrap-popover.js | 67 ++ js/bootstrap-tabs.js | 38 + js/bootstrap-twipsy.js | 288 +++++++ js/tests/index.html | 38 + js/tests/unit/bootstrap-alerts.js | 41 + js/tests/unit/bootstrap-dropdown.js | 52 ++ js/tests/unit/bootstrap-modal.js | 32 + js/tests/unit/bootstrap-popover.js | 0 js/tests/unit/bootstrap-tabs.js | 0 js/tests/unit/bootstrap-twipsy.js | 0 js/tests/vendor/qunit.css | 232 +++++ js/tests/vendor/qunit.js | 1510 +++++++++++++++++++++++++++++++++ lib/bootstrap.less | 2 +- lib/forms.less | 2 +- 29 files changed, 2632 insertions(+), 718 deletions(-) delete mode 100644 docs/assets/js/bootstrap-alerts.js delete mode 100644 docs/assets/js/bootstrap-dropdown.js delete mode 100644 docs/assets/js/bootstrap-modal.js delete mode 100644 docs/assets/js/bootstrap-popover.js delete mode 100644 docs/assets/js/bootstrap-scrollspy.js delete mode 100644 docs/assets/js/bootstrap-tabs.js delete mode 100644 docs/assets/js/bootstrap-twipsy.js create mode 100644 js/bootstrap-alerts.js create mode 100644 js/bootstrap-dropdown.js create mode 100644 js/bootstrap-modal.js create mode 100644 js/bootstrap-popover.js create mode 100644 js/bootstrap-tabs.js create mode 100644 js/bootstrap-twipsy.js create mode 100644 js/tests/index.html create mode 100644 js/tests/unit/bootstrap-alerts.js create mode 100644 js/tests/unit/bootstrap-dropdown.js create mode 100644 js/tests/unit/bootstrap-modal.js create mode 100644 js/tests/unit/bootstrap-popover.js create mode 100644 js/tests/unit/bootstrap-tabs.js create mode 100644 js/tests/unit/bootstrap-twipsy.js create mode 100644 js/tests/vendor/qunit.css create mode 100644 js/tests/vendor/qunit.js diff --git a/bootstrap-1.3.0.css b/bootstrap-1.3.0.css index d7e39b823..fd1a173c6 100644 --- a/bootstrap-1.3.0.css +++ b/bootstrap-1.3.0.css @@ -1,12 +1,12 @@ /*! - * Bootstrap v1.2.0 + * Bootstrap v1.3.0 * * Copyright 2011 Twitter, Inc * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. - * Date: Fri Sep 9 00:02:14 PDT 2011 + * Date: Fri Sep 9 20:23:37 PDT 2011 */ /* Reset.less * Props to Eric Meyer (meyerweb.com) for his CSS reset file. We're using an adapted version here that cuts out some of the reset HTML elements we will never need here (i.e., dfn, samp, etc). @@ -1012,7 +1012,7 @@ textarea[readonly] { padding-top: 9px; } .form-stacked legend { - margin-left: 0; + padding-left: 0; } .form-stacked label { display: block; diff --git a/bootstrap-1.3.0.min.css b/bootstrap-1.3.0.min.css index c0153cb1f..fc3e09b9e 100644 --- a/bootstrap-1.3.0.min.css +++ b/bootstrap-1.3.0.min.css @@ -160,7 +160,7 @@ input[disabled],select[disabled],textarea[disabled],input[readonly],select[reado .inputs-list li:first-child{padding-top:5px;} .inputs-list input[type=radio],.inputs-list input[type=checkbox]{margin-bottom:0;} .form-stacked{padding-left:20px;}.form-stacked fieldset{padding-top:9px;} -.form-stacked legend{margin-left:0;} +.form-stacked legend{padding-left:0;} .form-stacked label{display:block;float:none;width:auto;font-weight:bold;text-align:left;line-height:20px;padding-top:0;} .form-stacked .clearfix{margin-bottom:9px;}.form-stacked .clearfix div.input{margin-left:0;} .form-stacked .inputs-list{margin-bottom:0;}.form-stacked .inputs-list li{padding-top:0;}.form-stacked .inputs-list li label{font-weight:normal;padding-top:0;} diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index 475329398..db59c79f9 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -3,7 +3,7 @@ $(document).ready(function(){ // Dropdown example for topbar nav // =============================== - $(".topbar").dropdown() // catch any dropdowns on the page + $('body').dropdown() // catch any dropdowns on the page // table sort example diff --git a/docs/assets/js/bootstrap-alerts.js b/docs/assets/js/bootstrap-alerts.js deleted file mode 100644 index e27ac6482..000000000 --- a/docs/assets/js/bootstrap-alerts.js +++ /dev/null @@ -1,72 +0,0 @@ -(function( $ ){ - - /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) - * ======================================================= */ - - var transitionEnd - - $(function () { - - $.support.transition = (function () { - var thisBody = document.body || document.documentElement - , thisStyle = thisBody.style - , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined - return support - })() - - // set CSS transition event type - if ( $.support.transition ) { - transitionEnd = "TransitionEnd" - if ( $.browser.webkit ) { - transitionEnd = "webkitTransitionEnd" - } else if ( $.browser.mozilla ) { - transitionEnd = "transitionend" - } else if ( $.browser.opera ) { - transitionEnd = "oTransitionEnd" - } - } - - }) - - /* ALERT CLASS DEFINITION - * ====================== */ - - var Alert = function ( content ) { - var that = this - this.$element = $(content) - this.$element.delegate('.close', 'click', function (e) { - e.preventDefault() - that.close() - }) - } - - Alert.prototype = { - - close: function () { - var that = this - - this.$element.removeClass('in') - - function removeElement () { - that.$element.remove() - that.$element = null - } - - $.support.transition && this.$element.hasClass('fade') ? - this.$element.bind(transitionEnd, removeElement) : - removeElement() - } - - } - - - /* ALERT PLUGIN DEFINITION - * ======================= */ - - $.fn.alert = function ( options ) { - return this.each(function () { - new Alert(this) - }) - } - -})( jQuery || ender ) \ No newline at end of file diff --git a/docs/assets/js/bootstrap-dropdown.js b/docs/assets/js/bootstrap-dropdown.js deleted file mode 100644 index fe73e7994..000000000 --- a/docs/assets/js/bootstrap-dropdown.js +++ /dev/null @@ -1,26 +0,0 @@ -(function( $ ){ - - /* DROPDOWN PLUGIN DEFINITION - * ========================== */ - - var selector = 'a.menu, .dropdown-toggle' - - function clearMenus() { - $(selector).parent('li').removeClass('open') - } - - $(function () { - $('body').bind("click", clearMenus) - }) - - $.fn.dropdown = function ( options ) { - return this.each(function () { - $(this).delegate(selector, 'click', function (e) { - clearMenus() - $(this).parent('li').toggleClass('open') - return false - }) - }) - } - -})( jQuery || ender ) \ No newline at end of file diff --git a/docs/assets/js/bootstrap-modal.js b/docs/assets/js/bootstrap-modal.js deleted file mode 100644 index 4bc395e1c..000000000 --- a/docs/assets/js/bootstrap-modal.js +++ /dev/null @@ -1,157 +0,0 @@ -(function( $ ){ - - /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) - * ======================================================= */ - - var transitionEnd - - $(function () { - - $.support.transition = (function () { - var thisBody = document.body || document.documentElement - , thisStyle = thisBody.style - , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined - return support - })() - - // set CSS transition event type - if ( $.support.transition ) { - transitionEnd = "TransitionEnd" - if ( $.browser.webkit ) { - transitionEnd = "webkitTransitionEnd" - } else if ( $.browser.mozilla ) { - transitionEnd = "transitionend" - } else if ( $.browser.opera ) { - transitionEnd = "oTransitionEnd" - } - } - - }) - - - /* MODAL PUBLIC CLASS DEFINITION - * ============================= */ - - var Modal = function ( options ) { - this.settings = $.extend({}, $.fn.modal.defaults) - - if ( typeof options == 'string' ) { - this.settings.content = options - } else if ( options ) { - $.extend( this.settings, options ) - } - - return this - } - - Modal.prototype = { - - toggle: function () { - return this[!this.isOpen ? 'open' : 'close']() - } - - , open: function () { - var that = this - this.isOpen = true - - this.$element = $(this.settings.content) - - _.escape.call(this) - _.backdrop.call(this) - - this.$element - .delegate('.close', 'click', function (e) { e.preventDefault(); that.close() }) - .appendTo(document.body) - .show() - - setTimeout(function () { - that.$element.addClass('in') - that.$backdrop && that.$backdrop.addClass('in') - }, 1) - - return this - } - - , close: function () { - var that = this - - this.isOpen = false - - _.escape.call(this) - _.backdrop.call(this) - - this.$element.removeClass('in') - - function removeElement () { - that.$element.remove() - that.$element = null - } - - $.support.transition && this.$element.hasClass('fade') ? - this.$element.bind(transitionEnd, removeElement) : - removeElement() - - return this - } - - } - - - /* MODAL PRIVATE METHODS - * ===================== */ - - var _ = { - - backdrop: function () { - var that = this - , animate = this.$element.hasClass('fade') ? 'fade' : '' - if ( this.isOpen && this.settings.backdrop ) { - this.$backdrop = $('