less-rails-bootstrap 2.3.3 → 3.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +7 -11
  4. data/lib/less/rails/bootstrap/version.rb +1 -1
  5. data/scripts/update_bootstrap.sh +37 -8
  6. data/test/cases/usage_css_spec.rb +15 -12
  7. data/test/cases/usage_js_spec.rb +4 -4
  8. data/test/dummy_app/app/assets/stylesheets/fonts.css.less +2 -0
  9. data/test/dummy_app/app/assets/stylesheets/framework.css.less +4 -2
  10. data/test/dummy_app/app/assets/stylesheets/individual.css.less +2 -2
  11. data/test/spec_helper.rb +1 -2
  12. data/vendor/assets/javascripts/twitter/bootstrap.js +0 -1
  13. data/vendor/assets/javascripts/twitter/bootstrap/affix.js +58 -49
  14. data/vendor/assets/javascripts/twitter/bootstrap/alert.js +36 -37
  15. data/vendor/assets/javascripts/twitter/bootstrap/button.js +41 -39
  16. data/vendor/assets/javascripts/twitter/bootstrap/carousel.js +131 -125
  17. data/vendor/assets/javascripts/twitter/bootstrap/collapse.js +108 -96
  18. data/vendor/assets/javascripts/twitter/bootstrap/dropdown.js +72 -87
  19. data/vendor/assets/javascripts/twitter/bootstrap/modal.js +149 -155
  20. data/vendor/assets/javascripts/twitter/bootstrap/popover.js +60 -59
  21. data/vendor/assets/javascripts/twitter/bootstrap/scrollspy.js +103 -107
  22. data/vendor/assets/javascripts/twitter/bootstrap/tab.js +73 -82
  23. data/vendor/assets/javascripts/twitter/bootstrap/tooltip.js +258 -255
  24. data/vendor/assets/javascripts/twitter/bootstrap/transition.js +34 -38
  25. data/vendor/frameworks/twitter/bootstrap/accordion.less +9 -12
  26. data/vendor/frameworks/twitter/bootstrap/alerts.less +43 -53
  27. data/vendor/frameworks/twitter/bootstrap/bootstrap.less +21 -21
  28. data/vendor/frameworks/twitter/bootstrap/breadcrumbs.less +7 -8
  29. data/vendor/frameworks/twitter/bootstrap/button-groups.less +93 -151
  30. data/vendor/frameworks/twitter/bootstrap/buttons.less +93 -164
  31. data/vendor/frameworks/twitter/bootstrap/carousel.less +110 -63
  32. data/vendor/frameworks/twitter/bootstrap/close.less +18 -17
  33. data/vendor/frameworks/twitter/bootstrap/code.less +14 -20
  34. data/vendor/frameworks/twitter/bootstrap/component-animations.less +10 -3
  35. data/vendor/frameworks/twitter/bootstrap/dropdowns.less +66 -143
  36. data/vendor/frameworks/twitter/bootstrap/forms.less +281 -548
  37. data/vendor/frameworks/twitter/bootstrap/grid.less +194 -11
  38. data/vendor/frameworks/twitter/bootstrap/media.less +8 -7
  39. data/vendor/frameworks/twitter/bootstrap/mixins.less +290 -446
  40. data/vendor/frameworks/twitter/bootstrap/modals.less +92 -51
  41. data/vendor/frameworks/twitter/bootstrap/navbar.less +285 -402
  42. data/vendor/frameworks/twitter/bootstrap/navs.less +176 -348
  43. data/vendor/frameworks/twitter/bootstrap/pager.less +45 -33
  44. data/vendor/frameworks/twitter/bootstrap/pagination.less +89 -104
  45. data/vendor/frameworks/twitter/bootstrap/popovers.less +53 -51
  46. data/vendor/frameworks/twitter/bootstrap/progress-bars.less +28 -45
  47. data/vendor/frameworks/twitter/bootstrap/responsive-utilities.less +92 -32
  48. data/vendor/frameworks/twitter/bootstrap/scaffolding.less +60 -18
  49. data/vendor/frameworks/twitter/bootstrap/tables.less +131 -164
  50. data/vendor/frameworks/twitter/bootstrap/thumbnails.less +20 -31
  51. data/vendor/frameworks/twitter/bootstrap/tooltip.less +45 -20
  52. data/vendor/frameworks/twitter/bootstrap/type.less +84 -99
  53. data/vendor/frameworks/twitter/bootstrap/utilities.less +17 -5
  54. data/vendor/frameworks/twitter/bootstrap/variables.less +446 -179
  55. data/vendor/frameworks/twitter/bootstrap/wells.less +5 -5
  56. metadata +41 -44
  57. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  58. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  59. data/vendor/assets/javascripts/twitter/bootstrap/typeahead.js +0 -335
  60. data/vendor/assets/stylesheets/twitter/bootstrap-responsive.css.less +0 -1
  61. data/vendor/assets/stylesheets/twitter/bootstrap.css.less +0 -1
  62. data/vendor/frameworks/twitter/bootstrap.less +0 -1
  63. data/vendor/frameworks/twitter/bootstrap/hero-unit.less +0 -25
  64. data/vendor/frameworks/twitter/bootstrap/labels-badges.less +0 -84
  65. data/vendor/frameworks/twitter/bootstrap/layouts.less +0 -16
  66. data/vendor/frameworks/twitter/bootstrap/reset.less +0 -216
  67. data/vendor/frameworks/twitter/bootstrap/responsive-1200px-min.less +0 -28
  68. data/vendor/frameworks/twitter/bootstrap/responsive-767px-max.less +0 -193
  69. data/vendor/frameworks/twitter/bootstrap/responsive-768px-979px.less +0 -19
  70. data/vendor/frameworks/twitter/bootstrap/responsive-navbar.less +0 -189
  71. data/vendor/frameworks/twitter/bootstrap/responsive.less +0 -48
  72. data/vendor/frameworks/twitter/bootstrap/sprites.less +0 -197
