compass_twitter_bootstrap 2.0.1.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +17 -0
- data/build/convert.rb +2 -12
- data/lib/compass_twitter_bootstrap/version.rb +1 -1
- data/stylesheets/_compass_twitter_bootstrap.scss +2 -2
- data/stylesheets/_compass_twitter_bootstrap_awesome.scss +66 -0
- data/stylesheets/_compass_twitter_bootstrap_responsive.scss +14 -293
- data/stylesheets/compass_twitter_bootstrap/_accordion.scss +6 -1
- data/stylesheets/compass_twitter_bootstrap/_alerts.scss +3 -15
- data/stylesheets/compass_twitter_bootstrap/_breadcrumbs.scss +5 -3
- data/stylesheets/compass_twitter_bootstrap/_button-groups.scss +82 -39
- data/stylesheets/compass_twitter_bootstrap/_buttons.scss +38 -30
- data/stylesheets/compass_twitter_bootstrap/_carousel.scss +5 -5
- data/stylesheets/compass_twitter_bootstrap/_close.scss +13 -2
- data/stylesheets/compass_twitter_bootstrap/_code.scss +9 -9
- data/stylesheets/compass_twitter_bootstrap/_component-animations.scss +10 -8
- data/stylesheets/compass_twitter_bootstrap/_dropdowns.scss +62 -49
- data/stylesheets/compass_twitter_bootstrap/_font-awesome.scss +267 -0
- data/stylesheets/compass_twitter_bootstrap/_forms.scss +141 -77
- data/stylesheets/compass_twitter_bootstrap/_grid.scss +2 -5
- data/stylesheets/compass_twitter_bootstrap/_hero-unit.scss +4 -2
- data/stylesheets/compass_twitter_bootstrap/_labels-badges.scss +63 -0
- data/stylesheets/compass_twitter_bootstrap/_layouts.scss +3 -3
- data/stylesheets/compass_twitter_bootstrap/_mixins.scss +275 -255
- data/stylesheets/compass_twitter_bootstrap/_modals.scss +19 -12
- data/stylesheets/compass_twitter_bootstrap/_navbar.scss +146 -81
- data/stylesheets/compass_twitter_bootstrap/_navs.scss +77 -52
- data/stylesheets/compass_twitter_bootstrap/_pager.scss +8 -2
- data/stylesheets/compass_twitter_bootstrap/_pagination.scss +6 -5
- data/stylesheets/compass_twitter_bootstrap/_popovers.scss +9 -9
- data/stylesheets/compass_twitter_bootstrap/_progress-bars.scss +41 -19
- data/stylesheets/compass_twitter_bootstrap/_reset.scss +4 -4
- data/stylesheets/compass_twitter_bootstrap/_responsive-1200px-min.scss +26 -0
- data/stylesheets/compass_twitter_bootstrap/_responsive-767px-max.scss +149 -0
- data/stylesheets/compass_twitter_bootstrap/_responsive-768px-979px.scss +17 -0
- data/stylesheets/compass_twitter_bootstrap/_responsive-navbar.scss +146 -0
- data/stylesheets/compass_twitter_bootstrap/_responsive-utilities.scss +41 -0
- data/stylesheets/compass_twitter_bootstrap/_scaffolding.scss +4 -4
- data/stylesheets/compass_twitter_bootstrap/_sprites.scss +42 -9
- data/stylesheets/compass_twitter_bootstrap/_tables.scss +60 -34
- data/stylesheets/compass_twitter_bootstrap/_thumbnails.scss +18 -6
- data/stylesheets/compass_twitter_bootstrap/_tooltip.scss +7 -7
- data/stylesheets/compass_twitter_bootstrap/_type.scss +28 -11
- data/stylesheets/compass_twitter_bootstrap/_variables.scss +107 -9
- data/stylesheets/compass_twitter_bootstrap/_wells.scss +13 -2
- data/stylesheets_sass/_compass_twitter_bootstrap.sass +2 -2
- data/stylesheets_sass/_compass_twitter_bootstrap_awesome.sass +70 -0
- data/stylesheets_sass/_compass_twitter_bootstrap_responsive.sass +13 -224
- data/stylesheets_sass/compass_twitter_bootstrap/_accordion.sass +5 -1
- data/stylesheets_sass/compass_twitter_bootstrap/_alerts.sass +3 -14
- data/stylesheets_sass/compass_twitter_bootstrap/_breadcrumbs.sass +5 -3
- data/stylesheets_sass/compass_twitter_bootstrap/_button-groups.sass +73 -36
- data/stylesheets_sass/compass_twitter_bootstrap/_buttons.sass +39 -28
- data/stylesheets_sass/compass_twitter_bootstrap/_carousel.sass +5 -5
- data/stylesheets_sass/compass_twitter_bootstrap/_close.sass +12 -2
- data/stylesheets_sass/compass_twitter_bootstrap/_code.sass +10 -9
- data/stylesheets_sass/compass_twitter_bootstrap/_component-animations.sass +5 -5
- data/stylesheets_sass/compass_twitter_bootstrap/_dropdowns.sass +57 -47
- data/stylesheets_sass/compass_twitter_bootstrap/_font-awesome.sass +515 -0
- data/stylesheets_sass/compass_twitter_bootstrap/_forms.sass +140 -76
- data/stylesheets_sass/compass_twitter_bootstrap/_grid.sass +2 -5
- data/stylesheets_sass/compass_twitter_bootstrap/_hero-unit.sass +4 -2
- data/stylesheets_sass/compass_twitter_bootstrap/_labels-badges.sass +85 -0
- data/stylesheets_sass/compass_twitter_bootstrap/_layouts.sass +3 -3
- data/stylesheets_sass/compass_twitter_bootstrap/_mixins.sass +277 -260
- data/stylesheets_sass/compass_twitter_bootstrap/_modals.sass +19 -12
- data/stylesheets_sass/compass_twitter_bootstrap/_navbar.sass +138 -78
- data/stylesheets_sass/compass_twitter_bootstrap/_navs.sass +77 -51
- data/stylesheets_sass/compass_twitter_bootstrap/_pager.sass +8 -2
- data/stylesheets_sass/compass_twitter_bootstrap/_pagination.sass +6 -5
- data/stylesheets_sass/compass_twitter_bootstrap/_popovers.sass +9 -9
- data/stylesheets_sass/compass_twitter_bootstrap/_progress-bars.sass +44 -19
- data/stylesheets_sass/compass_twitter_bootstrap/_reset.sass +4 -3
- data/stylesheets_sass/compass_twitter_bootstrap/_responsive-1200px-min.sass +17 -0
- data/stylesheets_sass/compass_twitter_bootstrap/_responsive-767px-max.sass +115 -0
- data/stylesheets_sass/compass_twitter_bootstrap/_responsive-768px-979px.sass +11 -0
- data/stylesheets_sass/compass_twitter_bootstrap/_responsive-navbar.sass +115 -0
- data/stylesheets_sass/compass_twitter_bootstrap/_responsive-utilities.sass +56 -0
- data/stylesheets_sass/compass_twitter_bootstrap/_scaffolding.sass +4 -4
- data/stylesheets_sass/compass_twitter_bootstrap/_sprites.sass +70 -7
- data/stylesheets_sass/compass_twitter_bootstrap/_tables.sass +72 -34
- data/stylesheets_sass/compass_twitter_bootstrap/_thumbnails.sass +15 -5
- data/stylesheets_sass/compass_twitter_bootstrap/_tooltip.sass +7 -7
- data/stylesheets_sass/compass_twitter_bootstrap/_type.sass +27 -11
- data/stylesheets_sass/compass_twitter_bootstrap/_variables.sass +105 -8
- data/stylesheets_sass/compass_twitter_bootstrap/_wells.sass +11 -2
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.svg +175 -0
- data/vendor/assets/fonts/fontawesome-webfont.svgz +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/bootstrap-alert.js +28 -32
- data/vendor/assets/javascripts/bootstrap-all.js +12 -0
- data/vendor/assets/javascripts/bootstrap-button.js +32 -34
- data/vendor/assets/javascripts/bootstrap-carousel.js +33 -21
- data/vendor/assets/javascripts/bootstrap-collapse.js +47 -26
- data/vendor/assets/javascripts/bootstrap-dropdown.js +18 -10
- data/vendor/assets/javascripts/bootstrap-modal.js +25 -17
- data/vendor/assets/javascripts/bootstrap-popover.js +13 -10
- data/vendor/assets/javascripts/bootstrap-scrollspy.js +44 -18
- data/vendor/assets/javascripts/bootstrap-tab.js +12 -7
- data/vendor/assets/javascripts/bootstrap-tooltip.js +40 -35
- data/vendor/assets/javascripts/bootstrap-transition.js +30 -20
- data/vendor/assets/javascripts/bootstrap-typeahead.js +29 -15
- metadata +29 -9
- data/stylesheets/compass_twitter_bootstrap/_labels.scss +0 -32
- data/stylesheets_sass/compass_twitter_bootstrap/_labels.sass +0 -42
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ==========================================================
|
2
|
-
* bootstrap-alert.js v2.0.
|
2
|
+
* bootstrap-alert.js v2.0.3
|
3
3
|
* http://twitter.github.com/bootstrap/javascript.html#alerts
|
4
4
|
* ==========================================================
|
5
5
|
* Copyright 2012 Twitter, Inc.
|
@@ -18,61 +18,57 @@
|
|
18
18
|
* ========================================================== */
|
19
19
|
|
20
20
|
|
21
|
-
!function(
|
21
|
+
!function ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
22
24
|
|
23
|
-
"use strict"
|
24
25
|
|
25
26
|
/* ALERT CLASS DEFINITION
|
26
27
|
* ====================== */
|
27
28
|
|
28
29
|
var dismiss = '[data-dismiss="alert"]'
|
29
|
-
, Alert = function (
|
30
|
+
, Alert = function (el) {
|
30
31
|
$(el).on('click', dismiss, this.close)
|
31
32
|
}
|
32
33
|
|
33
|
-
Alert.prototype = {
|
34
|
-
|
35
|
-
|
34
|
+
Alert.prototype.close = function (e) {
|
35
|
+
var $this = $(this)
|
36
|
+
, selector = $this.attr('data-target')
|
37
|
+
, $parent
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
if (!selector) {
|
40
|
+
selector = $this.attr('href')
|
41
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
42
|
+
}
|
41
43
|
|
42
|
-
|
43
|
-
selector = $this.attr('href')
|
44
|
-
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
45
|
-
}
|
44
|
+
$parent = $(selector)
|
46
45
|
|
47
|
-
|
48
|
-
$parent.trigger('close')
|
46
|
+
e && e.preventDefault()
|
49
47
|
|
50
|
-
|
48
|
+
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
|
51
49
|
|
52
|
-
|
50
|
+
$parent.trigger(e = $.Event('close'))
|
53
51
|
|
54
|
-
|
55
|
-
.trigger('close')
|
56
|
-
.removeClass('in')
|
52
|
+
if (e.isDefaultPrevented()) return
|
57
53
|
|
58
|
-
|
59
|
-
$parent
|
60
|
-
.trigger('closed')
|
61
|
-
.remove()
|
62
|
-
}
|
54
|
+
$parent.removeClass('in')
|
63
55
|
|
64
|
-
|
65
|
-
|
66
|
-
|
56
|
+
function removeElement() {
|
57
|
+
$parent
|
58
|
+
.trigger('closed')
|
59
|
+
.remove()
|
67
60
|
}
|
68
61
|
|
62
|
+
$.support.transition && $parent.hasClass('fade') ?
|
63
|
+
$parent.on($.support.transition.end, removeElement) :
|
64
|
+
removeElement()
|
69
65
|
}
|
70
66
|
|
71
67
|
|
72
68
|
/* ALERT PLUGIN DEFINITION
|
73
69
|
* ======================= */
|
74
70
|
|
75
|
-
$.fn.alert = function (
|
71
|
+
$.fn.alert = function (option) {
|
76
72
|
return this.each(function () {
|
77
73
|
var $this = $(this)
|
78
74
|
, data = $this.data('alert')
|
@@ -91,4 +87,4 @@
|
|
91
87
|
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
|
92
88
|
})
|
93
89
|
|
94
|
-
}(
|
90
|
+
}(window.jQuery);
|
@@ -0,0 +1,12 @@
|
|
1
|
+
//=require bootstrap-transition
|
2
|
+
//=require bootstrap-alert
|
3
|
+
//=require bootstrap-modal
|
4
|
+
//=require bootstrap-dropdown
|
5
|
+
//=require bootstrap-scrollspy
|
6
|
+
//=require bootstrap-tab
|
7
|
+
//=require bootstrap-tooltip
|
8
|
+
//=require bootstrap-popover
|
9
|
+
//=require bootstrap-button
|
10
|
+
//=require bootstrap-collapse
|
11
|
+
//=require bootstrap-carousel
|
12
|
+
//=require bootstrap-typeahead
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ============================================================
|
2
|
-
* bootstrap-button.js v2.0.
|
2
|
+
* bootstrap-button.js v2.0.3
|
3
3
|
* http://twitter.github.com/bootstrap/javascript.html#buttons
|
4
4
|
* ============================================================
|
5
5
|
* Copyright 2012 Twitter, Inc.
|
@@ -17,58 +17,54 @@
|
|
17
17
|
* limitations under the License.
|
18
18
|
* ============================================================ */
|
19
19
|
|
20
|
-
!function( $ ){
|
21
20
|
|
22
|
-
|
21
|
+
!function ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
23
25
|
|
24
26
|
/* BUTTON PUBLIC CLASS DEFINITION
|
25
27
|
* ============================== */
|
26
28
|
|
27
|
-
var Button = function (
|
29
|
+
var Button = function (element, options) {
|
28
30
|
this.$element = $(element)
|
29
31
|
this.options = $.extend({}, $.fn.button.defaults, options)
|
30
32
|
}
|
31
33
|
|
32
|
-
Button.prototype = {
|
33
|
-
|
34
|
-
|
34
|
+
Button.prototype.setState = function (state) {
|
35
|
+
var d = 'disabled'
|
36
|
+
, $el = this.$element
|
37
|
+
, data = $el.data()
|
38
|
+
, val = $el.is('input') ? 'val' : 'html'
|
35
39
|
|
36
|
-
|
37
|
-
|
38
|
-
, $el = this.$element
|
39
|
-
, data = $el.data()
|
40
|
-
, val = $el.is('input') ? 'val' : 'html'
|
40
|
+
state = state + 'Text'
|
41
|
+
data.resetText || $el.data('resetText', $el[val]())
|
41
42
|
|
42
|
-
|
43
|
-
data.resetText || $el.data('resetText', $el[val]())
|
43
|
+
$el[val](data[state] || this.options[state])
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
}, 0)
|
53
|
-
}
|
54
|
-
|
55
|
-
, toggle: function () {
|
56
|
-
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
|
45
|
+
// push to event loop to allow forms to submit
|
46
|
+
setTimeout(function () {
|
47
|
+
state == 'loadingText' ?
|
48
|
+
$el.addClass(d).attr(d, d) :
|
49
|
+
$el.removeClass(d).removeAttr(d)
|
50
|
+
}, 0)
|
51
|
+
}
|
57
52
|
|
58
|
-
|
59
|
-
|
60
|
-
.removeClass('active')
|
53
|
+
Button.prototype.toggle = function () {
|
54
|
+
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
|
61
55
|
|
62
|
-
|
63
|
-
|
56
|
+
$parent && $parent
|
57
|
+
.find('.active')
|
58
|
+
.removeClass('active')
|
64
59
|
|
60
|
+
this.$element.toggleClass('active')
|
65
61
|
}
|
66
62
|
|
67
63
|
|
68
64
|
/* BUTTON PLUGIN DEFINITION
|
69
65
|
* ======================== */
|
70
66
|
|
71
|
-
$.fn.button = function (
|
67
|
+
$.fn.button = function (option) {
|
72
68
|
return this.each(function () {
|
73
69
|
var $this = $(this)
|
74
70
|
, data = $this.data('button')
|
@@ -91,8 +87,10 @@
|
|
91
87
|
|
92
88
|
$(function () {
|
93
89
|
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
|
94
|
-
$(e.
|
90
|
+
var $btn = $(e.target)
|
91
|
+
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
92
|
+
$btn.button('toggle')
|
95
93
|
})
|
96
94
|
})
|
97
95
|
|
98
|
-
}(
|
96
|
+
}(window.jQuery);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ==========================================================
|
2
|
-
* bootstrap-carousel.js v2.0.
|
2
|
+
* bootstrap-carousel.js v2.0.3
|
3
3
|
* http://twitter.github.com/bootstrap/javascript.html#carousel
|
4
4
|
* ==========================================================
|
5
5
|
* Copyright 2012 Twitter, Inc.
|
@@ -18,23 +18,30 @@
|
|
18
18
|
* ========================================================== */
|
19
19
|
|
20
20
|
|
21
|
-
!function(
|
21
|
+
!function ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
22
24
|
|
23
|
-
"use strict"
|
24
25
|
|
25
26
|
/* CAROUSEL CLASS DEFINITION
|
26
27
|
* ========================= */
|
27
28
|
|
28
29
|
var Carousel = function (element, options) {
|
29
30
|
this.$element = $(element)
|
30
|
-
this.options =
|
31
|
+
this.options = options
|
31
32
|
this.options.slide && this.slide(this.options.slide)
|
33
|
+
this.options.pause == 'hover' && this.$element
|
34
|
+
.on('mouseenter', $.proxy(this.pause, this))
|
35
|
+
.on('mouseleave', $.proxy(this.cycle, this))
|
32
36
|
}
|
33
37
|
|
34
38
|
Carousel.prototype = {
|
35
39
|
|
36
|
-
cycle: function () {
|
37
|
-
|
40
|
+
cycle: function (e) {
|
41
|
+
if (!e) this.paused = false
|
42
|
+
this.options.interval
|
43
|
+
&& !this.paused
|
44
|
+
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
|
38
45
|
return this
|
39
46
|
}
|
40
47
|
|
@@ -59,7 +66,8 @@
|
|
59
66
|
return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
|
60
67
|
}
|
61
68
|
|
62
|
-
, pause: function () {
|
69
|
+
, pause: function (e) {
|
70
|
+
if (!e) this.paused = true
|
63
71
|
clearInterval(this.interval)
|
64
72
|
this.interval = null
|
65
73
|
return this
|
@@ -82,8 +90,7 @@
|
|
82
90
|
, direction = type == 'next' ? 'left' : 'right'
|
83
91
|
, fallback = type == 'next' ? 'first' : 'last'
|
84
92
|
, that = this
|
85
|
-
|
86
|
-
if (!$next.length) return
|
93
|
+
, e = $.Event('slide')
|
87
94
|
|
88
95
|
this.sliding = true
|
89
96
|
|
@@ -91,24 +98,28 @@
|
|
91
98
|
|
92
99
|
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
|
93
100
|
|
94
|
-
if (
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
this.$element.trigger('slid')
|
100
|
-
} else {
|
101
|
+
if ($next.hasClass('active')) return
|
102
|
+
|
103
|
+
if ($.support.transition && this.$element.hasClass('slide')) {
|
104
|
+
this.$element.trigger(e)
|
105
|
+
if (e.isDefaultPrevented()) return
|
101
106
|
$next.addClass(type)
|
102
107
|
$next[0].offsetWidth // force reflow
|
103
108
|
$active.addClass(direction)
|
104
109
|
$next.addClass(direction)
|
105
|
-
this.$element.trigger('slide')
|
106
110
|
this.$element.one($.support.transition.end, function () {
|
107
111
|
$next.removeClass([type, direction].join(' ')).addClass('active')
|
108
112
|
$active.removeClass(['active', direction].join(' '))
|
109
113
|
that.sliding = false
|
110
114
|
setTimeout(function () { that.$element.trigger('slid') }, 0)
|
111
115
|
})
|
116
|
+
} else {
|
117
|
+
this.$element.trigger(e)
|
118
|
+
if (e.isDefaultPrevented()) return
|
119
|
+
$active.removeClass('active')
|
120
|
+
$next.addClass('active')
|
121
|
+
this.sliding = false
|
122
|
+
this.$element.trigger('slid')
|
112
123
|
}
|
113
124
|
|
114
125
|
isCycling && this.cycle()
|
@@ -122,20 +133,21 @@
|
|
122
133
|
/* CAROUSEL PLUGIN DEFINITION
|
123
134
|
* ========================== */
|
124
135
|
|
125
|
-
$.fn.carousel = function (
|
136
|
+
$.fn.carousel = function (option) {
|
126
137
|
return this.each(function () {
|
127
138
|
var $this = $(this)
|
128
139
|
, data = $this.data('carousel')
|
129
|
-
, options = typeof option == 'object' && option
|
140
|
+
, options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
|
130
141
|
if (!data) $this.data('carousel', (data = new Carousel(this, options)))
|
131
142
|
if (typeof option == 'number') data.to(option)
|
132
143
|
else if (typeof option == 'string' || (option = options.slide)) data[option]()
|
133
|
-
else data.cycle()
|
144
|
+
else if (options.interval) data.cycle()
|
134
145
|
})
|
135
146
|
}
|
136
147
|
|
137
148
|
$.fn.carousel.defaults = {
|
138
149
|
interval: 5000
|
150
|
+
, pause: 'hover'
|
139
151
|
}
|
140
152
|
|
141
153
|
$.fn.carousel.Constructor = Carousel
|
@@ -154,4 +166,4 @@
|
|
154
166
|
})
|
155
167
|
})
|
156
168
|
|
157
|
-
}(
|
169
|
+
}(window.jQuery);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* =============================================================
|
2
|
-
* bootstrap-collapse.js v2.0.
|
2
|
+
* bootstrap-collapse.js v2.0.3
|
3
3
|
* http://twitter.github.com/bootstrap/javascript.html#collapse
|
4
4
|
* =============================================================
|
5
5
|
* Copyright 2012 Twitter, Inc.
|
@@ -17,16 +17,21 @@
|
|
17
17
|
* limitations under the License.
|
18
18
|
* ============================================================ */
|
19
19
|
|
20
|
-
!function( $ ){
|
21
20
|
|
22
|
-
|
21
|
+
!function ($) {
|
23
22
|
|
24
|
-
|
25
|
-
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* COLLAPSE PUBLIC CLASS DEFINITION
|
27
|
+
* ================================ */
|
28
|
+
|
29
|
+
var Collapse = function (element, options) {
|
30
|
+
this.$element = $(element)
|
26
31
|
this.options = $.extend({}, $.fn.collapse.defaults, options)
|
27
32
|
|
28
|
-
if (this.options
|
29
|
-
this.$parent = $(this.options
|
33
|
+
if (this.options.parent) {
|
34
|
+
this.$parent = $(this.options.parent)
|
30
35
|
}
|
31
36
|
|
32
37
|
this.options.toggle && this.toggle()
|
@@ -42,31 +47,39 @@
|
|
42
47
|
}
|
43
48
|
|
44
49
|
, show: function () {
|
45
|
-
var dimension
|
46
|
-
, scroll
|
47
|
-
, actives
|
50
|
+
var dimension
|
51
|
+
, scroll
|
52
|
+
, actives
|
48
53
|
, hasData
|
49
54
|
|
55
|
+
if (this.transitioning) return
|
56
|
+
|
57
|
+
dimension = this.dimension()
|
58
|
+
scroll = $.camelCase(['scroll', dimension].join('-'))
|
59
|
+
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
|
60
|
+
|
50
61
|
if (actives && actives.length) {
|
51
62
|
hasData = actives.data('collapse')
|
63
|
+
if (hasData && hasData.transitioning) return
|
52
64
|
actives.collapse('hide')
|
53
65
|
hasData || actives.data('collapse', null)
|
54
66
|
}
|
55
67
|
|
56
68
|
this.$element[dimension](0)
|
57
|
-
this.transition('addClass', 'show', 'shown')
|
69
|
+
this.transition('addClass', $.Event('show'), 'shown')
|
58
70
|
this.$element[dimension](this.$element[0][scroll])
|
59
|
-
|
60
71
|
}
|
61
72
|
|
62
73
|
, hide: function () {
|
63
|
-
var dimension
|
74
|
+
var dimension
|
75
|
+
if (this.transitioning) return
|
76
|
+
dimension = this.dimension()
|
64
77
|
this.reset(this.$element[dimension]())
|
65
|
-
this.transition('removeClass', 'hide', 'hidden')
|
78
|
+
this.transition('removeClass', $.Event('hide'), 'hidden')
|
66
79
|
this.$element[dimension](0)
|
67
80
|
}
|
68
81
|
|
69
|
-
, reset: function (
|
82
|
+
, reset: function (size) {
|
70
83
|
var dimension = this.dimension()
|
71
84
|
|
72
85
|
this.$element
|
@@ -74,35 +87,43 @@
|
|
74
87
|
[dimension](size || 'auto')
|
75
88
|
[0].offsetWidth
|
76
89
|
|
77
|
-
this.$element
|
90
|
+
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
|
91
|
+
|
92
|
+
return this
|
78
93
|
}
|
79
94
|
|
80
|
-
, transition: function (
|
95
|
+
, transition: function (method, startEvent, completeEvent) {
|
81
96
|
var that = this
|
82
97
|
, complete = function () {
|
83
|
-
if (startEvent == 'show') that.reset()
|
98
|
+
if (startEvent.type == 'show') that.reset()
|
99
|
+
that.transitioning = 0
|
84
100
|
that.$element.trigger(completeEvent)
|
85
101
|
}
|
86
102
|
|
87
|
-
this.$element
|
88
|
-
|
89
|
-
|
103
|
+
this.$element.trigger(startEvent)
|
104
|
+
|
105
|
+
if (startEvent.isDefaultPrevented()) return
|
106
|
+
|
107
|
+
this.transitioning = 1
|
108
|
+
|
109
|
+
this.$element[method]('in')
|
90
110
|
|
91
111
|
$.support.transition && this.$element.hasClass('collapse') ?
|
92
112
|
this.$element.one($.support.transition.end, complete) :
|
93
113
|
complete()
|
94
|
-
|
114
|
+
}
|
95
115
|
|
96
116
|
, toggle: function () {
|
97
117
|
this[this.$element.hasClass('in') ? 'hide' : 'show']()
|
98
|
-
|
118
|
+
}
|
99
119
|
|
100
120
|
}
|
101
121
|
|
102
|
-
|
122
|
+
|
123
|
+
/* COLLAPSIBLE PLUGIN DEFINITION
|
103
124
|
* ============================== */
|
104
125
|
|
105
|
-
$.fn.collapse = function (
|
126
|
+
$.fn.collapse = function (option) {
|
106
127
|
return this.each(function () {
|
107
128
|
var $this = $(this)
|
108
129
|
, data = $this.data('collapse')
|
@@ -133,4 +154,4 @@
|
|
133
154
|
})
|
134
155
|
})
|
135
156
|
|
136
|
-
}(
|
157
|
+
}(window.jQuery);
|