Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Thornton <jacobthornton@gmail.com>2012-04-15 03:29:53 +0400
committerJacob Thornton <jacobthornton@gmail.com>2012-04-15 03:29:53 +0400
commit575f18aaf49abb0289185f6409bee031947ccf69 (patch)
treed3548124fab9ba1affe9e056665a46a20432a5c7
parent8575a452942001bce522e8e258d9e192d24cb6ec (diff)
add jshint support + a few minor stylistic changes
-rw-r--r--Makefile2
-rw-r--r--README.md7
-rw-r--r--docs/assets/bootstrap.zipbin57441 -> 57461 bytes
-rw-r--r--docs/assets/js/bootstrap-alert.js55
-rw-r--r--docs/assets/js/bootstrap-button.js59
-rw-r--r--docs/assets/js/bootstrap-carousel.js9
-rw-r--r--docs/assets/js/bootstrap-collapse.js34
-rw-r--r--docs/assets/js/bootstrap-dropdown.js16
-rw-r--r--docs/assets/js/bootstrap-modal.js21
-rw-r--r--docs/assets/js/bootstrap-popover.js15
-rw-r--r--docs/assets/js/bootstrap-scrollspy.js7
-rw-r--r--docs/assets/js/bootstrap-tab.js7
-rw-r--r--docs/assets/js/bootstrap-tooltip.js25
-rw-r--r--docs/assets/js/bootstrap-transition.js7
-rw-r--r--docs/assets/js/bootstrap-typeahead.js16
-rw-r--r--js/.jshintrc9
-rw-r--r--js/bootstrap-alert.js55
-rw-r--r--js/bootstrap-button.js59
-rw-r--r--js/bootstrap-carousel.js9
-rw-r--r--js/bootstrap-collapse.js34
-rw-r--r--js/bootstrap-dropdown.js16
-rw-r--r--js/bootstrap-modal.js21
-rw-r--r--js/bootstrap-popover.js15
-rw-r--r--js/bootstrap-scrollspy.js7
-rw-r--r--js/bootstrap-tab.js7
-rw-r--r--js/bootstrap-tooltip.js25
-rw-r--r--js/bootstrap-transition.js7
-rw-r--r--js/bootstrap-typeahead.js16
-rw-r--r--js/tests/unit/bootstrap-transition.js2
29 files changed, 303 insertions, 259 deletions
diff --git a/Makefile b/Makefile
index 59cd451b72..8f57099b99 100644
--- a/Makefile
+++ b/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
diff --git a/README.md b/README.md
index 0a2a171d72..8907f059a3 100644
--- a/README.md
+++ b/README.md
@@ -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>
diff --git a/docs/assets/bootstrap.zip b/docs/assets/bootstrap.zip
index 671d7c68c5..0d3af08d2c 100644
--- a/docs/assets/bootstrap.zip
+++ b/docs/assets/bootstrap.zip
Binary files differ
diff --git a/docs/assets/js/bootstrap-alert.js b/docs/assets/js/bootstrap-alert.js
index c7171855d1..167a57f841 100644
--- a/docs/assets/js/bootstrap-alert.js
+++ b/docs/assets/js/bootstrap-alert.js
@@ -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 = {
-
- 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
- }
+ Alert.prototype.close = function (e) {
+ var $this = $(this)
+ , selector = $this.attr('data-target')
+ , $parent
- $parent = $(selector)
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ }
- e && e.preventDefault()
+ $parent = $(selector)
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
+ e && e.preventDefault()
- $parent.trigger(e = $.Event('close'))
+ $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
- if (e.isDefaultPrevented()) return
+ $parent.trigger(e = $.Event('close'))
- $parent.removeClass('in')
+ if (e.isDefaultPrevented()) return
- function removeElement() {
- $parent
- .trigger('closed')
- .remove()
- }
+ $parent.removeClass('in')
- $.support.transition && $parent.hasClass('fade') ?
- $parent.on($.support.transition.end, removeElement) :
- removeElement()
+ 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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-button.js b/docs/assets/js/bootstrap-button.js
index 77af03760b..49e88e49ad 100644
--- a/docs/assets/js/bootstrap-button.js
+++ b/docs/assets/js/bootstrap-button.js
@@ -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 = {
-
- constructor: Button
-
- , setState: function ( state ) {
- var d = 'disabled'
- , $el = this.$element
- , data = $el.data()
- , val = $el.is('input') ? 'val' : 'html'
+ Button.prototype.setState = function (state) {
+ var d = 'disabled'
+ , $el = this.$element
+ , data = $el.data()
+ , val = $el.is('input') ? 'val' : 'html'
- state = state + 'Text'
- data.resetText || $el.data('resetText', $el[val]())
+ state = state + 'Text'
+ data.resetText || $el.data('resetText', $el[val]())
- $el[val](data[state] || this.options[state])
+ $el[val](data[state] || this.options[state])
- // 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"]')
+ // 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)
+ }
- $parent && $parent
- .find('.active')
- .removeClass('active')
+ Button.prototype.toggle = function () {
+ var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
- 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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-carousel.js b/docs/assets/js/bootstrap-carousel.js
index 0c8c5a202a..d1c3079e44 100644
--- a/docs/assets/js/bootstrap-carousel.js
+++ b/docs/assets/js/bootstrap-carousel.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-collapse.js b/docs/assets/js/bootstrap-collapse.js
index 9f462e6bcc..30e139cf89 100644
--- a/docs/assets/js/bootstrap-collapse.js
+++ b/docs/assets/js/bootstrap-collapse.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-dropdown.js b/docs/assets/js/bootstrap-dropdown.js
index 661b22713c..f27f4d2f43 100644
--- a/docs/assets/js/bootstrap-dropdown.js
+++ b/docs/assets/js/bootstrap-dropdown.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-modal.js b/docs/assets/js/bootstrap-modal.js
index f16b565003..959433f2ae 100644
--- a/docs/assets/js/bootstrap-modal.js
+++ b/docs/assets/js/bootstrap-modal.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-popover.js b/docs/assets/js/bootstrap-popover.js
index df6ef3dfff..51820979a4 100644
--- a/docs/assets/js/bootstrap-popover.js
+++ b/docs/assets/js/bootstrap-popover.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-scrollspy.js b/docs/assets/js/bootstrap-scrollspy.js
index 518ccafb24..3dee609c73 100644
--- a/docs/assets/js/bootstrap-scrollspy.js
+++ b/docs/assets/js/bootstrap-scrollspy.js
@@ -18,9 +18,10 @@
* ============================================================== */
-!function ( $ ) {
+!function ($) {
+
+ "use strict"; // jshint ;_;
- "use strict"
/* SCROLLSPY CLASS DEFINITION
* ========================== */
@@ -142,4 +143,4 @@
})
})
-}( window.jQuery ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-tab.js b/docs/assets/js/bootstrap-tab.js
index d46ef790a7..6255d53ef5 100644
--- a/docs/assets/js/bootstrap-tab.js
+++ b/docs/assets/js/bootstrap-tab.js
@@ -18,9 +18,10 @@
* ======================================================== */
-!function ( $ ) {
+!function ($) {
+
+ "use strict"; // jshint ;_;
- "use strict"
/* TAB CLASS DEFINITION
* ==================== */
@@ -131,4 +132,4 @@
})
})
-}( window.jQuery ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-tooltip.js b/docs/assets/js/bootstrap-tooltip.js
index 2f9254ed2a..454e7a4484 100644
--- a/docs/assets/js/bootstrap-tooltip.js
+++ b/docs/assets/js/bootstrap-tooltip.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-transition.js b/docs/assets/js/bootstrap-transition.js
index 8ff3c90023..d34caa1b98 100644
--- a/docs/assets/js/bootstrap-transition.js
+++ b/docs/assets/js/bootstrap-transition.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-typeahead.js b/docs/assets/js/bootstrap-typeahead.js
index 3876e63071..526cf320c3 100644
--- a/docs/assets/js/bootstrap-typeahead.js
+++ b/docs/assets/js/bootstrap-typeahead.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/.jshintrc b/js/.jshintrc
new file mode 100644
index 0000000000..bb41ef9cc8
--- /dev/null
+++ b/js/.jshintrc
@@ -0,0 +1,9 @@
+{
+ "browser" : true,
+ "expr" : true,
+ "laxbreak" : true,
+ "boss" : true,
+ "asi" : true,
+ "laxcomma" : true,
+ "validthis": true
+} \ No newline at end of file
diff --git a/js/bootstrap-alert.js b/js/bootstrap-alert.js
index c7171855d1..167a57f841 100644
--- a/js/bootstrap-alert.js
+++ b/js/bootstrap-alert.js
@@ -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 = {
-
- 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
- }
+ Alert.prototype.close = function (e) {
+ var $this = $(this)
+ , selector = $this.attr('data-target')
+ , $parent
- $parent = $(selector)
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ }
- e && e.preventDefault()
+ $parent = $(selector)
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
+ e && e.preventDefault()
- $parent.trigger(e = $.Event('close'))
+ $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
- if (e.isDefaultPrevented()) return
+ $parent.trigger(e = $.Event('close'))
- $parent.removeClass('in')
+ if (e.isDefaultPrevented()) return
- function removeElement() {
- $parent
- .trigger('closed')
- .remove()
- }
+ $parent.removeClass('in')
- $.support.transition && $parent.hasClass('fade') ?
- $parent.on($.support.transition.end, removeElement) :
- removeElement()
+ 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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/bootstrap-button.js b/js/bootstrap-button.js
index 77af03760b..49e88e49ad 100644
--- a/js/bootstrap-button.js
+++ b/js/bootstrap-button.js
@@ -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 = {
-
- constructor: Button
-
- , setState: function ( state ) {
- var d = 'disabled'
- , $el = this.$element
- , data = $el.data()
- , val = $el.is('input') ? 'val' : 'html'
+ Button.prototype.setState = function (state) {
+ var d = 'disabled'
+ , $el = this.$element
+ , data = $el.data()
+ , val = $el.is('input') ? 'val' : 'html'
- state = state + 'Text'
- data.resetText || $el.data('resetText', $el[val]())
+ state = state + 'Text'
+ data.resetText || $el.data('resetText', $el[val]())
- $el[val](data[state] || this.options[state])
+ $el[val](data[state] || this.options[state])
- // 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"]')
+ // 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)
+ }
- $parent && $parent
- .find('.active')
- .removeClass('active')
+ Button.prototype.toggle = function () {
+ var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
- 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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/bootstrap-carousel.js b/js/bootstrap-carousel.js
index 0c8c5a202a..d1c3079e44 100644
--- a/js/bootstrap-carousel.js
+++ b/js/bootstrap-carousel.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/bootstrap-collapse.js b/js/bootstrap-collapse.js
index 9f462e6bcc..30e139cf89 100644
--- a/js/bootstrap-collapse.js
+++ b/js/bootstrap-collapse.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/bootstrap-dropdown.js b/js/bootstrap-dropdown.js
index 661b22713c..f27f4d2f43 100644
--- a/js/bootstrap-dropdown.js
+++ b/js/bootstrap-dropdown.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js
index f16b565003..959433f2ae 100644
--- a/js/bootstrap-modal.js
+++ b/js/bootstrap-modal.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/bootstrap-popover.js b/js/bootstrap-popover.js
index df6ef3dfff..51820979a4 100644
--- a/js/bootstrap-popover.js
+++ b/js/bootstrap-popover.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/bootstrap-scrollspy.js b/js/bootstrap-scrollspy.js
index 518ccafb24..3dee609c73 100644
--- a/js/bootstrap-scrollspy.js
+++ b/js/bootstrap-scrollspy.js
@@ -18,9 +18,10 @@
* ============================================================== */
-!function ( $ ) {
+!function ($) {
+
+ "use strict"; // jshint ;_;
- "use strict"
/* SCROLLSPY CLASS DEFINITION
* ========================== */
@@ -142,4 +143,4 @@
})
})
-}( window.jQuery ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/bootstrap-tab.js b/js/bootstrap-tab.js
index d46ef790a7..6255d53ef5 100644
--- a/js/bootstrap-tab.js
+++ b/js/bootstrap-tab.js
@@ -18,9 +18,10 @@
* ======================================================== */
-!function ( $ ) {
+!function ($) {
+
+ "use strict"; // jshint ;_;
- "use strict"
/* TAB CLASS DEFINITION
* ==================== */
@@ -131,4 +132,4 @@
})
})
-}( window.jQuery ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js
index 2f9254ed2a..454e7a4484 100644
--- a/js/bootstrap-tooltip.js
+++ b/js/bootstrap-tooltip.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/bootstrap-transition.js b/js/bootstrap-transition.js
index 8ff3c90023..d34caa1b98 100644
--- a/js/bootstrap-transition.js
+++ b/js/bootstrap-transition.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/bootstrap-typeahead.js b/js/bootstrap-typeahead.js
index 3876e63071..526cf320c3 100644
--- a/js/bootstrap-typeahead.js
+++ b/js/bootstrap-typeahead.js
@@ -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 ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file
diff --git a/js/tests/unit/bootstrap-transition.js b/js/tests/unit/bootstrap-transition.js
index 3f28d2676d..086773fa27 100644
--- a/js/tests/unit/bootstrap-transition.js
+++ b/js/tests/unit/bootstrap-transition.js
@@ -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 () {