mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-27 13:59:06 +02:00
add jshint support + a few minor stylistic changes
This commit is contained in:
2
Makefile
2
Makefile
@@ -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
|
||||
|
@@ -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 »</a>
|
||||
|
||||
|
Binary file not shown.
11
docs/assets/js/bootstrap-alert.js
vendored
11
docs/assets/js/bootstrap-alert.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* ALERT CLASS DEFINITION
|
||||
* ====================== */
|
||||
@@ -30,11 +31,7 @@
|
||||
$(el).on('click', dismiss, this.close)
|
||||
}
|
||||
|
||||
Alert.prototype = {
|
||||
|
||||
constructor: Alert
|
||||
|
||||
, close: function ( e ) {
|
||||
Alert.prototype.close = function (e) {
|
||||
var $this = $(this)
|
||||
, selector = $this.attr('data-target')
|
||||
, $parent
|
||||
@@ -67,8 +64,6 @@
|
||||
removeElement()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ALERT PLUGIN DEFINITION
|
||||
* ======================= */
|
||||
|
13
docs/assets/js/bootstrap-button.js
vendored
13
docs/assets/js/bootstrap-button.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* BUTTON PUBLIC CLASS DEFINITION
|
||||
* ============================== */
|
||||
@@ -30,11 +31,7 @@
|
||||
this.options = $.extend({}, $.fn.button.defaults, options)
|
||||
}
|
||||
|
||||
Button.prototype = {
|
||||
|
||||
constructor: Button
|
||||
|
||||
, setState: function ( state ) {
|
||||
Button.prototype.setState = function (state) {
|
||||
var d = 'disabled'
|
||||
, $el = this.$element
|
||||
, data = $el.data()
|
||||
@@ -53,7 +50,7 @@
|
||||
}, 0)
|
||||
}
|
||||
|
||||
, toggle: function () {
|
||||
Button.prototype.toggle = function () {
|
||||
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
|
||||
|
||||
$parent && $parent
|
||||
@@ -63,8 +60,6 @@
|
||||
this.$element.toggleClass('active')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* BUTTON PLUGIN DEFINITION
|
||||
* ======================== */
|
||||
|
3
docs/assets/js/bootstrap-carousel.js
vendored
3
docs/assets/js/bootstrap-carousel.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* CAROUSEL CLASS DEFINITION
|
||||
* ========================= */
|
||||
|
14
docs/assets/js/bootstrap-collapse.js
vendored
14
docs/assets/js/bootstrap-collapse.js
vendored
@@ -20,14 +20,18 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* 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')
|
||||
@@ -83,7 +86,7 @@
|
||||
[dimension](size || 'auto')
|
||||
[0].offsetWidth
|
||||
|
||||
this.$element[size != null ? 'addClass' : 'removeClass']('collapse')
|
||||
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
|
||||
|
||||
return this
|
||||
}
|
||||
@@ -115,6 +118,7 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* COLLAPSIBLE PLUGIN DEFINITION
|
||||
* ============================== */
|
||||
|
||||
|
6
docs/assets/js/bootstrap-dropdown.js
vendored
6
docs/assets/js/bootstrap-dropdown.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* DROPDOWN CLASS DEFINITION
|
||||
* ========================= */
|
||||
@@ -54,7 +55,8 @@
|
||||
isActive = $parent.hasClass('open')
|
||||
|
||||
clearMenus()
|
||||
!isActive && $parent.toggleClass('open')
|
||||
|
||||
if (!isActive) $parent.toggleClass('open')
|
||||
|
||||
return false
|
||||
}
|
||||
|
7
docs/assets/js/bootstrap-modal.js
vendored
7
docs/assets/js/bootstrap-modal.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* MODAL CLASS DEFINITION
|
||||
* ====================== */
|
||||
@@ -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()
|
||||
|
7
docs/assets/js/bootstrap-popover.js
vendored
7
docs/assets/js/bootstrap-popover.js
vendored
@@ -20,12 +20,17 @@
|
||||
|
||||
!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
|
||||
========================================== */
|
||||
|
||||
|
3
docs/assets/js/bootstrap-scrollspy.js
vendored
3
docs/assets/js/bootstrap-scrollspy.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* SCROLLSPY CLASS DEFINITION
|
||||
* ========================== */
|
||||
|
3
docs/assets/js/bootstrap-tab.js
vendored
3
docs/assets/js/bootstrap-tab.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* TAB CLASS DEFINITION
|
||||
* ==================== */
|
||||
|
9
docs/assets/js/bootstrap-tooltip.js
vendored
9
docs/assets/js/bootstrap-tooltip.js
vendored
@@ -21,7 +21,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* TOOLTIP PUBLIC CLASS DEFINITION
|
||||
* =============================== */
|
||||
@@ -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);
|
3
docs/assets/js/bootstrap-transition.js
vendored
3
docs/assets/js/bootstrap-transition.js
vendored
@@ -22,7 +22,8 @@
|
||||
|
||||
$(function () {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
|
||||
* ======================================================= */
|
||||
|
8
docs/assets/js/bootstrap-typeahead.js
vendored
8
docs/assets/js/bootstrap-typeahead.js
vendored
@@ -20,7 +20,11 @@
|
||||
|
||||
!function($){
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* TYPEAHEAD PUBLIC CLASS DEFINITION
|
||||
* ================================= */
|
||||
|
||||
var Typeahead = function (element, options) {
|
||||
this.$element = $(element)
|
||||
@@ -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>'
|
||||
})
|
||||
|
9
js/.jshintrc
Normal file
9
js/.jshintrc
Normal 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
11
js/bootstrap-alert.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* ALERT CLASS DEFINITION
|
||||
* ====================== */
|
||||
@@ -30,11 +31,7 @@
|
||||
$(el).on('click', dismiss, this.close)
|
||||
}
|
||||
|
||||
Alert.prototype = {
|
||||
|
||||
constructor: Alert
|
||||
|
||||
, close: function ( e ) {
|
||||
Alert.prototype.close = function (e) {
|
||||
var $this = $(this)
|
||||
, selector = $this.attr('data-target')
|
||||
, $parent
|
||||
@@ -67,8 +64,6 @@
|
||||
removeElement()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ALERT PLUGIN DEFINITION
|
||||
* ======================= */
|
||||
|
13
js/bootstrap-button.js
vendored
13
js/bootstrap-button.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* BUTTON PUBLIC CLASS DEFINITION
|
||||
* ============================== */
|
||||
@@ -30,11 +31,7 @@
|
||||
this.options = $.extend({}, $.fn.button.defaults, options)
|
||||
}
|
||||
|
||||
Button.prototype = {
|
||||
|
||||
constructor: Button
|
||||
|
||||
, setState: function ( state ) {
|
||||
Button.prototype.setState = function (state) {
|
||||
var d = 'disabled'
|
||||
, $el = this.$element
|
||||
, data = $el.data()
|
||||
@@ -53,7 +50,7 @@
|
||||
}, 0)
|
||||
}
|
||||
|
||||
, toggle: function () {
|
||||
Button.prototype.toggle = function () {
|
||||
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
|
||||
|
||||
$parent && $parent
|
||||
@@ -63,8 +60,6 @@
|
||||
this.$element.toggleClass('active')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* BUTTON PLUGIN DEFINITION
|
||||
* ======================== */
|
||||
|
3
js/bootstrap-carousel.js
vendored
3
js/bootstrap-carousel.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* CAROUSEL CLASS DEFINITION
|
||||
* ========================= */
|
||||
|
14
js/bootstrap-collapse.js
vendored
14
js/bootstrap-collapse.js
vendored
@@ -20,14 +20,18 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* 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')
|
||||
@@ -83,7 +86,7 @@
|
||||
[dimension](size || 'auto')
|
||||
[0].offsetWidth
|
||||
|
||||
this.$element[size != null ? 'addClass' : 'removeClass']('collapse')
|
||||
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
|
||||
|
||||
return this
|
||||
}
|
||||
@@ -115,6 +118,7 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* COLLAPSIBLE PLUGIN DEFINITION
|
||||
* ============================== */
|
||||
|
||||
|
6
js/bootstrap-dropdown.js
vendored
6
js/bootstrap-dropdown.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* DROPDOWN CLASS DEFINITION
|
||||
* ========================= */
|
||||
@@ -54,7 +55,8 @@
|
||||
isActive = $parent.hasClass('open')
|
||||
|
||||
clearMenus()
|
||||
!isActive && $parent.toggleClass('open')
|
||||
|
||||
if (!isActive) $parent.toggleClass('open')
|
||||
|
||||
return false
|
||||
}
|
||||
|
7
js/bootstrap-modal.js
vendored
7
js/bootstrap-modal.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* MODAL CLASS DEFINITION
|
||||
* ====================== */
|
||||
@@ -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()
|
||||
|
7
js/bootstrap-popover.js
vendored
7
js/bootstrap-popover.js
vendored
@@ -20,12 +20,17 @@
|
||||
|
||||
!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
|
||||
========================================== */
|
||||
|
||||
|
3
js/bootstrap-scrollspy.js
vendored
3
js/bootstrap-scrollspy.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* SCROLLSPY CLASS DEFINITION
|
||||
* ========================== */
|
||||
|
3
js/bootstrap-tab.js
vendored
3
js/bootstrap-tab.js
vendored
@@ -20,7 +20,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* TAB CLASS DEFINITION
|
||||
* ==================== */
|
||||
|
9
js/bootstrap-tooltip.js
vendored
9
js/bootstrap-tooltip.js
vendored
@@ -21,7 +21,8 @@
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* TOOLTIP PUBLIC CLASS DEFINITION
|
||||
* =============================== */
|
||||
@@ -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);
|
3
js/bootstrap-transition.js
vendored
3
js/bootstrap-transition.js
vendored
@@ -22,7 +22,8 @@
|
||||
|
||||
$(function () {
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
|
||||
* ======================================================= */
|
||||
|
8
js/bootstrap-typeahead.js
vendored
8
js/bootstrap-typeahead.js
vendored
@@ -20,7 +20,11 @@
|
||||
|
||||
!function($){
|
||||
|
||||
"use strict"
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* TYPEAHEAD PUBLIC CLASS DEFINITION
|
||||
* ================================= */
|
||||
|
||||
var Typeahead = function (element, options) {
|
||||
this.$element = $(element)
|
||||
@@ -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>'
|
||||
})
|
||||
|
2
js/tests/unit/bootstrap-transition.js
vendored
2
js/tests/unit/bootstrap-transition.js
vendored
@@ -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 () {
|
||||
|
Reference in New Issue
Block a user