0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

Merge branch '2.0.3-wip' of github.com:twitter/bootstrap into 2.0.3-wip

Conflicts:
	docs/assets/bootstrap.zip
This commit is contained in:
Mark Otto 2012-04-14 17:16:37 -07:00
commit ce30d19c15
31 changed files with 324 additions and 275 deletions

View File

@ -34,6 +34,8 @@ bootstrap:
lessc --yui-compress ${BOOTSTRAP_LESS} > bootstrap/css/bootstrap.min.css
lessc ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.css
lessc --yui-compress ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.min.css
jshint js/*.js --config js/.jshintrc
jshint js/tests/unit/*.js --config js/.jshintrc
cat js/bootstrap-transition.js js/bootstrap-alert.js js/bootstrap-button.js js/bootstrap-carousel.js js/bootstrap-collapse.js js/bootstrap-dropdown.js js/bootstrap-modal.js js/bootstrap-tooltip.js js/bootstrap-popover.js js/bootstrap-scrollspy.js js/bootstrap-tab.js js/bootstrap-typeahead.js > bootstrap/js/bootstrap.js
uglifyjs -nc bootstrap/js/bootstrap.js > bootstrap/js/bootstrap.min.tmp.js
echo "/**\n* Bootstrap.js by @fat & @mdo\n* Copyright 2012 Twitter, Inc.\n* http://www.apache.org/licenses/LICENSE-2.0.txt\n*/" > bootstrap/js/copyright.js

View File

@ -81,6 +81,13 @@ Developers
We have included a makefile with convenience methods for working with the Bootstrap library.
+ **dependencies**
Our makefile depends on you having less, uglify.js, and jshint installed. To install, just run the following command in npm:
```
$ npm install less uglify-js jshint -g
```
+ **build** - `make`
Runs the LESS compiler to rebuild the `/less` files and compiles the docs pages. Requires lessc and uglify-js. <a href="http://twitter.github.com/bootstrap/less.html#compiling">Read more in our docs &raquo;</a>

Binary file not shown.

View File

