aerogel-bootstrap 0.0.2 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/aerogel-bootstrap.gemspec +3 -3
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +229 -0
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/assets/javascripts/bootstrap.js +12 -0
- data/assets/javascripts/bootstrap/affix.js +135 -0
- data/assets/javascripts/bootstrap/alert.js +88 -0
- data/assets/javascripts/bootstrap/button.js +107 -0
- data/assets/javascripts/bootstrap/carousel.js +205 -0
- data/assets/javascripts/bootstrap/collapse.js +175 -0
- data/assets/javascripts/bootstrap/dropdown.js +147 -0
- data/assets/javascripts/bootstrap/modal.js +271 -0
- data/assets/javascripts/bootstrap/popover.js +110 -0
- data/assets/javascripts/bootstrap/scrollspy.js +154 -0
- data/assets/javascripts/bootstrap/tab.js +125 -0
- data/assets/javascripts/bootstrap/tooltip.js +422 -0
- data/assets/javascripts/bootstrap/transition.js +48 -0
- data/assets/stylesheets/_bootstrap-mincer.scss +17 -0
- data/assets/stylesheets/bootstrap.scss +50 -0
- data/assets/stylesheets/bootstrap/_alerts.scss +67 -0
- data/assets/stylesheets/bootstrap/_badges.scss +57 -0
- data/assets/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
- data/assets/stylesheets/bootstrap/_button-groups.scss +236 -0
- data/assets/stylesheets/bootstrap/_buttons.scss +159 -0
- data/assets/stylesheets/bootstrap/_carousel.scss +241 -0
- data/assets/stylesheets/bootstrap/_close.scss +35 -0
- data/assets/stylesheets/bootstrap/_code.scss +62 -0
- data/assets/stylesheets/bootstrap/_component-animations.scss +35 -0
- data/assets/stylesheets/bootstrap/_dropdowns.scss +214 -0
- data/assets/stylesheets/bootstrap/_forms.scss +478 -0
- data/assets/stylesheets/bootstrap/_glyphicons.scss +237 -0
- data/assets/stylesheets/bootstrap/_grid.scss +84 -0
- data/assets/stylesheets/bootstrap/_input-groups.scss +162 -0
- data/assets/stylesheets/bootstrap/_jumbotron.scss +48 -0
- data/assets/stylesheets/bootstrap/_labels.scss +66 -0
- data/assets/stylesheets/bootstrap/_list-group.scss +129 -0
- data/assets/stylesheets/bootstrap/_media.scss +56 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +39 -0
- data/assets/stylesheets/bootstrap/_modals.scss +147 -0
- data/assets/stylesheets/bootstrap/_navbar.scss +658 -0
- data/assets/stylesheets/bootstrap/_navs.scss +242 -0
- data/assets/stylesheets/bootstrap/_normalize.scss +425 -0
- data/assets/stylesheets/bootstrap/_pager.scss +55 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +88 -0
- data/assets/stylesheets/bootstrap/_panels.scss +240 -0
- data/assets/stylesheets/bootstrap/_popovers.scss +133 -0
- data/assets/stylesheets/bootstrap/_print.scss +101 -0
- data/assets/stylesheets/bootstrap/_progress-bars.scss +89 -0
- data/assets/stylesheets/bootstrap/_responsive-embed.scss +34 -0
- data/assets/stylesheets/bootstrap/_responsive-utilities.scss +173 -0
- data/assets/stylesheets/bootstrap/_scaffolding.scss +150 -0
- data/assets/stylesheets/bootstrap/_tables.scss +233 -0
- data/assets/stylesheets/bootstrap/_theme.scss +247 -0
- data/assets/stylesheets/bootstrap/_thumbnails.scss +38 -0
- data/assets/stylesheets/bootstrap/_tooltip.scss +95 -0
- data/assets/stylesheets/bootstrap/_type.scss +294 -0
- data/assets/stylesheets/bootstrap/_utilities.scss +56 -0
- data/assets/stylesheets/bootstrap/_variables.scss +849 -0
- data/assets/stylesheets/bootstrap/_wells.scss +29 -0
- data/assets/stylesheets/bootstrap/bootstrap.scss +50 -0
- data/assets/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +11 -0
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +50 -0
- data/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +84 -0
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +87 -0
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
- data/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_image.scss +33 -0
- data/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +31 -0
- data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
- data/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +23 -0
- data/assets/stylesheets/bootstrap/mixins/_panels.scss +20 -0
- data/assets/stylesheets/bootstrap/mixins/_progress-bar.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
- data/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +11 -0
- data/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +224 -0
- data/lib/aerogel/bootstrap.rb +5 -7
- data/lib/aerogel/bootstrap/version.rb +5 -0
- metadata +104 -29
- data/public/README.md +0 -1
@@ -0,0 +1,107 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: button.js v3.1.1
|
3
|
+
* http://getbootstrap.com/javascript/#buttons
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2011-2014 Twitter, Inc.
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
|
+
* ======================================================================== */
|
8
|
+
|
9
|
+
|
10
|
+
+function ($) {
|
11
|
+
'use strict';
|
12
|
+
|
13
|
+
// BUTTON PUBLIC CLASS DEFINITION
|
14
|
+
// ==============================
|
15
|
+
|
16
|
+
var Button = function (element, options) {
|
17
|
+
this.$element = $(element)
|
18
|
+
this.options = $.extend({}, Button.DEFAULTS, options)
|
19
|
+
this.isLoading = false
|
20
|
+
}
|
21
|
+
|
22
|
+
Button.DEFAULTS = {
|
23
|
+
loadingText: 'loading...'
|
24
|
+
}
|
25
|
+
|
26
|
+
Button.prototype.setState = function (state) {
|
27
|
+
var d = 'disabled'
|
28
|
+
var $el = this.$element
|
29
|
+
var val = $el.is('input') ? 'val' : 'html'
|
30
|
+
var data = $el.data()
|
31
|
+
|
32
|
+
state = state + 'Text'
|
33
|
+
|
34
|
+
if (!data.resetText) $el.data('resetText', $el[val]())
|
35
|
+
|
36
|
+
$el[val](data[state] || this.options[state])
|
37
|
+
|
38
|
+
// push to event loop to allow forms to submit
|
39
|
+
setTimeout($.proxy(function () {
|
40
|
+
if (state == 'loadingText') {
|
41
|
+
this.isLoading = true
|
42
|
+
$el.addClass(d).attr(d, d)
|
43
|
+
} else if (this.isLoading) {
|
44
|
+
this.isLoading = false
|
45
|
+
$el.removeClass(d).removeAttr(d)
|
46
|
+
}
|
47
|
+
}, this), 0)
|
48
|
+
}
|
49
|
+
|
50
|
+
Button.prototype.toggle = function () {
|
51
|
+
var changed = true
|
52
|
+
var $parent = this.$element.closest('[data-toggle="buttons"]')
|
53
|
+
|
54
|
+
if ($parent.length) {
|
55
|
+
var $input = this.$element.find('input')
|
56
|
+
if ($input.prop('type') == 'radio') {
|
57
|
+
if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
|
58
|
+
else $parent.find('.active').removeClass('active')
|
59
|
+
}
|
60
|
+
if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
|
61
|
+
}
|
62
|
+
|
63
|
+
if (changed) this.$element.toggleClass('active')
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
// BUTTON PLUGIN DEFINITION
|
68
|
+
// ========================
|
69
|
+
|
70
|
+
var old = $.fn.button
|
71
|
+
|
72
|
+
$.fn.button = function (option) {
|
73
|
+
return this.each(function () {
|
74
|
+
var $this = $(this)
|
75
|
+
var data = $this.data('bs.button')
|
76
|
+
var options = typeof option == 'object' && option
|
77
|
+
|
78
|
+
if (!data) $this.data('bs.button', (data = new Button(this, options)))
|
79
|
+
|
80
|
+
if (option == 'toggle') data.toggle()
|
81
|
+
else if (option) data.setState(option)
|
82
|
+
})
|
83
|
+
}
|
84
|
+
|
85
|
+
$.fn.button.Constructor = Button
|
86
|
+
|
87
|
+
|
88
|
+
// BUTTON NO CONFLICT
|
89
|
+
// ==================
|
90
|
+
|
91
|
+
$.fn.button.noConflict = function () {
|
92
|
+
$.fn.button = old
|
93
|
+
return this
|
94
|
+
}
|
95
|
+
|
96
|
+
|
97
|
+
// BUTTON DATA-API
|
98
|
+
// ===============
|
99
|
+
|
100
|
+
$(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
|
101
|
+
var $btn = $(e.target)
|
102
|
+
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
103
|
+
$btn.button('toggle')
|
104
|
+
e.preventDefault()
|
105
|
+
})
|
106
|
+
|
107
|
+
}(jQuery);
|
@@ -0,0 +1,205 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: carousel.js v3.1.1
|
3
|
+
* http://getbootstrap.com/javascript/#carousel
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2011-2014 Twitter, Inc.
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
|
+
* ======================================================================== */
|
8
|
+
|
9
|
+
|
10
|
+
+function ($) {
|
11
|
+
'use strict';
|
12
|
+
|
13
|
+
// CAROUSEL CLASS DEFINITION
|
14
|
+
// =========================
|
15
|
+
|
16
|
+
var Carousel = function (element, options) {
|
17
|
+
this.$element = $(element)
|
18
|
+
this.$indicators = this.$element.find('.carousel-indicators')
|
19
|
+
this.options = options
|
20
|
+
this.paused =
|
21
|
+
this.sliding =
|
22
|
+
this.interval =
|
23
|
+
this.$active =
|
24
|
+
this.$items = null
|
25
|
+
|
26
|
+
this.options.pause == 'hover' && this.$element
|
27
|
+
.on('mouseenter', $.proxy(this.pause, this))
|
28
|
+
.on('mouseleave', $.proxy(this.cycle, this))
|
29
|
+
}
|
30
|
+
|
31
|
+
Carousel.DEFAULTS = {
|
32
|
+
interval: 5000,
|
33
|
+
pause: 'hover',
|
34
|
+
wrap: true
|
35
|
+
}
|
36
|
+
|
37
|
+
Carousel.prototype.cycle = function (e) {
|
38
|
+
e || (this.paused = false)
|
39
|
+
|
40
|
+
this.interval && clearInterval(this.interval)
|
41
|
+
|
42
|
+
this.options.interval
|
43
|
+
&& !this.paused
|
44
|
+
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
|
45
|
+
|
46
|
+
return this
|
47
|
+
}
|
48
|
+
|
49
|
+
Carousel.prototype.getActiveIndex = function () {
|
50
|
+
this.$active = this.$element.find('.item.active')
|
51
|
+
this.$items = this.$active.parent().children('.item')
|
52
|
+
|
53
|
+
return this.$items.index(this.$active)
|
54
|
+
}
|
55
|
+
|
56
|
+
Carousel.prototype.to = function (pos) {
|
57
|
+
var that = this
|
58
|
+
var activeIndex = this.getActiveIndex()
|
59
|
+
|
60
|
+
if (pos > (this.$items.length - 1) || pos < 0) return
|
61
|
+
|
62
|
+
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid". not a typo. past tense of "to slide".
|
63
|
+
if (activeIndex == pos) return this.pause().cycle()
|
64
|
+
|
65
|
+
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
|
66
|
+
}
|
67
|
+
|
68
|
+
Carousel.prototype.pause = function (e) {
|
69
|
+
e || (this.paused = true)
|
70
|
+
|
71
|
+
if (this.$element.find('.next, .prev').length && $.support.transition) {
|
72
|
+
this.$element.trigger($.support.transition.end)
|
73
|
+
this.cycle(true)
|
74
|
+
}
|
75
|
+
|
76
|
+
this.interval = clearInterval(this.interval)
|
77
|
+
|
78
|
+
return this
|
79
|
+
}
|
80
|
+
|
81
|
+
Carousel.prototype.next = function () {
|
82
|
+
if (this.sliding) return
|
83
|
+
return this.slide('next')
|
84
|
+
}
|
85
|
+
|
86
|
+
Carousel.prototype.prev = function () {
|
87
|
+
if (this.sliding) return
|
88
|
+
return this.slide('prev')
|
89
|
+
}
|
90
|
+
|
91
|
+
Carousel.prototype.slide = function (type, next) {
|
92
|
+
var $active = this.$element.find('.item.active')
|
93
|
+
var $next = next || $active[type]()
|
94
|
+
var isCycling = this.interval
|
95
|
+
var direction = type == 'next' ? 'left' : 'right'
|
96
|
+
var fallback = type == 'next' ? 'first' : 'last'
|
97
|
+
var that = this
|
98
|
+
|
99
|
+
if (!$next.length) {
|
100
|
+
if (!this.options.wrap) return
|
101
|
+
$next = this.$element.find('.item')[fallback]()
|
102
|
+
}
|
103
|
+
|
104
|
+
if ($next.hasClass('active')) return this.sliding = false
|
105
|
+
|
106
|
+
var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
|
107
|
+
this.$element.trigger(e)
|
108
|
+
if (e.isDefaultPrevented()) return
|
109
|
+
|
110
|
+
this.sliding = true
|
111
|
+
|
112
|
+
isCycling && this.pause()
|
113
|
+
|
114
|
+
if (this.$indicators.length) {
|
115
|
+
this.$indicators.find('.active').removeClass('active')
|
116
|
+
this.$element.one('slid.bs.carousel', function () { // yes, "slid". not a typo. past tense of "to slide".
|
117
|
+
var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
|
118
|
+
$nextIndicator && $nextIndicator.addClass('active')
|
119
|
+
})
|
120
|
+
}
|
121
|
+
|
122
|
+
if ($.support.transition && this.$element.hasClass('slide')) {
|
123
|
+
$next.addClass(type)
|
124
|
+
$next[0].offsetWidth // force reflow
|
125
|
+
$active.addClass(direction)
|
126
|
+
$next.addClass(direction)
|
127
|
+
$active
|
128
|
+
.one($.support.transition.end, function () {
|
129
|
+
$next.removeClass([type, direction].join(' ')).addClass('active')
|
130
|
+
$active.removeClass(['active', direction].join(' '))
|
131
|
+
that.sliding = false
|
132
|
+
setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0) // yes, "slid". not a typo. past tense of "to slide".
|
133
|
+
})
|
134
|
+
.emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
|
135
|
+
} else {
|
136
|
+
$active.removeClass('active')
|
137
|
+
$next.addClass('active')
|
138
|
+
this.sliding = false
|
139
|
+
this.$element.trigger('slid.bs.carousel') // yes, "slid". not a typo. past tense of "to slide".
|
140
|
+
}
|
141
|
+
|
142
|
+
isCycling && this.cycle()
|
143
|
+
|
144
|
+
return this
|
145
|
+
}
|
146
|
+
|
147
|
+
|
148
|
+
// CAROUSEL PLUGIN DEFINITION
|
149
|
+
// ==========================
|
150
|
+
|
151
|
+
var old = $.fn.carousel
|
152
|
+
|
153
|
+
$.fn.carousel = function (option) {
|
154
|
+
return this.each(function () {
|
155
|
+
var $this = $(this)
|
156
|
+
var data = $this.data('bs.carousel')
|
157
|
+
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
158
|
+
var action = typeof option == 'string' ? option : options.slide
|
159
|
+
|
160
|
+
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
|
161
|
+
if (typeof option == 'number') data.to(option)
|
162
|
+
else if (action) data[action]()
|
163
|
+
else if (options.interval) data.pause().cycle()
|
164
|
+
})
|
165
|
+
}
|
166
|
+
|
167
|
+
$.fn.carousel.Constructor = Carousel
|
168
|
+
|
169
|
+
|
170
|
+
// CAROUSEL NO CONFLICT
|
171
|
+
// ====================
|
172
|
+
|
173
|
+
$.fn.carousel.noConflict = function () {
|
174
|
+
$.fn.carousel = old
|
175
|
+
return this
|
176
|
+
}
|
177
|
+
|
178
|
+
|
179
|
+
// CAROUSEL DATA-API
|
180
|
+
// =================
|
181
|
+
|
182
|
+
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
|
183
|
+
var $this = $(this), href
|
184
|
+
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
185
|
+
var options = $.extend({}, $target.data(), $this.data())
|
186
|
+
var slideIndex = $this.attr('data-slide-to')
|
187
|
+
if (slideIndex) options.interval = false
|
188
|
+
|
189
|
+
$target.carousel(options)
|
190
|
+
|
191
|
+
if (slideIndex = $this.attr('data-slide-to')) {
|
192
|
+
$target.data('bs.carousel').to(slideIndex)
|
193
|
+
}
|
194
|
+
|
195
|
+
e.preventDefault()
|
196
|
+
})
|
197
|
+
|
198
|
+
$(window).on('load', function () {
|
199
|
+
$('[data-ride="carousel"]').each(function () {
|
200
|
+
var $carousel = $(this)
|
201
|
+
$carousel.carousel($carousel.data())
|
202
|
+
})
|
203
|
+
})
|
204
|
+
|
205
|
+
}(jQuery);
|
@@ -0,0 +1,175 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: collapse.js v3.1.1
|
3
|
+
* http://getbootstrap.com/javascript/#collapse
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2011-2014 Twitter, Inc.
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
|
+
* ======================================================================== */
|
8
|
+
|
9
|
+
|
10
|
+
+function ($) {
|
11
|
+
'use strict';
|
12
|
+
|
13
|
+
// COLLAPSE PUBLIC CLASS DEFINITION
|
14
|
+
// ================================
|
15
|
+
|
16
|
+
var Collapse = function (element, options) {
|
17
|
+
this.$element = $(element)
|
18
|
+
this.options = $.extend({}, Collapse.DEFAULTS, options)
|
19
|
+
this.transitioning = null
|
20
|
+
|
21
|
+
if (this.options.parent) this.$parent = $(this.options.parent)
|
22
|
+
if (this.options.toggle) this.toggle()
|
23
|
+
}
|
24
|
+
|
25
|
+
Collapse.DEFAULTS = {
|
26
|
+
toggle: true
|
27
|
+
}
|
28
|
+
|
29
|
+
Collapse.prototype.dimension = function () {
|
30
|
+
var hasWidth = this.$element.hasClass('width')
|
31
|
+
return hasWidth ? 'width' : 'height'
|
32
|
+
}
|
33
|
+
|
34
|
+
Collapse.prototype.show = function () {
|
35
|
+
if (this.transitioning || this.$element.hasClass('in')) return
|
36
|
+
|
37
|
+
var startEvent = $.Event('show.bs.collapse')
|
38
|
+
this.$element.trigger(startEvent)
|
39
|
+
if (startEvent.isDefaultPrevented()) return
|
40
|
+
|
41
|
+
var actives = this.$parent && this.$parent.find('> .panel > .in')
|
42
|
+
|
43
|
+
if (actives && actives.length) {
|
44
|
+
var hasData = actives.data('bs.collapse')
|
45
|
+
if (hasData && hasData.transitioning) return
|
46
|
+
actives.collapse('hide')
|
47
|
+
hasData || actives.data('bs.collapse', null)
|
48
|
+
}
|
49
|
+
|
50
|
+
var dimension = this.dimension()
|
51
|
+
|
52
|
+
this.$element
|
53
|
+
.removeClass('collapse')
|
54
|
+
.addClass('collapsing')[dimension](0)
|
55
|
+
|
56
|
+
this.transitioning = 1
|
57
|
+
|
58
|
+
var complete = function (e) {
|
59
|
+
if (e && e.target != this.$element[0]) {
|
60
|
+
this.$element
|
61
|
+
.one($.support.transition.end, $.proxy(complete, this))
|
62
|
+
return
|
63
|
+
}
|
64
|
+
this.$element
|
65
|
+
.removeClass('collapsing')
|
66
|
+
.addClass('collapse in')[dimension]('auto')
|
67
|
+
this.transitioning = 0
|
68
|
+
this.$element.trigger('shown.bs.collapse')
|
69
|
+
}
|
70
|
+
|
71
|
+
if (!$.support.transition) return complete.call(this)
|
72
|
+
|
73
|
+
var scrollSize = $.camelCase(['scroll', dimension].join('-'))
|
74
|
+
|
75
|
+
this.$element
|
76
|
+
.one($.support.transition.end, $.proxy(complete, this))
|
77
|
+
.emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
|
78
|
+
}
|
79
|
+
|
80
|
+
Collapse.prototype.hide = function () {
|
81
|
+
if (this.transitioning || !this.$element.hasClass('in')) return
|
82
|
+
|
83
|
+
var startEvent = $.Event('hide.bs.collapse')
|
84
|
+
this.$element.trigger(startEvent)
|
85
|
+
if (startEvent.isDefaultPrevented()) return
|
86
|
+
|
87
|
+
var dimension = this.dimension()
|
88
|
+
|
89
|
+
this.$element[dimension](this.$element[dimension]())[0].offsetHeight
|
90
|
+
|
91
|
+
this.$element
|
92
|
+
.addClass('collapsing')
|
93
|
+
.removeClass('collapse')
|
94
|
+
.removeClass('in')
|
95
|
+
|
96
|
+
this.transitioning = 1
|
97
|
+
|
98
|
+
var complete = function (e) {
|
99
|
+
if (e && e.target != this.$element[0]) {
|
100
|
+
this.$element
|
101
|
+
.one($.support.transition.end, $.proxy(complete, this))
|
102
|
+
return
|
103
|
+
}
|
104
|
+
this.transitioning = 0
|
105
|
+
this.$element
|
106
|
+
.trigger('hidden.bs.collapse')
|
107
|
+
.removeClass('collapsing')
|
108
|
+
.addClass('collapse')
|
109
|
+
}
|
110
|
+
|
111
|
+
if (!$.support.transition) return complete.call(this)
|
112
|
+
|
113
|
+
this.$element
|
114
|
+
[dimension](0)
|
115
|
+
.one($.support.transition.end, $.proxy(complete, this))
|
116
|
+
.emulateTransitionEnd(350)
|
117
|
+
}
|
118
|
+
|
119
|
+
Collapse.prototype.toggle = function () {
|
120
|
+
this[this.$element.hasClass('in') ? 'hide' : 'show']()
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
// COLLAPSE PLUGIN DEFINITION
|
125
|
+
// ==========================
|
126
|
+
|
127
|
+
var old = $.fn.collapse
|
128
|
+
|
129
|
+
$.fn.collapse = function (option) {
|
130
|
+
return this.each(function () {
|
131
|
+
var $this = $(this)
|
132
|
+
var data = $this.data('bs.collapse')
|
133
|
+
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
134
|
+
|
135
|
+
if (!data && options.toggle && option == 'show') option = !option
|
136
|
+
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
|
137
|
+
if (typeof option == 'string') data[option]()
|
138
|
+
})
|
139
|
+
}
|
140
|
+
|
141
|
+
$.fn.collapse.Constructor = Collapse
|
142
|
+
|
143
|
+
|
144
|
+
// COLLAPSE NO CONFLICT
|
145
|
+
// ====================
|
146
|
+
|
147
|
+
$.fn.collapse.noConflict = function () {
|
148
|
+
$.fn.collapse = old
|
149
|
+
return this
|
150
|
+
}
|
151
|
+
|
152
|
+
|
153
|
+
// COLLAPSE DATA-API
|
154
|
+
// =================
|
155
|
+
|
156
|
+
$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
|
157
|
+
var $this = $(this), href
|
158
|
+
var target = $this.attr('data-target')
|
159
|
+
|| e.preventDefault()
|
160
|
+
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
|
161
|
+
var $target = $(target)
|
162
|
+
var data = $target.data('bs.collapse')
|
163
|
+
var option = data ? 'toggle' : $this.data()
|
164
|
+
var parent = $this.attr('data-parent')
|
165
|
+
var $parent = parent && $(parent)
|
166
|
+
|
167
|
+
if (!data || !data.transitioning) {
|
168
|
+
if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
|
169
|
+
$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
|
170
|
+
}
|
171
|
+
|
172
|
+
$target.collapse(option)
|
173
|
+
})
|
174
|
+
|
175
|
+
}(jQuery);
|