@@ -1,8 +1,8 @@
1
- /* ==========================================================
2
- * bootstrap-alert.js v2.3.2
3
- * http://twitter.github.com/bootstrap/javascript.html#alerts
4
- * ==========================================================
5
- * Copyright 2012 Twitter, Inc.
1
+ /* ========================================================================
2
+ * Bootstrap: alert.js v3.0.0
3
+ * http://twbs.github.com/bootstrap/javascript.html#alerts
4
+ * ========================================================================
5
+ * Copyright 2013 Twitter, Inc.
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -15,66 +15,65 @@
15
15
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
- * ========================================================== */
18
+ * ======================================================================== */
19
19
 
20
20
 
21
- !function ($) {
21
+ +function ($) { "use strict";
22
22
 
23
- "use strict"; // jshint ;_;
24
-
25
-
26
- /* ALERT CLASS DEFINITION
27
- * ====================== */
23
+ // ALERT CLASS DEFINITION
24
+ // ======================
28
25
 
29
26
  var dismiss = '[data-dismiss="alert"]'
30
- , Alert = function (el) {
31
- $(el).on('click', dismiss, this.close)
32
- }
27
+ var Alert = function (el) {
28
+ $(el).on('click', dismiss, this.close)
29
+ }
33
30
 
34
31
  Alert.prototype.close = function (e) {
35
- var $this = $(this)
36
- , selector = $this.attr('data-target')
37
- , $parent
32
+ var $this = $(this)
33
+ var selector = $this.attr('data-target')
38
34
 
39
35
  if (!selector) {
40
36
  selector = $this.attr('href')
41
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
37
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
42
38
  }
43
39
 
44
- $parent = $(selector)
40
+ var $parent = $(selector)
45
41
 
46
- e && e.preventDefault()
42
+ if (e) e.preventDefault()
47
43
 
48
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
44
+ if (!$parent.length) {
45
+ $parent = $this.hasClass('alert') ? $this : $this.parent()
46
+ }
49
47
 
50
- $parent.trigger(e = $.Event('close'))
48
+ $parent.trigger(e = $.Event('close.bs.alert'))
51
49
 
52
50
  if (e.isDefaultPrevented()) return
53
51
 
54
52
  $parent.removeClass('in')
55
53
 
56
54
  function removeElement() {
57
- $parent
58
- .trigger('closed')
59
- .remove()
55
+ $parent.trigger('closed.bs.alert').remove()
60
56
  }
61
57
 
62
58
  $.support.transition && $parent.hasClass('fade') ?
63
- $parent.on($.support.transition.end, removeElement) :
59
+ $parent
60
+ .one($.support.transition.end, removeElement)
61
+ .emulateTransitionEnd(150) :
64
62
  removeElement()
65
63
  }
66
64
 
67
65
 
68
- /* ALERT PLUGIN DEFINITION
69
- * ======================= */
66
+ // ALERT PLUGIN DEFINITION
67
+ // =======================
70
68
 
71
69
  var old = $.fn.alert
72
70
 
73
71
  $.fn.alert = function (option) {
74
72
  return this.each(function () {
75
73
  var $this = $(this)
76
- , data = $this.data('alert')
77
- if (!data) $this.data('alert', (data = new Alert(this)))
74
+ var data = $this.data('bs.alert')
75
+
76
+ if (!data) $this.data('bs.alert', (data = new Alert(this)))
78
77
  if (typeof option == 'string') data[option].call($this)
79
78
  })
80
79
  }
@@ -82,8 +81,8 @@
82
81
  $.fn.alert.Constructor = Alert
83
82
 
84
83
 
85
- /* ALERT NO CONFLICT
86
- * ================= */
84
+ // ALERT NO CONFLICT
85
+ // =================
87
86
 
88
87
  $.fn.alert.noConflict = function () {
89
88
  $.fn.alert = old
@@ -91,9 +90,9 @@
91
90
  }
92
91
 
93
92
 
94
- /* ALERT DATA-API
95
- * ============== */
93
+ // ALERT DATA-API
94
+ // ==============
96
95
 
97
- $(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
96
+ $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
98
97
 
99
- }(window.jQuery);
98
+ }(window.jQuery);
@@ -1,8 +1,8 @@
1
- /* ============================================================
2
- * bootstrap-button.js v2.3.2
3
- * http://twitter.github.com/bootstrap/javascript.html#buttons
4
- * ============================================================
5
- * Copyright 2012 Twitter, Inc.
1
+ /* ========================================================================
2
+ * Bootstrap: button.js v3.0.0
3
+ * http://twbs.github.com/bootstrap/javascript.html#buttons
4
+ * ========================================================================
5
+ * Copyright 2013 Twitter, Inc.
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -15,30 +15,32 @@
15
15
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
- * ============================================================ */
18
+ * ======================================================================== */
19
19
 
20
20
 
21
- !function ($) {
21
+ +function ($) { "use strict";
22
22
 
23
- "use strict"; // jshint ;_;
24
-
25
-
26
- /* BUTTON PUBLIC CLASS DEFINITION
27
- * ============================== */
23
+ // BUTTON PUBLIC CLASS DEFINITION
24
+ // ==============================
28
25
 
29
26
  var Button = function (element, options) {
30
27
  this.$element = $(element)
31
- this.options = $.extend({}, $.fn.button.defaults, options)
28
+ this.options = $.extend({}, Button.DEFAULTS, options)
29
+ }
30
+
31
+ Button.DEFAULTS = {
32
+ loadingText: 'loading...'
32
33
  }
33
34
 
34
35
  Button.prototype.setState = function (state) {
35
- var d = 'disabled'
36
- , $el = this.$element
37
- , data = $el.data()
38
- , val = $el.is('input') ? 'val' : 'html'
36
+ var d = 'disabled'
37
+ var $el = this.$element
38
+ var val = $el.is('input') ? 'val' : 'html'
39
+ var data = $el.data()
39
40
 
40
41
  state = state + 'Text'
41
- data.resetText || $el.data('resetText', $el[val]())
42
+
43
+ if (!data.resetText) $el.data('resetText', $el[val]())
42
44
 
43
45
  $el[val](data[state] || this.options[state])
44
46
 
@@ -46,46 +48,45 @@
46
48
  setTimeout(function () {
47
49
  state == 'loadingText' ?
48
50
  $el.addClass(d).attr(d, d) :
49
- $el.removeClass(d).removeAttr(d)
51
+ $el.removeClass(d).removeAttr(d);
50
52
  }, 0)
51
53
  }
52
54
 
53
55
  Button.prototype.toggle = function () {
54
- var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
56
+ var $parent = this.$element.closest('[data-toggle="buttons"]')
55
57
 
56
- $parent && $parent
57
- .find('.active')
58
- .removeClass('active')
58
+ if ($parent.length) {
59
+ var $input = this.$element.find('input').prop('checked', !this.$element.hasClass('active'))
60
+ if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
61
+ }
59
62
 
60
63
  this.$element.toggleClass('active')
61
64
  }
62
65
 
63
66
 
64
- /* BUTTON PLUGIN DEFINITION
65
- * ======================== */
67
+ // BUTTON PLUGIN DEFINITION
68
+ // ========================
66
69
 
67
70
  var old = $.fn.button
68
71
 
69
72
  $.fn.button = function (option) {
70
73
  return this.each(function () {
71
- var $this = $(this)
72
- , data = $this.data('button')
73
- , options = typeof option == 'object' && option
74
- if (!data) $this.data('button', (data = new Button(this, options)))
74
+ var $this = $(this)
75
+ var data = $this.data('button')
76
+ var options = typeof option == 'object' && option
77
+
78
+ if (!data) $this.data('bs.button', (data = new Button(this, options)))
79
+
75
80
  if (option == 'toggle') data.toggle()
76
81
  else if (option) data.setState(option)
77
82
  })
78
83
  }
79
84
 
80
- $.fn.button.defaults = {
81
- loadingText: 'loading...'
82
- }
83
-
84
85
  $.fn.button.Constructor = Button
85
86
 
86
87
 
87
- /* BUTTON NO CONFLICT
88
- * ================== */
88
+ // BUTTON NO CONFLICT
89
+ // ==================
89
90
 
90
91
  $.fn.button.noConflict = function () {
91
92
  $.fn.button = old
@@ -93,13 +94,14 @@
93
94
  }
94
95
 
95
96
 
96
- /* BUTTON DATA-API
97
- * =============== */
97
+ // BUTTON DATA-API
98
+ // ===============
98
99
 
99
- $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) {
100
+ $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
100
101
  var $btn = $(e.target)
101
102
  if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
102
103
  $btn.button('toggle')
104
+ e.preventDefault()
103
105
  })
104
106
 
105
- }(window.jQuery);
107
+ }(window.jQuery);
@@ -1,7 +1,7 @@
1
- /* ==========================================================
2
- * bootstrap-carousel.js v2.3.2
3
- * http://twitter.github.com/bootstrap/javascript.html#carousel
4
- * ==========================================================
1
+ /* ========================================================================
2
+ * Bootstrap: carousel.js v3.0.0
3
+ * http://twbs.github.com/bootstrap/javascript.html#carousel
4
+ * ========================================================================
5
5
  * Copyright 2012 Twitter, Inc.
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,193 +15,199 @@
15
15
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
- * ========================================================== */
18
+ * ======================================================================== */
19
19
 