@ -51,6 +51,11 @@
processScroll()
// hack sad times - holdover until rewrite for 2.1
$nav.on('click', function () {
if (!isFixed) setTimeout(function () { $win.scrollTop($win.scrollTop() - 47) }, 10)
})
$win.on('scroll', processScroll)
function processScroll() {

View File

@ -18,9 +18,10 @@
* ========================================================== */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* ALERT CLASS DEFINITION
* ====================== */
@ -30,43 +31,37 @@
$(el).on('click', dismiss, this.close)
}
Alert.prototype = {
Alert.prototype.close = function (e) {
var $this = $(this)
, selector = $this.attr('data-target')
, $parent
constructor: Alert
, close: function ( e ) {
var $this = $(this)
, selector = $this.attr('data-target')
, $parent
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
$parent = $(selector)
e && e.preventDefault()
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
$parent.trigger(e = $.Event('close'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
$parent
.trigger('closed')
.remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent.on($.support.transition.end, removeElement) :
removeElement()
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
$parent = $(selector)
e && e.preventDefault()
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
$parent.trigger(e = $.Event('close'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
$parent
.trigger('closed')
.remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent.on($.support.transition.end, removeElement) :
removeElement()
}
@ -92,4 +87,4 @@
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,58 +18,53 @@
* ============================================================ */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* BUTTON PUBLIC CLASS DEFINITION
* ============================== */
var Button = function ( element, options ) {
var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.button.defaults, options)
}
Button.prototype = {
Button.prototype.setState = function (state) {
var d = 'disabled'
, $el = this.$element
, data = $el.data()
, val = $el.is('input') ? 'val' : 'html'
constructor: Button
state = state + 'Text'
data.resetText || $el.data('resetText', $el[val]())
, setState: function ( state ) {
var d = 'disabled'
, $el = this.$element
, data = $el.data()
, val = $el.is('input') ? 'val' : 'html'
$el[val](data[state] || this.options[state])
state = state + 'Text'
data.resetText || $el.data('resetText', $el[val]())
// push to event loop to allow forms to submit
setTimeout(function () {
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d)
}, 0)
}
$el[val](data[state] || this.options[state])
Button.prototype.toggle = function () {
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
// push to event loop to allow forms to submit
setTimeout(function () {
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d)
}, 0)
}
, toggle: function () {
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
$parent && $parent
.find('.active')
.removeClass('active')
this.$element.toggleClass('active')
}
$parent && $parent
.find('.active')
.removeClass('active')
this.$element.toggleClass('active')
}
/* BUTTON PLUGIN DEFINITION
* ======================== */
$.fn.button = function ( option ) {
$.fn.button = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('button')
@ -98,4 +93,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,9 +18,10 @@
* ========================================================== */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* CAROUSEL CLASS DEFINITION
* ========================= */
@ -129,7 +130,7 @@
/* CAROUSEL PLUGIN DEFINITION
* ========================== */
$.fn.carousel = function ( option ) {
$.fn.carousel = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('carousel')
@ -162,4 +163,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,16 +18,20 @@
* ============================================================ */
!function ( $ ) {
!function ($) {
"use strict"
"use strict"; // jshint ;_;
var Collapse = function ( element, options ) {
this.$element = $(element)
/* COLLAPSE PUBLIC CLASS DEFINITION
* ================================ */
var Collapse = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.collapse.defaults, options)
if (this.options["parent"]) {
this.$parent = $(this.options["parent"])
if (this.options.parent) {
this.$parent = $(this.options.parent)
}
this.options.toggle && this.toggle()
@ -53,7 +57,6 @@
dimension = this.dimension()
scroll = $.camelCase(['scroll', dimension].join('-'))
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
hasData
if (actives && actives.length) {
hasData = actives.data('collapse')
@ -75,7 +78,7 @@
this.$element[dimension](0)
}
, reset: function ( size ) {
, reset: function (size) {
var dimension = this.dimension()
this.$element
@ -83,12 +86,12 @@
[dimension](size || 'auto')
[0].offsetWidth
this.$element[size != null ? 'addClass' : 'removeClass']('collapse')
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
return this
}
, transition: function ( method, startEvent, completeEvent ) {
, transition: function (method, startEvent, completeEvent) {
var that = this
, complete = function () {
if (startEvent == 'show') that.reset()
@ -107,18 +110,19 @@
$.support.transition && this.$element.hasClass('collapse') ?
this.$element.one($.support.transition.end, complete) :
complete()
}
}
, toggle: function () {
this[this.$element.hasClass('in') ? 'hide' : 'show']()
}
}
}
/* COLLAPSIBLE PLUGIN DEFINITION
/* COLLAPSIBLE PLUGIN DEFINITION
* ============================== */
$.fn.collapse = function ( option ) {
$.fn.collapse = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('collapse')
@ -149,4 +153,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,15 +18,16 @@
* ============================================================ */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* DROPDOWN CLASS DEFINITION
* ========================= */
var toggle = '[data-toggle="dropdown"]'
, Dropdown = function ( element ) {
, Dropdown = function (element) {
var $el = $(element).on('click.dropdown.data-api', this.toggle)
$('html').on('click.dropdown.data-api', function () {
$el.parent().removeClass('open')
@ -37,7 +38,7 @@
constructor: Dropdown
, toggle: function ( e ) {
, toggle: function (e) {
var $this = $(this)
, selector = $this.attr('data-target')
, $parent
@ -54,7 +55,8 @@
isActive = $parent.hasClass('open')
clearMenus()
!isActive && $parent.toggleClass('open')
if (!isActive) $parent.toggleClass('open')
return false
}
@ -69,7 +71,7 @@
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
$.fn.dropdown = function ( option ) {
$.fn.dropdown = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('dropdown')
@ -91,4 +93,4 @@
.on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,14 +18,15 @@
* ========================================================= */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* MODAL CLASS DEFINITION
* ====================== */
var Modal = function ( content, options ) {
var Modal = function (content, options) {
this.options = options
this.$element = $(content)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
@ -55,7 +56,9 @@
backdrop.call(this, function () {
var transition = $.support.transition && that.$element.hasClass('fade')
!that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
if (!that.$element.parent().length) {
that.$element.appendTo(document.body) //don't move modals dom position
}
that.$element
.show()
@ -73,7 +76,7 @@
})
}
, hide: function ( e ) {
, hide: function (e) {
e && e.preventDefault()
var that = this
@ -116,7 +119,7 @@
})
}
function hideModal( that ) {
function hideModal(that) {
this.$element
.hide()
.trigger('hidden')
@ -124,7 +127,7 @@
backdrop.call(this)
}
function backdrop( callback ) {
function backdrop(callback) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
@ -178,7 +181,7 @@
/* MODAL PLUGIN DEFINITION
* ======================= */
$.fn.modal = function ( option ) {
$.fn.modal = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('modal')
@ -212,4 +215,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,14 +18,19 @@
* =========================================================== */
!function ( $ ) {
!function ($) {
"use strict"
"use strict"; // jshint ;_;
/* POPOVER PUBLIC CLASS DEFINITION
* =============================== */
var Popover = function ( element, options ) {
this.init('popover', element, options)
}
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
========================================== */
@ -59,7 +64,7 @@
return content
}
, tip: function() {
, tip: function () {
if (!this.$tip) {
this.$tip = $(this.options.template)
}
@ -72,7 +77,7 @@
/* POPOVER PLUGIN DEFINITION
* ======================= */
$.fn.popover = function ( option ) {
$.fn.popover = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('popover')
@ -90,4 +95,4 @@
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,9 +18,10 @@
* ============================================================== */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* SCROLLSPY CLASS DEFINITION
* ========================== */
@ -142,4 +143,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,9 +18,10 @@
* ======================================================== */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* TAB CLASS DEFINITION
* ==================== */
@ -131,4 +132,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

View File

@ -19,14 +19,15 @@
* ========================================================== */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* TOOLTIP PUBLIC CLASS DEFINITION
* =============================== */
var Tooltip = function ( element, options ) {
var Tooltip = function (element, options) {
this.init('tooltip', element, options)
}
@ -34,7 +35,7 @@
constructor: Tooltip
, init: function ( type, element, options ) {
, init: function (type, element, options) {
var eventIn
, eventOut
@ -55,7 +56,7 @@
this.fixTitle()
}
, getOptions: function ( options ) {
, getOptions: function (options) {
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
if (options.delay && typeof options.delay == 'number') {
@ -68,7 +69,7 @@
return options
}
, enter: function ( e ) {
, enter: function (e) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
if (!self.options.delay || !self.options.delay.show) {
@ -84,7 +85,7 @@
}
}
, leave: function ( e ) {
, leave: function (e) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
if (!self.options.delay || !self.options.delay.hide) {
@ -155,7 +156,7 @@
}
}
, isHTML: function( text ) {
, isHTML: function(text) {
// html string detection logic adapted from jQuery
return typeof text != 'string'
|| ( text.charAt(0) === "<"
@ -271,12 +272,12 @@
$.fn.tooltip.defaults = {
animation: true
, delay: 0
, selector: false
, placement: 'top'
, selector: false
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
, trigger: 'hover'
, title: ''
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
, delay: 0
}
}( window.jQuery );
}(window.jQuery);

View File

@ -18,11 +18,12 @@
* ========================================================== */
!function ( $ ) {
!function ($) {
$(function () {
"use strict"
"use strict"; // jshint ;_;
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */
@ -57,4 +58,4 @@
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,11 +18,15 @@
* ============================================================ */
!function( $ ){
!function($){
"use strict"
"use strict"; // jshint ;_;
var Typeahead = function ( element, options ) {
/* TYPEAHEAD PUBLIC CLASS DEFINITION
* ================================= */
var Typeahead = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.typeahead.defaults, options)
this.matcher = this.options.matcher || this.matcher
@ -111,7 +115,7 @@
}
, highlighter: function (item) {
var query = this.query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
return '<strong>' + match + '</strong>'
})
@ -241,7 +245,7 @@
/* TYPEAHEAD PLUGIN DEFINITION
* =========================== */
$.fn.typeahead = function ( option ) {
$.fn.typeahead = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('typeahead')
@ -273,4 +277,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

9
js/.jshintrc Normal file
View File

@ -0,0 +1,9 @@
{
"browser" : true,
"expr" : true,
"laxbreak" : true,
"boss" : true,
"asi" : true,
"laxcomma" : true,
"validthis": true
}

69
js/bootstrap-alert.js vendored
View File

@ -18,9 +18,10 @@
* ========================================================== */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* ALERT CLASS DEFINITION
* ====================== */
@ -30,43 +31,37 @@
$(el).on('click', dismiss, this.close)
}
Alert.prototype = {
Alert.prototype.close = function (e) {
var $this = $(this)
, selector = $this.attr('data-target')
, $parent
constructor: Alert
, close: function ( e ) {
var $this = $(this)
, selector = $this.attr('data-target')
, $parent
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
$parent = $(selector)
e && e.preventDefault()
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
$parent.trigger(e = $.Event('close'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
$parent
.trigger('closed')
.remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent.on($.support.transition.end, removeElement) :
removeElement()
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
$parent = $(selector)
e && e.preventDefault()
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
$parent.trigger(e = $.Event('close'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
$parent
.trigger('closed')
.remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent.on($.support.transition.end, removeElement) :
removeElement()
}
@ -92,4 +87,4 @@
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,58 +18,53 @@
* ============================================================ */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* BUTTON PUBLIC CLASS DEFINITION
* ============================== */
var Button = function ( element, options ) {
var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.button.defaults, options)
}
Button.prototype = {
Button.prototype.setState = function (state) {
var d = 'disabled'
, $el = this.$element
, data = $el.data()
, val = $el.is('input') ? 'val' : 'html'
constructor: Button
state = state + 'Text'
data.resetText || $el.data('resetText', $el[val]())
, setState: function ( state ) {
var d = 'disabled'
, $el = this.$element
, data = $el.data()
, val = $el.is('input') ? 'val' : 'html'
$el[val](data[state] || this.options[state])
state = state + 'Text'
data.resetText || $el.data('resetText', $el[val]())
// push to event loop to allow forms to submit
setTimeout(function () {
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d)
}, 0)
}
$el[val](data[state] || this.options[state])
Button.prototype.toggle = function () {
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
// push to event loop to allow forms to submit
setTimeout(function () {
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d)
}, 0)
}
, toggle: function () {
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
$parent && $parent
.find('.active')
.removeClass('active')
this.$element.toggleClass('active')
}
$parent && $parent
.find('.active')
.removeClass('active')
this.$element.toggleClass('active')
}
/* BUTTON PLUGIN DEFINITION
* ======================== */
$.fn.button = function ( option ) {
$.fn.button = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('button')
@ -98,4 +93,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,9 +18,10 @@
* ========================================================== */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* CAROUSEL CLASS DEFINITION
* ========================= */
@ -129,7 +130,7 @@
/* CAROUSEL PLUGIN DEFINITION
* ========================== */
$.fn.carousel = function ( option ) {
$.fn.carousel = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('carousel')
@ -162,4 +163,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,16 +18,20 @@
* ============================================================ */
!function ( $ ) {
!function ($) {
"use strict"
"use strict"; // jshint ;_;
var Collapse = function ( element, options ) {
this.$element = $(element)
/* COLLAPSE PUBLIC CLASS DEFINITION
* ================================ */
var Collapse = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.collapse.defaults, options)
if (this.options["parent"]) {
this.$parent = $(this.options["parent"])
if (this.options.parent) {
this.$parent = $(this.options.parent)
}
this.options.toggle && this.toggle()
@ -53,7 +57,6 @@
dimension = this.dimension()
scroll = $.camelCase(['scroll', dimension].join('-'))
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
hasData
if (actives && actives.length) {
hasData = actives.data('collapse')
@ -75,7 +78,7 @@
this.$element[dimension](0)
}
, reset: function ( size ) {
, reset: function (size) {
var dimension = this.dimension()
this.$element
@ -83,12 +86,12 @@
[dimension](size || 'auto')
[0].offsetWidth
this.$element[size != null ? 'addClass' : 'removeClass']('collapse')
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
return this
}
, transition: function ( method, startEvent, completeEvent ) {
, transition: function (method, startEvent, completeEvent) {
var that = this
, complete = function () {
if (startEvent == 'show') that.reset()
@ -107,18 +110,19 @@
$.support.transition && this.$element.hasClass('collapse') ?
this.$element.one($.support.transition.end, complete) :
complete()
}
}
, toggle: function () {
this[this.$element.hasClass('in') ? 'hide' : 'show']()
}
}
}
/* COLLAPSIBLE PLUGIN DEFINITION
/* COLLAPSIBLE PLUGIN DEFINITION
* ============================== */
$.fn.collapse = function ( option ) {
$.fn.collapse = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('collapse')
@ -149,4 +153,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,15 +18,16 @@
* ============================================================ */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* DROPDOWN CLASS DEFINITION
* ========================= */
var toggle = '[data-toggle="dropdown"]'
, Dropdown = function ( element ) {
, Dropdown = function (element) {
var $el = $(element).on('click.dropdown.data-api', this.toggle)
$('html').on('click.dropdown.data-api', function () {
$el.parent().removeClass('open')
@ -37,7 +38,7 @@
constructor: Dropdown
, toggle: function ( e ) {
, toggle: function (e) {
var $this = $(this)
, selector = $this.attr('data-target')
, $parent
@ -54,7 +55,8 @@
isActive = $parent.hasClass('open')
clearMenus()
!isActive && $parent.toggleClass('open')
if (!isActive) $parent.toggleClass('open')
return false
}
@ -69,7 +71,7 @@
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
$.fn.dropdown = function ( option ) {
$.fn.dropdown = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('dropdown')
@ -91,4 +93,4 @@
.on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
})
}( window.jQuery );
}(window.jQuery);

21
js/bootstrap-modal.js vendored
View File

@ -18,14 +18,15 @@
* ========================================================= */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* MODAL CLASS DEFINITION
* ====================== */
var Modal = function ( content, options ) {
var Modal = function (content, options) {
this.options = options
this.$element = $(content)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
@ -55,7 +56,9 @@
backdrop.call(this, function () {
var transition = $.support.transition && that.$element.hasClass('fade')
!that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
if (!that.$element.parent().length) {
that.$element.appendTo(document.body) //don't move modals dom position
}
that.$element
.show()
@ -73,7 +76,7 @@
})
}
, hide: function ( e ) {
, hide: function (e) {
e && e.preventDefault()
var that = this
@ -116,7 +119,7 @@
})
}
function hideModal( that ) {
function hideModal(that) {
this.$element
.hide()
.trigger('hidden')
@ -124,7 +127,7 @@
backdrop.call(this)
}
function backdrop( callback ) {
function backdrop(callback) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
@ -178,7 +181,7 @@
/* MODAL PLUGIN DEFINITION
* ======================= */
$.fn.modal = function ( option ) {
$.fn.modal = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('modal')
@ -212,4 +215,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,14 +18,19 @@
* =========================================================== */
!function ( $ ) {
!function ($) {
"use strict"
"use strict"; // jshint ;_;
/* POPOVER PUBLIC CLASS DEFINITION
* =============================== */
var Popover = function ( element, options ) {
this.init('popover', element, options)
}
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
========================================== */
@ -59,7 +64,7 @@
return content
}
, tip: function() {
, tip: function () {
if (!this.$tip) {
this.$tip = $(this.options.template)
}
@ -72,7 +77,7 @@
/* POPOVER PLUGIN DEFINITION
* ======================= */
$.fn.popover = function ( option ) {
$.fn.popover = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('popover')
@ -90,4 +95,4 @@
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,9 +18,10 @@
* ============================================================== */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* SCROLLSPY CLASS DEFINITION
* ========================== */
@ -142,4 +143,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

7
js/bootstrap-tab.js vendored
View File

@ -18,9 +18,10 @@
* ======================================================== */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* TAB CLASS DEFINITION
* ==================== */
@ -131,4 +132,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

View File

@ -19,14 +19,15 @@
* ========================================================== */
!function ( $ ) {
!function ($) {
"use strict"; // jshint ;_;
"use strict"
/* TOOLTIP PUBLIC CLASS DEFINITION
* =============================== */
var Tooltip = function ( element, options ) {
var Tooltip = function (element, options) {
this.init('tooltip', element, options)
}
@ -34,7 +35,7 @@
constructor: Tooltip
, init: function ( type, element, options ) {
, init: function (type, element, options) {
var eventIn
, eventOut
@ -55,7 +56,7 @@
this.fixTitle()
}
, getOptions: function ( options ) {
, getOptions: function (options) {
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
if (options.delay && typeof options.delay == 'number') {
@ -68,7 +69,7 @@
return options
}
, enter: function ( e ) {
, enter: function (e) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
if (!self.options.delay || !self.options.delay.show) {
@ -84,7 +85,7 @@
}
}
, leave: function ( e ) {
, leave: function (e) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
if (!self.options.delay || !self.options.delay.hide) {
@ -155,7 +156,7 @@
}
}
, isHTML: function( text ) {
, isHTML: function(text) {
// html string detection logic adapted from jQuery
return typeof text != 'string'
|| ( text.charAt(0) === "<"
@ -271,12 +272,12 @@
$.fn.tooltip.defaults = {
animation: true
, delay: 0
, selector: false
, placement: 'top'
, selector: false
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
, trigger: 'hover'
, title: ''
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
, delay: 0
}
}( window.jQuery );
}(window.jQuery);

View File

@ -18,11 +18,12 @@
* ========================================================== */
!function ( $ ) {
!function ($) {
$(function () {
"use strict"
"use strict"; // jshint ;_;
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */
@ -57,4 +58,4 @@
})
}( window.jQuery );
}(window.jQuery);

View File

@ -18,11 +18,15 @@
* ============================================================ */
!function( $ ){
!function($){
"use strict"
"use strict"; // jshint ;_;
var Typeahead = function ( element, options ) {
/* TYPEAHEAD PUBLIC CLASS DEFINITION
* ================================= */
var Typeahead = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.typeahead.defaults, options)
this.matcher = this.options.matcher || this.matcher
@ -111,7 +115,7 @@
}
, highlighter: function (item) {
var query = this.query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
return '<strong>' + match + '</strong>'
})
@ -241,7 +245,7 @@
/* TYPEAHEAD PLUGIN DEFINITION
* =========================== */
$.fn.typeahead = function ( option ) {
$.fn.typeahead = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('typeahead')
@ -273,4 +277,4 @@
})
})
}( window.jQuery );
}(window.jQuery);

View File

@ -3,7 +3,7 @@ $(function () {
module("bootstrap-transition")
test("should be defined on jquery support object", function () {
ok($.support.transition != undefined, 'transition object is defined')
ok($.support.transition !== undefined, 'transition object is defined')
})
test("should provide an end object", function () {

View File

@ -107,7 +107,7 @@ $(function () {
ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active")
$input.trigger({
type: 'keypress'
type: 'keydown'
, keyCode: 40
})
@ -115,7 +115,7 @@ $(function () {
$input.trigger({
type: 'keypress'
type: 'keydown'
, keyCode: 38
})