bootstrap-sass-rails 3.0.0.3 → 3.1.0.0

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/LICENSE +1 -1
  2. data/README.md +24 -113
  3. data/app/assets/javascripts/twitter/bootstrap/affix.js +1 -126
  4. data/app/assets/javascripts/twitter/bootstrap/alert.js +1 -98
  5. data/app/assets/javascripts/twitter/bootstrap/button.js +1 -109
  6. data/app/assets/javascripts/twitter/bootstrap/carousel.js +1 -217
  7. data/app/assets/javascripts/twitter/bootstrap/collapse.js +1 -179
  8. data/app/assets/javascripts/twitter/bootstrap/dropdown.js +1 -154
  9. data/app/assets/javascripts/twitter/bootstrap/modal.js +1 -246
  10. data/app/assets/javascripts/twitter/bootstrap/popover.js +1 -117
  11. data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +1 -158
  12. data/app/assets/javascripts/twitter/bootstrap/tab.js +1 -135
  13. data/app/assets/javascripts/twitter/bootstrap/tooltip.js +1 -386
  14. data/app/assets/javascripts/twitter/bootstrap/transition.js +1 -56
  15. data/app/assets/javascripts/twitter/bootstrap.js +1 -12
  16. data/app/assets/stylesheets/twitter/bootstrap/_alerts.scss +1 -67
  17. data/app/assets/stylesheets/twitter/bootstrap/_badges.scss +1 -51
  18. data/app/assets/stylesheets/twitter/bootstrap/_breadcrumbs.scss +1 -23
  19. data/app/assets/stylesheets/twitter/bootstrap/_button-groups.scss +1 -248
  20. data/app/assets/stylesheets/twitter/bootstrap/_buttons.scss +1 -160
  21. data/app/assets/stylesheets/twitter/bootstrap/_carousel.scss +1 -209
  22. data/app/assets/stylesheets/twitter/bootstrap/_close.scss +1 -33
  23. data/app/assets/stylesheets/twitter/bootstrap/_code.scss +1 -56
  24. data/app/assets/stylesheets/twitter/bootstrap/_component-animations.scss +1 -29
  25. data/app/assets/stylesheets/twitter/bootstrap/_dropdowns.scss +1 -193
  26. data/app/assets/stylesheets/twitter/bootstrap/_forms.scss +1 -350
  27. data/app/assets/stylesheets/twitter/bootstrap/_glyphicons.scss +1 -232
  28. data/app/assets/stylesheets/twitter/bootstrap/_grid.scss +1 -346
  29. data/app/assets/stylesheets/twitter/bootstrap/_input-groups.scss +1 -127
  30. data/app/assets/stylesheets/twitter/bootstrap/_jumbotron.scss +1 -40
  31. data/app/assets/stylesheets/twitter/bootstrap/_labels.scss +1 -58
  32. data/app/assets/stylesheets/twitter/bootstrap/_list-group.scss +1 -89
  33. data/app/assets/stylesheets/twitter/bootstrap/_media.scss +1 -56
  34. data/app/assets/stylesheets/twitter/bootstrap/_mixins.scss +1 -736
  35. data/app/assets/stylesheets/twitter/bootstrap/_modals.scss +1 -145
  36. data/app/assets/stylesheets/twitter/bootstrap/_navbar.scss +1 -625
  37. data/app/assets/stylesheets/twitter/bootstrap/_navs.scss +1 -229
  38. data/app/assets/stylesheets/twitter/bootstrap/_normalize.scss +1 -396
  39. data/app/assets/stylesheets/twitter/bootstrap/_pager.scss +1 -55
  40. data/app/assets/stylesheets/twitter/bootstrap/_pagination.scss +1 -83
  41. data/app/assets/stylesheets/twitter/bootstrap/_panels.scss +1 -148
  42. data/app/assets/stylesheets/twitter/bootstrap/_popovers.scss +1 -133
  43. data/app/assets/stylesheets/twitter/bootstrap/_print.scss +1 -100
  44. data/app/assets/stylesheets/twitter/bootstrap/_progress-bars.scss +1 -95
  45. data/app/assets/stylesheets/twitter/bootstrap/_responsive-utilities.scss +1 -209
  46. data/app/assets/stylesheets/twitter/bootstrap/_scaffolding.scss +1 -130
  47. data/app/assets/stylesheets/twitter/bootstrap/_tables.scss +1 -236
  48. data/app/assets/stylesheets/twitter/bootstrap/_theme.scss +1 -232
  49. data/app/assets/stylesheets/twitter/bootstrap/_thumbnails.scss +1 -31
  50. data/app/assets/stylesheets/twitter/bootstrap/_tooltip.scss +1 -95
  51. data/app/assets/stylesheets/twitter/bootstrap/_type.scss +1 -238
  52. data/app/assets/stylesheets/twitter/bootstrap/_utilities.scss +1 -42
  53. data/app/assets/stylesheets/twitter/bootstrap/_variables.scss +1 -620
  54. data/app/assets/stylesheets/twitter/bootstrap/_wells.scss +1 -29
  55. data/app/assets/stylesheets/twitter/bootstrap.css.scss +1 -59
  56. data/lib/bootstrap/sass/rails/engine.rb +4 -1
  57. data/lib/bootstrap/sass/rails/version.rb +2 -1
  58. data/lib/bootstrap-sass-rails.rb +1 -1
  59. data/lib/generators/bootstrap/customize_generator.rb +37 -0
  60. data/lib/generators/bootstrap/templates/USAGE +23 -0
  61. data/lib/generators/bootstrap/templates/bootstrap-custom.css.scss +18 -0
  62. data/lib/generators/bootstrap/templates/bootstrap-custom.js +3 -0
  63. data/test/cases/less_to_sass_spec.rb +1 -1
  64. data/test/cases/usage_css_spec.rb +0 -3
  65. metadata +60 -18
  66. checksums.yaml +0 -15
  67. data/app/assets/fonts/twitter/bootstrap/glyphicons-halflings-regular.eot +0 -0
  68. data/app/assets/fonts/twitter/bootstrap/glyphicons-halflings-regular.svg +0 -228
  69. data/app/assets/fonts/twitter/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  70. data/app/assets/fonts/twitter/bootstrap/glyphicons-halflings-regular.woff +0 -0
  71. data/lib/bootstrap/sass/extensions/functions.rb +0 -15
  72. data/lib/bootstrap/sass/extensions.rb +0 -5