20
20
 
21
- !function ($) {
21
+ +function ($) { "use strict";
22
22
 
23
- "use strict"; // jshint ;_;
24
-
25
-
26
- /* CAROUSEL CLASS DEFINITION
27
- * ========================= */
23
+ // CAROUSEL CLASS DEFINITION
24
+ // =========================
28
25
 
29
26
  var Carousel = function (element, options) {
30
- this.$element = $(element)
27
+ this.$element = $(element)
31
28
  this.$indicators = this.$element.find('.carousel-indicators')
32
- this.options = options
29
+ this.options = options
30
+ this.paused =
31
+ this.sliding =
32
+ this.interval =
33
+ this.$active =
34
+ this.$items = null
35
+
33
36
  this.options.pause == 'hover' && this.$element
34
37
  .on('mouseenter', $.proxy(this.pause, this))
35
38
  .on('mouseleave', $.proxy(this.cycle, this))
36
39
  }
37
40
 
38
- Carousel.prototype = {
41
+ Carousel.DEFAULTS = {
42
+ interval: 5000
43
+ , pause: 'hover'
44
+ }
39
45
 
40
- cycle: function (e) {
41
- if (!e) this.paused = false
42
- if (this.interval) clearInterval(this.interval);
43
- this.options.interval
44
- && !this.paused
45
- && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
46
- return this
47
- }
46
+ Carousel.prototype.cycle = function (e) {
47
+ e || (this.paused = false)
48
48
 
49
- , getActiveIndex: function () {
50
- this.$active = this.$element.find('.item.active')
51
- this.$items = this.$active.parent().children()
52
- return this.$items.index(this.$active)
53
- }
49
+ this.interval && clearInterval(this.interval)
54
50
 
55
- , to: function (pos) {
56
- var activeIndex = this.getActiveIndex()
57
- , that = this
51
+ this.options.interval
52
+ && !this.paused
53
+ && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
58
54
 
59
- if (pos > (this.$items.length - 1) || pos < 0) return
55
+ return this
56
+ }
60
57
 
61
- if (this.sliding) {
62
- return this.$element.one('slid', function () {
63
- that.to(pos)
64
- })
65
- }
58
+ Carousel.prototype.getActiveIndex = function () {
59
+ this.$active = this.$element.find('.item.active')
60
+ this.$items = this.$active.parent().children()
66
61
 
67
- if (activeIndex == pos) {
68
- return this.pause().cycle()
69
- }
62
+ return this.$items.index(this.$active)
63
+ }
70
64
 
71
- return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
72
- }
65
+ Carousel.prototype.to = function (pos) {
66
+ var that = this
67
+ var activeIndex = this.getActiveIndex()
73
68
 
74
- , pause: function (e) {
75
- if (!e) this.paused = true
76
- if (this.$element.find('.next, .prev').length && $.support.transition.end) {
77
- this.$element.trigger($.support.transition.end)
78
- this.cycle(true)
79
- }
80
- clearInterval(this.interval)
81
- this.interval = null
82
- return this
83
- }
69
+ if (pos > (this.$items.length - 1) || pos < 0) return
84
70
 
85
- , next: function () {
86
- if (this.sliding) return
87
- return this.slide('next')
88
- }
71
+ if (this.sliding) return this.$element.one('slid', function () { that.to(pos) })
72
+ if (activeIndex == pos) return this.pause().cycle()
73
+
74
+ return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
75
+ }
76
+
77
+ Carousel.prototype.pause = function (e) {
78
+ e || (this.paused = true)
89
79
 
90
- , prev: function () {
91
- if (this.sliding) return
92
- return this.slide('prev')
80
+ if (this.$element.find('.next, .prev').length && $.support.transition.end) {
81
+ this.$element.trigger($.support.transition.end)
82
+ this.cycle(true)
93
83
  }
94
84
 
95
- , slide: function (type, next) {
96
- var $active = this.$element.find('.item.active')
97
- , $next = next || $active[type]()
98
- , isCycling = this.interval
99
- , direction = type == 'next' ? 'left' : 'right'
100
- , fallback = type == 'next' ? 'first' : 'last'
101
- , that = this
102
- , e
85
+ this.interval = clearInterval(this.interval)
86
+
87
+ return this
88
+ }
89
+
90
+ Carousel.prototype.next = function () {
91
+ if (this.sliding) return
92
+ return this.slide('next')
93
+ }
94
+
95
+ Carousel.prototype.prev = function () {
96
+ if (this.sliding) return
97
+ return this.slide('prev')
98
+ }
103
99
 
104
- this.sliding = true
100
+ Carousel.prototype.slide = function (type, next) {
101
+ var $active = this.$element.find('.item.active')
102
+ var $next = next || $active[type]()
103
+ var isCycling = this.interval
104
+ var direction = type == 'next' ? 'left' : 'right'
105
+ var fallback = type == 'next' ? 'first' : 'last'
106
+ var that = this
105
107
 
106
- isCycling && this.pause()
108
+ this.sliding = true
107
109
 
108
- $next = $next.length ? $next : this.$element.find('.item')[fallback]()
110
+ isCycling && this.pause()
109
111
 
110
- e = $.Event('slide', {
111
- relatedTarget: $next[0]
112
- , direction: direction
113
- })
112
+ $next = $next.length ? $next : this.$element.find('.item')[fallback]()
114
113
 
115
- if ($next.hasClass('active')) return
114
+ var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
116
115
 
117
- if (this.$indicators.length) {
118
- this.$indicators.find('.active').removeClass('active')
119
- this.$element.one('slid', function () {
120
- var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
121
- $nextIndicator && $nextIndicator.addClass('active')
122
- })
123
- }
124
-
125
- if ($.support.transition && this.$element.hasClass('slide')) {
126
- this.$element.trigger(e)
127
- if (e.isDefaultPrevented()) return
128
- $next.addClass(type)
129
- $next[0].offsetWidth // force reflow
130
- $active.addClass(direction)
131
- $next.addClass(direction)
132
- this.$element.one($.support.transition.end, function () {
116
+ if ($next.hasClass('active')) return
117
+
118
+ if (this.$indicators.length) {
119
+ this.$indicators.find('.active').removeClass('active')
120
+ this.$element.one('slid', function () {
121
+ var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
122
+ $nextIndicator && $nextIndicator.addClass('active')
123
+ })
124
+ }
125
+
126
+ if ($.support.transition && this.$element.hasClass('slide')) {
127
+ this.$element.trigger(e)
128
+ if (e.isDefaultPrevented()) return
129
+ $next.addClass(type)
130
+ $next[0].offsetWidth // force reflow
131
+ $active.addClass(direction)
132
+ $next.addClass(direction)
133
+ $active
134
+ .one($.support.transition.end, function () {
133
135
  $next.removeClass([type, direction].join(' ')).addClass('active')
134
136
  $active.removeClass(['active', direction].join(' '))
135
137
  that.sliding = false
136
138
  setTimeout(function () { that.$element.trigger('slid') }, 0)
137
139
  })
138
- } else {
139
- this.$element.trigger(e)
140
- if (e.isDefaultPrevented()) return
141
- $active.removeClass('active')
142
- $next.addClass('active')
143
- this.sliding = false
144
- this.$element.trigger('slid')
145
- }
146
-
147
- isCycling && this.cycle()
148
-
149
- return this
140
+ .emulateTransitionEnd(600)
141
+ } else {
142
+ this.$element.trigger(e)
143
+ if (e.isDefaultPrevented()) return
144
+ $active.removeClass('active')
145
+ $next.addClass('active')
146
+ this.sliding = false
147
+ this.$element.trigger('slid')
150
148
  }
151
149
 
150
+ isCycling && this.cycle()
151
+
152
+ return this
152
153
  }
153
154
 
154
155
 
155
- /* CAROUSEL PLUGIN DEFINITION
156
- * ========================== */
156
+ // CAROUSEL PLUGIN DEFINITION
157
+ // ==========================
157
158
 
158
159
  var old = $.fn.carousel
159
160
 
160
161
  $.fn.carousel = function (option) {
161
162
  return this.each(function () {
162
- var $this = $(this)
163
- , data = $this.data('carousel')
164
- , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
165
- , action = typeof option == 'string' ? option : options.slide
166
- if (!data) $this.data('carousel', (data = new Carousel(this, options)))
163
+ var $this = $(this)
164
+ var data = $this.data('bs.carousel')
165
+ var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
166
+ var action = typeof option == 'string' ? option : options.slide
167
+
168
+ if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
167
169
  if (typeof option == 'number') data.to(option)
168
170
  else if (action) data[action]()
169
171
  else if (options.interval) data.pause().cycle()
170
172
  })
171
173
  }
172
174
 
173
- $.fn.carousel.defaults = {
174
- interval: 5000
175
- , pause: 'hover'
176
- }
177
-
178
175
  $.fn.carousel.Constructor = Carousel
179
176
 
180
177
 
181
- /* CAROUSEL NO CONFLICT
182
- * ==================== */
178
+ // CAROUSEL NO CONFLICT
179
+ // ====================
183
180
 
184
181
  $.fn.carousel.noConflict = function () {
185
182
  $.fn.carousel = old
186
183
  return this
187
184
  }
188
185
 
189
- /* CAROUSEL DATA-API
190
- * ================= */
191
186
 
192
- $(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
193
- var $this = $(this), href
194
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
195
- , options = $.extend({}, $target.data(), $this.data())
196
- , slideIndex
187
+ // CAROUSEL DATA-API
188
+ // =================
189
+
190
+ $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
191
+ var $this = $(this), href
192
+ var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
193
+ var options = $.extend({}, $target.data(), $this.data())
194
+ var slideIndex = $this.attr('data-slide-to')
195
+ if (slideIndex) options.interval = false
197
196
 
198
197
  $target.carousel(options)
199
198
 
200
199
  if (slideIndex = $this.attr('data-slide-to')) {
201
- $target.data('carousel').pause().to(slideIndex).cycle()
200
+ $target.data('bs.carousel').to(slideIndex)
202
201
  }
203
202
 
204
203
  e.preventDefault()
205
204
  })
206
205
 
207
- }(window.jQuery);
206
+ $(window).on('load', function () {
207
+ $('[data-ride="carousel"]').each(function () {
208
+ var $carousel = $(this)
209
+ $carousel.carousel($carousel.data())
210
+ })
211
+ })
212
+
213
+ }(window.jQuery);