1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-12 08:34:08 +02: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
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 --yui-compress ${BOOTSTRAP_LESS} > bootstrap/css/bootstrap.min.css
lessc ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.css lessc ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.css
lessc --yui-compress ${BOOTSTRAP_RESPONSIVE_LESS} > bootstrap/css/bootstrap-responsive.min.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 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 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 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. 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` + **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> 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() 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) $win.on('scroll', processScroll)
function processScroll() { function processScroll() {

View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* ALERT CLASS DEFINITION /* ALERT CLASS DEFINITION
* ====================== */ * ====================== */
@@ -30,11 +31,7 @@
$(el).on('click', dismiss, this.close) $(el).on('click', dismiss, this.close)
} }
Alert.prototype = { Alert.prototype.close = function (e) {
constructor: Alert
, close: function ( e ) {
var $this = $(this) var $this = $(this)
, selector = $this.attr('data-target') , selector = $this.attr('data-target')
, $parent , $parent
@@ -67,8 +64,6 @@
removeElement() removeElement()
} }
}
/* ALERT PLUGIN DEFINITION /* ALERT PLUGIN DEFINITION
* ======================= */ * ======================= */

View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* BUTTON PUBLIC CLASS DEFINITION /* BUTTON PUBLIC CLASS DEFINITION
* ============================== */ * ============================== */
@@ -30,11 +31,7 @@
this.options = $.extend({}, $.fn.button.defaults, options) this.options = $.extend({}, $.fn.button.defaults, options)
} }
Button.prototype = { Button.prototype.setState = function (state) {
constructor: Button
, setState: function ( state ) {
var d = 'disabled' var d = 'disabled'
, $el = this.$element , $el = this.$element
, data = $el.data() , data = $el.data()
@@ -53,7 +50,7 @@
}, 0) }, 0)
} }
, toggle: function () { Button.prototype.toggle = function () {
var $parent = this.$element.parent('[data-toggle="buttons-radio"]') var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
$parent && $parent $parent && $parent
@@ -63,8 +60,6 @@
this.$element.toggleClass('active') this.$element.toggleClass('active')
} }
}
/* BUTTON PLUGIN DEFINITION /* BUTTON PLUGIN DEFINITION
* ======================== */ * ======================== */

View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* CAROUSEL CLASS DEFINITION /* CAROUSEL CLASS DEFINITION
* ========================= */ * ========================= */

View File

@@ -20,14 +20,18 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* COLLAPSE PUBLIC CLASS DEFINITION
* ================================ */
var Collapse = function (element, options) { var Collapse = function (element, options) {
this.$element = $(element) this.$element = $(element)
this.options = $.extend({}, $.fn.collapse.defaults, options) this.options = $.extend({}, $.fn.collapse.defaults, options)
if (this.options["parent"]) { if (this.options.parent) {
this.$parent = $(this.options["parent"]) this.$parent = $(this.options.parent)
} }
this.options.toggle && this.toggle() this.options.toggle && this.toggle()
@@ -53,7 +57,6 @@
dimension = this.dimension() dimension = this.dimension()
scroll = $.camelCase(['scroll', dimension].join('-')) scroll = $.camelCase(['scroll', dimension].join('-'))
actives = this.$parent && this.$parent.find('> .accordion-group > .in') actives = this.$parent && this.$parent.find('> .accordion-group > .in')
hasData
if (actives && actives.length) { if (actives && actives.length) {
hasData = actives.data('collapse') hasData = actives.data('collapse')
@@ -83,7 +86,7 @@
[dimension](size || 'auto') [dimension](size || 'auto')
[0].offsetWidth [0].offsetWidth
this.$element[size != null ? 'addClass' : 'removeClass']('collapse') this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
return this return this
} }
@@ -115,6 +118,7 @@
} }
/* COLLAPSIBLE PLUGIN DEFINITION /* COLLAPSIBLE PLUGIN DEFINITION
* ============================== */ * ============================== */

View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* DROPDOWN CLASS DEFINITION /* DROPDOWN CLASS DEFINITION
* ========================= */ * ========================= */
@@ -54,7 +55,8 @@
isActive = $parent.hasClass('open') isActive = $parent.hasClass('open')
clearMenus() clearMenus()
!isActive && $parent.toggleClass('open')
if (!isActive) $parent.toggleClass('open')
return false return false
} }

View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* MODAL CLASS DEFINITION /* MODAL CLASS DEFINITION
* ====================== */ * ====================== */
@@ -55,7 +56,9 @@
backdrop.call(this, function () { backdrop.call(this, function () {
var transition = $.support.transition && that.$element.hasClass('fade') 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 that.$element
.show() .show()

View File

@@ -20,12 +20,17 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* POPOVER PUBLIC CLASS DEFINITION
* =============================== */
var Popover = function ( element, options ) { var Popover = function ( element, options ) {
this.init('popover', element, options) this.init('popover', element, options)
} }
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
========================================== */ ========================================== */

View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* SCROLLSPY CLASS DEFINITION /* SCROLLSPY CLASS DEFINITION
* ========================== */ * ========================== */

View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* TAB CLASS DEFINITION /* TAB CLASS DEFINITION
* ==================== */ * ==================== */

View File

@@ -21,7 +21,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* TOOLTIP PUBLIC CLASS DEFINITION /* TOOLTIP PUBLIC CLASS DEFINITION
* =============================== */ * =============================== */
@@ -271,12 +272,12 @@
$.fn.tooltip.defaults = { $.fn.tooltip.defaults = {
animation: true animation: true
, delay: 0
, selector: false
, placement: 'top' , placement: 'top'
, selector: false
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
, trigger: 'hover' , trigger: 'hover'
, title: '' , title: ''
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' , delay: 0
} }
}(window.jQuery); }(window.jQuery);

View File

@@ -22,7 +22,8 @@
$(function () { $(function () {
"use strict" "use strict"; // jshint ;_;
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/) /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */ * ======================================================= */

View File

@@ -20,7 +20,11 @@
!function($){ !function($){
"use strict" "use strict"; // jshint ;_;
/* TYPEAHEAD PUBLIC CLASS DEFINITION
* ================================= */
var Typeahead = function (element, options) { var Typeahead = function (element, options) {
this.$element = $(element) this.$element = $(element)
@@ -111,7 +115,7 @@
} }
, highlighter: function (item) { , 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 item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
return '<strong>' + match + '</strong>' return '<strong>' + match + '</strong>'
}) })

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
}

11
js/bootstrap-alert.js vendored
View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* ALERT CLASS DEFINITION /* ALERT CLASS DEFINITION
* ====================== */ * ====================== */
@@ -30,11 +31,7 @@
$(el).on('click', dismiss, this.close) $(el).on('click', dismiss, this.close)
} }
Alert.prototype = { Alert.prototype.close = function (e) {
constructor: Alert
, close: function ( e ) {
var $this = $(this) var $this = $(this)
, selector = $this.attr('data-target') , selector = $this.attr('data-target')
, $parent , $parent
@@ -67,8 +64,6 @@
removeElement() removeElement()
} }
}
/* ALERT PLUGIN DEFINITION /* ALERT PLUGIN DEFINITION
* ======================= */ * ======================= */

View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* BUTTON PUBLIC CLASS DEFINITION /* BUTTON PUBLIC CLASS DEFINITION
* ============================== */ * ============================== */
@@ -30,11 +31,7 @@
this.options = $.extend({}, $.fn.button.defaults, options) this.options = $.extend({}, $.fn.button.defaults, options)
} }
Button.prototype = { Button.prototype.setState = function (state) {
constructor: Button
, setState: function ( state ) {
var d = 'disabled' var d = 'disabled'
, $el = this.$element , $el = this.$element
, data = $el.data() , data = $el.data()
@@ -53,7 +50,7 @@
}, 0) }, 0)
} }
, toggle: function () { Button.prototype.toggle = function () {
var $parent = this.$element.parent('[data-toggle="buttons-radio"]') var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
$parent && $parent $parent && $parent
@@ -63,8 +60,6 @@
this.$element.toggleClass('active') this.$element.toggleClass('active')
} }
}
/* BUTTON PLUGIN DEFINITION /* BUTTON PLUGIN DEFINITION
* ======================== */ * ======================== */

View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* CAROUSEL CLASS DEFINITION /* CAROUSEL CLASS DEFINITION
* ========================= */ * ========================= */

View File

@@ -20,14 +20,18 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* COLLAPSE PUBLIC CLASS DEFINITION
* ================================ */
var Collapse = function (element, options) { var Collapse = function (element, options) {
this.$element = $(element) this.$element = $(element)
this.options = $.extend({}, $.fn.collapse.defaults, options) this.options = $.extend({}, $.fn.collapse.defaults, options)
if (this.options["parent"]) { if (this.options.parent) {
this.$parent = $(this.options["parent"]) this.$parent = $(this.options.parent)
} }
this.options.toggle && this.toggle() this.options.toggle && this.toggle()
@@ -53,7 +57,6 @@
dimension = this.dimension() dimension = this.dimension()
scroll = $.camelCase(['scroll', dimension].join('-')) scroll = $.camelCase(['scroll', dimension].join('-'))
actives = this.$parent && this.$parent.find('> .accordion-group > .in') actives = this.$parent && this.$parent.find('> .accordion-group > .in')
hasData
if (actives && actives.length) { if (actives && actives.length) {
hasData = actives.data('collapse') hasData = actives.data('collapse')
@@ -83,7 +86,7 @@
[dimension](size || 'auto') [dimension](size || 'auto')
[0].offsetWidth [0].offsetWidth
this.$element[size != null ? 'addClass' : 'removeClass']('collapse') this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
return this return this
} }
@@ -115,6 +118,7 @@
} }
/* COLLAPSIBLE PLUGIN DEFINITION /* COLLAPSIBLE PLUGIN DEFINITION
* ============================== */ * ============================== */

View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* DROPDOWN CLASS DEFINITION /* DROPDOWN CLASS DEFINITION
* ========================= */ * ========================= */
@@ -54,7 +55,8 @@
isActive = $parent.hasClass('open') isActive = $parent.hasClass('open')
clearMenus() clearMenus()
!isActive && $parent.toggleClass('open')
if (!isActive) $parent.toggleClass('open')
return false return false
} }

View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* MODAL CLASS DEFINITION /* MODAL CLASS DEFINITION
* ====================== */ * ====================== */
@@ -55,7 +56,9 @@
backdrop.call(this, function () { backdrop.call(this, function () {
var transition = $.support.transition && that.$element.hasClass('fade') 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 that.$element
.show() .show()

View File

@@ -20,12 +20,17 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* POPOVER PUBLIC CLASS DEFINITION
* =============================== */
var Popover = function ( element, options ) { var Popover = function ( element, options ) {
this.init('popover', element, options) this.init('popover', element, options)
} }
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
========================================== */ ========================================== */

View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* SCROLLSPY CLASS DEFINITION /* SCROLLSPY CLASS DEFINITION
* ========================== */ * ========================== */

3
js/bootstrap-tab.js vendored
View File

@@ -20,7 +20,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* TAB CLASS DEFINITION /* TAB CLASS DEFINITION
* ==================== */ * ==================== */

View File

@@ -21,7 +21,8 @@
!function ($) { !function ($) {
"use strict" "use strict"; // jshint ;_;
/* TOOLTIP PUBLIC CLASS DEFINITION /* TOOLTIP PUBLIC CLASS DEFINITION
* =============================== */ * =============================== */
@@ -271,12 +272,12 @@
$.fn.tooltip.defaults = { $.fn.tooltip.defaults = {
animation: true animation: true
, delay: 0
, selector: false
, placement: 'top' , placement: 'top'
, selector: false
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
, trigger: 'hover' , trigger: 'hover'
, title: '' , title: ''
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' , delay: 0
} }
}(window.jQuery); }(window.jQuery);

View File

@@ -22,7 +22,8 @@
$(function () { $(function () {
"use strict" "use strict"; // jshint ;_;
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/) /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */ * ======================================================= */

View File

@@ -20,7 +20,11 @@
!function($){ !function($){
"use strict" "use strict"; // jshint ;_;
/* TYPEAHEAD PUBLIC CLASS DEFINITION
* ================================= */
var Typeahead = function (element, options) { var Typeahead = function (element, options) {
this.$element = $(element) this.$element = $(element)
@@ -111,7 +115,7 @@
} }
, highlighter: function (item) { , 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 item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
return '<strong>' + match + '</strong>' return '<strong>' + match + '</strong>'
}) })

View File

@@ -3,7 +3,7 @@ $(function () {
module("bootstrap-transition") module("bootstrap-transition")
test("should be defined on jquery support object", function () { 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 () { 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") ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active")
$input.trigger({ $input.trigger({
type: 'keypress' type: 'keydown'
, keyCode: 40 , keyCode: 40
}) })
@@ -115,7 +115,7 @@ $(function () {
$input.trigger({ $input.trigger({
type: 'keypress' type: 'keydown'
, keyCode: 38 , keyCode: 38
}) })