@@ -1,246 +1 @@
1
- /* ========================================================================
2
- * Bootstrap: modal.js v3.0.0
3
- * http://twbs.github.com/bootstrap/javascript.html#modals
4
- * ========================================================================
5
- * Copyright 2012 Twitter, Inc.
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- * ======================================================================== */
19
-
20
-
21
- +function ($) { "use strict";
22
-
23
- // MODAL CLASS DEFINITION
24
- // ======================
25
-
26
- var Modal = function (element, options) {
27
- this.options = options
28
- this.$element = $(element)
29
- this.$backdrop =
30
- this.isShown = null
31
-
32
- if (this.options.remote) this.$element.load(this.options.remote)
33
- }
34
-
35
- Modal.DEFAULTS = {
36
- backdrop: true
37
- , keyboard: true
38
- , show: true
39
- }
40
-
41
- Modal.prototype.toggle = function (_relatedTarget) {
42
- return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
43
- }
44
-
45
- Modal.prototype.show = function (_relatedTarget) {
46
- var that = this
47
- var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
48
-
49
- this.$element.trigger(e)
50
-
51
- if (this.isShown || e.isDefaultPrevented()) return
52
-
53
- this.isShown = true
54
-
55
- this.escape()
56
-
57
- this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
58
-
59
- this.backdrop(function () {
60
- var transition = $.support.transition && that.$element.hasClass('fade')
61
-
62
- if (!that.$element.parent().length) {
63
- that.$element.appendTo(document.body) // don't move modals dom position
64
- }
65
-
66
- that.$element.show()
67
-
68
- if (transition) {
69
- that.$element[0].offsetWidth // force reflow
70
- }
71
-
72
- that.$element
73
- .addClass('in')
74
- .attr('aria-hidden', false)
75
-
76
- that.enforceFocus()
77
-
78
- var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
79
-
80
- transition ?
81
- that.$element.find('.modal-dialog') // wait for modal to slide in
82
- .one($.support.transition.end, function () {
83
- that.$element.focus().trigger(e)
84
- })
85
- .emulateTransitionEnd(300) :
86
- that.$element.focus().trigger(e)
87
- })
88
- }
89
-
90
- Modal.prototype.hide = function (e) {
91
- if (e) e.preventDefault()
92
-
93
- e = $.Event('hide.bs.modal')
94
-
95
- this.$element.trigger(e)
96
-
97
- if (!this.isShown || e.isDefaultPrevented()) return
98
-
99
- this.isShown = false
100
-
101
- this.escape()
102
-
103
- $(document).off('focusin.bs.modal')
104
-
105
- this.$element
106
- .removeClass('in')
107
- .attr('aria-hidden', true)
108
- .off('click.dismiss.modal')
109
-
110
- $.support.transition && this.$element.hasClass('fade') ?
111
- this.$element
112
- .one($.support.transition.end, $.proxy(this.hideModal, this))
113
- .emulateTransitionEnd(300) :
114
- this.hideModal()
115
- }
116
-
117
- Modal.prototype.enforceFocus = function () {
118
- $(document)
119
- .off('focusin.bs.modal') // guard against infinite focus loop
120
- .on('focusin.bs.modal', $.proxy(function (e) {
121
- if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
122
- this.$element.focus()
123
- }
124
- }, this))
125
- }
126
-
127
- Modal.prototype.escape = function () {
128
- if (this.isShown && this.options.keyboard) {
129
- this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
130
- e.which == 27 && this.hide()
131
- }, this))
132
- } else if (!this.isShown) {
133
- this.$element.off('keyup.dismiss.bs.modal')
134
- }
135
- }
136
-
137
- Modal.prototype.hideModal = function () {
138
- var that = this
139
- this.$element.hide()
140
- this.backdrop(function () {
141
- that.removeBackdrop()
142
- that.$element.trigger('hidden.bs.modal')
143
- })
144
- }
145
-
146
- Modal.prototype.removeBackdrop = function () {
147
- this.$backdrop && this.$backdrop.remove()
148
- this.$backdrop = null
149
- }
150
-
151
- Modal.prototype.backdrop = function (callback) {
152
- var that = this
153
- var animate = this.$element.hasClass('fade') ? 'fade' : ''
154
-
155
- if (this.isShown && this.options.backdrop) {
156
- var doAnimate = $.support.transition && animate
157
-
158
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
159
- .appendTo(document.body)
160
-
161
- this.$element.on('click.dismiss.modal', $.proxy(function (e) {
162
- if (e.target !== e.currentTarget) return
163
- this.options.backdrop == 'static'
164
- ? this.$element[0].focus.call(this.$element[0])
165
- : this.hide.call(this)
166
- }, this))
167
-
168
- if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
169
-
170
- this.$backdrop.addClass('in')
171
-
172
- if (!callback) return
173
-
174
- doAnimate ?
175
- this.$backdrop
176
- .one($.support.transition.end, callback)
177
- .emulateTransitionEnd(150) :
178
- callback()
179
-
180
- } else if (!this.isShown && this.$backdrop) {
181
- this.$backdrop.removeClass('in')
182
-
183
- $.support.transition && this.$element.hasClass('fade')?
184
- this.$backdrop
185
- .one($.support.transition.end, callback)
186
- .emulateTransitionEnd(150) :
187
- callback()
188
-
189
- } else if (callback) {
190
- callback()
191
- }
192
- }
193
-
194
-
195
- // MODAL PLUGIN DEFINITION
196
- // =======================
197
-
198
- var old = $.fn.modal
199
-
200
- $.fn.modal = function (option, _relatedTarget) {
201
- return this.each(function () {
202
- var $this = $(this)
203
- var data = $this.data('bs.modal')
204
- var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
205
-
206
- if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
207
- if (typeof option == 'string') data[option](_relatedTarget)
208
- else if (options.show) data.show(_relatedTarget)
209
- })
210
- }
211
-
212
- $.fn.modal.Constructor = Modal
213
-
214
-
215
- // MODAL NO CONFLICT
216
- // =================
217
-
218
- $.fn.modal.noConflict = function () {
219
- $.fn.modal = old
220
- return this
221
- }
222
-
223
-
224
- // MODAL DATA-API
225
- // ==============
226
-
227
- $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
228
- var $this = $(this)
229
- var href = $this.attr('href')
230
- var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
231
- var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
232
-
233
- e.preventDefault()
234
-
235
- $target
236
- .modal(option, this)
237
- .one('hide', function () {
238
- $this.is(':visible') && $this.focus()
239
- })
240
- })
241
-
242
- $(document)
243
- .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
244
- .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
245
-
246
- }(window.jQuery);
1
+ //= require bootstrap/modal
@@ -1,117 +1 @@
1
- /* ========================================================================
2
- * Bootstrap: popover.js v3.0.0
3
- * http://twbs.github.com/bootstrap/javascript.html#popovers
4
- * ========================================================================
5
- * Copyright 2012 Twitter, Inc.
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- * ======================================================================== */
19
-
20
-
21
- +function ($) { "use strict";
22
-
23
- // POPOVER PUBLIC CLASS DEFINITION
24
- // ===============================
25
-
26
- var Popover = function (element, options) {
27
- this.init('popover', element, options)
28
- }
29
-
30
- if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
31
-
32
- Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
33
- placement: 'right'
34
- , trigger: 'click'
35
- , content: ''
36
- , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
37
- })
38
-
39
-
40
- // NOTE: POPOVER EXTENDS tooltip.js
41
- // ================================
42
-
43
- Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
44
-
45
- Popover.prototype.constructor = Popover
46
-
47
- Popover.prototype.getDefaults = function () {
48
- return Popover.DEFAULTS
49
- }
50
-
51
- Popover.prototype.setContent = function () {
52
- var $tip = this.tip()
53
- var title = this.getTitle()
54
- var content = this.getContent()
55
-
56
- $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
57
- $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
58
-
59
- $tip.removeClass('fade top bottom left right in')
60
-
61
- // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
62
- // this manually by checking the contents.
63
- if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
64
- }
65
-
66
- Popover.prototype.hasContent = function () {
67
- return this.getTitle() || this.getContent()
68
- }
69
-
70
- Popover.prototype.getContent = function () {
71
- var $e = this.$element
72
- var o = this.options
73
-
74
- return $e.attr('data-content')
75
- || (typeof o.content == 'function' ?
76
- o.content.call($e[0]) :
77
- o.content)
78
- }
79
-
80
- Popover.prototype.arrow = function () {
81
- return this.$arrow = this.$arrow || this.tip().find('.arrow')
82
- }
83
-
84
- Popover.prototype.tip = function () {
85
- if (!this.$tip) this.$tip = $(this.options.template)
86
- return this.$tip
87
- }
88
-
89
-
90
- // POPOVER PLUGIN DEFINITION
91
- // =========================
92
-
93
- var old = $.fn.popover
94
-
95
- $.fn.popover = function (option) {
96
- return this.each(function () {
97
- var $this = $(this)
98
- var data = $this.data('bs.popover')
99
- var options = typeof option == 'object' && option
100
-
101
- if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
102
- if (typeof option == 'string') data[option]()
103
- })
104
- }
105
-
106
- $.fn.popover.Constructor = Popover
107
-
108
-
109
- // POPOVER NO CONFLICT
110
- // ===================
111
-
112
- $.fn.popover.noConflict = function () {
113
- $.fn.popover = old
114
- return this
115
- }
116
-
117
- }(window.jQuery);
1
+ //= require bootstrap/popover
@@ -1,158 +1 @@
1
- /* ========================================================================
2
- * Bootstrap: scrollspy.js v3.0.0
3
- * http://twbs.github.com/bootstrap/javascript.html#scrollspy
4
- * ========================================================================
5
- * Copyright 2012 Twitter, Inc.
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- * ======================================================================== */
19
-
20
-
21
- +function ($) { "use strict";
22
-
23
- // SCROLLSPY CLASS DEFINITION
24
- // ==========================
25
-
26
- function ScrollSpy(element, options) {
27
- var href
28
- var process = $.proxy(this.process, this)
29
-
30
- this.$element = $(element).is('body') ? $(window) : $(element)
31
- this.$body = $('body')
32
- this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
33
- this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
34
- this.selector = (this.options.target
35
- || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
36
- || '') + ' .nav li > a'
37
- this.offsets = $([])
38
- this.targets = $([])
39
- this.activeTarget = null
40
-
41
- this.refresh()
42
- this.process()
43
- }
44
-
45
- ScrollSpy.DEFAULTS = {
46
- offset: 10
47
- }
48
-
49
- ScrollSpy.prototype.refresh = function () {
50
- var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
51
-
52
- this.offsets = $([])
53
- this.targets = $([])
54
-
55
- var self = this
56
- var $targets = this.$body
57
- .find(this.selector)
58
- .map(function () {
59
- var $el = $(this)
60
- var href = $el.data('target') || $el.attr('href')
61
- var $href = /^#\w/.test(href) && $(href)
62
-
63
- return ($href
64
- && $href.length
65
- && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
66
- })
67
- .sort(function (a, b) { return a[0] - b[0] })
68
- .each(function () {
69
- self.offsets.push(this[0])
70
- self.targets.push(this[1])
71
- })
72
- }
73
-
74
- ScrollSpy.prototype.process = function () {
75
- var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
76
- var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
77
- var maxScroll = scrollHeight - this.$scrollElement.height()
78
- var offsets = this.offsets
79
- var targets = this.targets
80
- var activeTarget = this.activeTarget
81
- var i
82
-
83
- if (scrollTop >= maxScroll) {
84
- return activeTarget != (i = targets.last()[0]) && this.activate(i)
85
- }
86
-
87
- for (i = offsets.length; i--;) {
88
- activeTarget != targets[i]
89
- && scrollTop >= offsets[i]
90
- && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
91
- && this.activate( targets[i] )
92
- }
93
- }
94
-
95
- ScrollSpy.prototype.activate = function (target) {
96
- this.activeTarget = target
97
-
98
- $(this.selector)
99
- .parents('.active')
100
- .removeClass('active')
101
-
102
- var selector = this.selector
103
- + '[data-target="' + target + '"],'
104
- + this.selector + '[href="' + target + '"]'
105
-
106
- var active = $(selector)
107
- .parents('li')
108
- .addClass('active')
109
-
110
- if (active.parent('.dropdown-menu').length) {
111
- active = active
112
- .closest('li.dropdown')
113
- .addClass('active')
114
- }
115
-
116
- active.trigger('activate')
117
- }
118
-
119
-
120
- // SCROLLSPY PLUGIN DEFINITION
121
- // ===========================
122
-
123
- var old = $.fn.scrollspy
124
-
125
- $.fn.scrollspy = function (option) {
126
- return this.each(function () {
127
- var $this = $(this)
128
- var data = $this.data('bs.scrollspy')
129
- var options = typeof option == 'object' && option
130
-
131
- if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
132
- if (typeof option == 'string') data[option]()
133
- })
134
- }
135
-
136
- $.fn.scrollspy.Constructor = ScrollSpy
137
-
138
-
139
- // SCROLLSPY NO CONFLICT
140
- // =====================
141
-
142
- $.fn.scrollspy.noConflict = function () {
143
- $.fn.scrollspy = old
144
- return this
145
- }
146
-
147
-
148
- // SCROLLSPY DATA-API
149
- // ==================
150
-
151
- $(window).on('load', function () {
152
- $('[data-spy="scroll"]').each(function () {
153
- var $spy = $(this)
154
- $spy.scrollspy($spy.data())
155
- })
156
- })
157
-
158
- }(window.jQuery);
1
+ //= require bootstrap/scrollspy
@@ -1,135 +1 @@
1
- /* ========================================================================
2
- * Bootstrap: tab.js v3.0.0
3
- * http://twbs.github.com/bootstrap/javascript.html#tabs
4
- * ========================================================================
5
- * Copyright 2012 Twitter, Inc.
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- * ======================================================================== */
19
-
20
-
21
- +function ($) { "use strict";
22
-
23
- // TAB CLASS DEFINITION
24
- // ====================
25
-
26
- var Tab = function (element) {
27
- this.element = $(element)
28
- }
29
-
30
- Tab.prototype.show = function () {
31
- var $this = this.element
32
- var $ul = $this.closest('ul:not(.dropdown-menu)')
33
- var selector = $this.attr('data-target')
34
-
35
- if (!selector) {
36
- selector = $this.attr('href')
37
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
38
- }
39
-
40
- if ($this.parent('li').hasClass('active')) return
41
-
42
- var previous = $ul.find('.active:last a')[0]
43
- var e = $.Event('show.bs.tab', {
44
- relatedTarget: previous
45
- })
46
-
47
- $this.trigger(e)
48
-
49
- if (e.isDefaultPrevented()) return
50
-
51
- var $target = $(selector)
52
-
53
- this.activate($this.parent('li'), $ul)
54
- this.activate($target, $target.parent(), function () {
55
- $this.trigger({
56
- type: 'shown.bs.tab'
57
- , relatedTarget: previous
58
- })
59
- })
60
- }
61
-
62
- Tab.prototype.activate = function (element, container, callback) {
63
- var $active = container.find('> .active')
64
- var transition = callback
65
- && $.support.transition
66
- && $active.hasClass('fade')
67
-
68
- function next() {
69
- $active
70
- .removeClass('active')
71
- .find('> .dropdown-menu > .active')
72
- .removeClass('active')
73
-
74
- element.addClass('active')
75
-
76
- if (transition) {
77
- element[0].offsetWidth // reflow for transition
78
- element.addClass('in')
79
- } else {
80
- element.removeClass('fade')
81
- }
82
-
83
- if (element.parent('.dropdown-menu')) {
84
- element.closest('li.dropdown').addClass('active')
85
- }
86
-
87
- callback && callback()
88
- }
89
-
90
- transition ?
91
- $active
92
- .one($.support.transition.end, next)
93
- .emulateTransitionEnd(150) :
94
- next()
95
-
96
- $active.removeClass('in')
97
- }
98
-
99
-
100
- // TAB PLUGIN DEFINITION
101
- // =====================
102
-
103
- var old = $.fn.tab
104
-
105
- $.fn.tab = function ( option ) {
106
- return this.each(function () {
107
- var $this = $(this)
108
- var data = $this.data('bs.tab')
109
-
110
- if (!data) $this.data('bs.tab', (data = new Tab(this)))
111
- if (typeof option == 'string') data[option]()
112
- })
113
- }
114
-
115
- $.fn.tab.Constructor = Tab
116
-
117
-
118
- // TAB NO CONFLICT
119
- // ===============
120
-
121
- $.fn.tab.noConflict = function () {
122
- $.fn.tab = old
123
- return this
124
- }
125
-
126
-
127
- // TAB DATA-API
128
- // ============
129
-
130
- $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
131
- e.preventDefault()
132
- $(this).tab('show')
133
- })
134
-
135
- }(window.jQuery);
1
+ //= require bootstrap/tab.js