bootstrap_farsi 3.2.0.1

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 (104) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +100 -0
  6. data/Rakefile +2 -0
  7. data/app/assets/fonts/twitter/bootstrap/glyphicons-halflings-regular.eot +0 -0
  8. data/app/assets/fonts/twitter/bootstrap/glyphicons-halflings-regular.svg +229 -0
  9. data/app/assets/fonts/twitter/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  10. data/app/assets/fonts/twitter/bootstrap/glyphicons-halflings-regular.woff +0 -0
  11. data/app/assets/javascripts/twitter/bootstrap.js +6 -0
  12. data/app/assets/javascripts/twitter/bootstrap/.DS_Store +0 -0
  13. data/app/assets/javascripts/twitter/bootstrap/affix.js +142 -0
  14. data/app/assets/javascripts/twitter/bootstrap/alert.js +92 -0
  15. data/app/assets/javascripts/twitter/bootstrap/button.js +110 -0
  16. data/app/assets/javascripts/twitter/bootstrap/carousel.js +223 -0
  17. data/app/assets/javascripts/twitter/bootstrap/collapse.js +170 -0
  18. data/app/assets/javascripts/twitter/bootstrap/dropdown.js +151 -0
  19. data/app/assets/javascripts/twitter/bootstrap/modal.js +280 -0
  20. data/app/assets/javascripts/twitter/bootstrap/popover.js +113 -0
  21. data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +170 -0
  22. data/app/assets/javascripts/twitter/bootstrap/tab.js +128 -0
  23. data/app/assets/javascripts/twitter/bootstrap/tooltip.js +457 -0
  24. data/app/assets/javascripts/twitter/bootstrap/transition.js +59 -0
  25. data/app/frameworks/twitter/bootstrap/alerts.less +68 -0
  26. data/app/frameworks/twitter/bootstrap/badges.less +55 -0
  27. data/app/frameworks/twitter/bootstrap/bi-app/bi-app-ltr.less +12 -0
  28. data/app/frameworks/twitter/bootstrap/bi-app/bi-app-rtl.less +16 -0
  29. data/app/frameworks/twitter/bootstrap/bi-app/mixins.less +326 -0
  30. data/app/frameworks/twitter/bootstrap/bi-app/variables-ltr.less +16 -0
  31. data/app/frameworks/twitter/bootstrap/bi-app/variables-rtl.less +16 -0
  32. data/app/frameworks/twitter/bootstrap/bootstrap.less +53 -0
  33. data/app/frameworks/twitter/bootstrap/breadcrumbs.less +26 -0
  34. data/app/frameworks/twitter/bootstrap/button-groups.less +240 -0
  35. data/app/frameworks/twitter/bootstrap/buttons.less +157 -0
  36. data/app/frameworks/twitter/bootstrap/carousel.less +241 -0
  37. data/app/frameworks/twitter/bootstrap/close.less +33 -0
  38. data/app/frameworks/twitter/bootstrap/code.less +69 -0
  39. data/app/frameworks/twitter/bootstrap/component-animations.less +31 -0
  40. data/app/frameworks/twitter/bootstrap/dropdowns.less +215 -0
  41. data/app/frameworks/twitter/bootstrap/forms.less +540 -0
  42. data/app/frameworks/twitter/bootstrap/glyphicons.less +233 -0
  43. data/app/frameworks/twitter/bootstrap/grid.less +84 -0
  44. data/app/frameworks/twitter/bootstrap/input-groups.less +166 -0
  45. data/app/frameworks/twitter/bootstrap/jumbotron.less +48 -0
  46. data/app/frameworks/twitter/bootstrap/labels.less +64 -0
  47. data/app/frameworks/twitter/bootstrap/list-group.less +131 -0
  48. data/app/frameworks/twitter/bootstrap/media.less +56 -0
  49. data/app/frameworks/twitter/bootstrap/mixins.less +39 -0
  50. data/app/frameworks/twitter/bootstrap/mixins/alerts.less +14 -0
  51. data/app/frameworks/twitter/bootstrap/mixins/background-variant.less +8 -0
  52. data/app/frameworks/twitter/bootstrap/mixins/border-radius.less +10 -0
  53. data/app/frameworks/twitter/bootstrap/mixins/buttons.less +50 -0
  54. data/app/frameworks/twitter/bootstrap/mixins/center-block.less +7 -0
  55. data/app/frameworks/twitter/bootstrap/mixins/clearfix.less +22 -0
  56. data/app/frameworks/twitter/bootstrap/mixins/forms.less +81 -0
  57. data/app/frameworks/twitter/bootstrap/mixins/gradients.less +59 -0
  58. data/app/frameworks/twitter/bootstrap/mixins/grid-framework.less +91 -0
  59. data/app/frameworks/twitter/bootstrap/mixins/grid.less +122 -0
  60. data/app/frameworks/twitter/bootstrap/mixins/hide-text.less +21 -0
  61. data/app/frameworks/twitter/bootstrap/mixins/image.less +34 -0
  62. data/app/frameworks/twitter/bootstrap/mixins/labels.less +12 -0
  63. data/app/frameworks/twitter/bootstrap/mixins/list-group.less +29 -0
  64. data/app/frameworks/twitter/bootstrap/mixins/nav-divider.less +10 -0
  65. data/app/frameworks/twitter/bootstrap/mixins/nav-vertical-align.less +9 -0
  66. data/app/frameworks/twitter/bootstrap/mixins/opacity.less +8 -0
  67. data/app/frameworks/twitter/bootstrap/mixins/pagination.less +23 -0
  68. data/app/frameworks/twitter/bootstrap/mixins/panels.less +24 -0
  69. data/app/frameworks/twitter/bootstrap/mixins/progress-bar.less +10 -0
  70. data/app/frameworks/twitter/bootstrap/mixins/reset-filter.less +8 -0
  71. data/app/frameworks/twitter/bootstrap/mixins/resize.less +6 -0
  72. data/app/frameworks/twitter/bootstrap/mixins/responsive-visibility.less +15 -0
  73. data/app/frameworks/twitter/bootstrap/mixins/size.less +10 -0
  74. data/app/frameworks/twitter/bootstrap/mixins/tab-focus.less +9 -0
  75. data/app/frameworks/twitter/bootstrap/mixins/table-row.less +28 -0
  76. data/app/frameworks/twitter/bootstrap/mixins/text-emphasis.less +8 -0
  77. data/app/frameworks/twitter/bootstrap/mixins/text-overflow.less +8 -0
  78. data/app/frameworks/twitter/bootstrap/mixins/vendor-prefixes.less +224 -0
  79. data/app/frameworks/twitter/bootstrap/modals.less +150 -0
  80. data/app/frameworks/twitter/bootstrap/navbar.less +655 -0
  81. data/app/frameworks/twitter/bootstrap/navs.less +242 -0
  82. data/app/frameworks/twitter/bootstrap/normalize.less +425 -0
  83. data/app/frameworks/twitter/bootstrap/pager.less +55 -0
  84. data/app/frameworks/twitter/bootstrap/pagination.less +88 -0
  85. data/app/frameworks/twitter/bootstrap/panels.less +243 -0
  86. data/app/frameworks/twitter/bootstrap/popovers.less +133 -0
  87. data/app/frameworks/twitter/bootstrap/print.less +101 -0
  88. data/app/frameworks/twitter/bootstrap/progress-bars.less +105 -0
  89. data/app/frameworks/twitter/bootstrap/responsive-embed.less +34 -0
  90. data/app/frameworks/twitter/bootstrap/responsive-utilities.less +194 -0
  91. data/app/frameworks/twitter/bootstrap/scaffolding.less +150 -0
  92. data/app/frameworks/twitter/bootstrap/tables.less +233 -0
  93. data/app/frameworks/twitter/bootstrap/theme.less +258 -0
  94. data/app/frameworks/twitter/bootstrap/thumbnails.less +36 -0
  95. data/app/frameworks/twitter/bootstrap/tooltip.less +95 -0
  96. data/app/frameworks/twitter/bootstrap/type.less +313 -0
  97. data/app/frameworks/twitter/bootstrap/utilities.less +57 -0
  98. data/app/frameworks/twitter/bootstrap/variables.less +846 -0
  99. data/app/frameworks/twitter/bootstrap/wells.less +29 -0
  100. data/bootstrap_farsi.gemspec +27 -0
  101. data/lib/bootstrap_farsi.rb +7 -0
  102. data/lib/bootstrap_farsi/engine.rb +7 -0
  103. data/lib/bootstrap_farsi/version.rb +3 -0
  104. metadata +216 -0
@@ -0,0 +1,92 @@
1
+ /* ========================================================================
2
+ * Bootstrap: alert.js v3.2.0
3
+ * http://getbootstrap.com/javascript/#alerts
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
+ // ALERT CLASS DEFINITION
14
+ // ======================
15
+
16
+ var dismiss = '[data-dismiss="alert"]'
17
+ var Alert = function (el) {
18
+ $(el).on('click', dismiss, this.close)
19
+ }
20
+
21
+ Alert.VERSION = '3.2.0'
22
+
23
+ Alert.prototype.close = function (e) {
24
+ var $this = $(this)
25
+ var selector = $this.attr('data-target')
26
+
27
+ if (!selector) {
28
+ selector = $this.attr('href')
29
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
30
+ }
31
+
32
+ var $parent = $(selector)
33
+
34
+ if (e) e.preventDefault()
35
+
36
+ if (!$parent.length) {
37
+ $parent = $this.hasClass('alert') ? $this : $this.parent()
38
+ }
39
+
40
+ $parent.trigger(e = $.Event('close.bs.alert'))
41
+
42
+ if (e.isDefaultPrevented()) return
43
+
44
+ $parent.removeClass('in')
45
+
46
+ function removeElement() {
47
+ // detach from parent, fire event then clean up data
48
+ $parent.detach().trigger('closed.bs.alert').remove()
49
+ }
50
+
51
+ $.support.transition && $parent.hasClass('fade') ?
52
+ $parent
53
+ .one('bsTransitionEnd', removeElement)
54
+ .emulateTransitionEnd(150) :
55
+ removeElement()
56
+ }
57
+
58
+
59
+ // ALERT PLUGIN DEFINITION
60
+ // =======================
61
+
62
+ function Plugin(option) {
63
+ return this.each(function () {
64
+ var $this = $(this)
65
+ var data = $this.data('bs.alert')
66
+
67
+ if (!data) $this.data('bs.alert', (data = new Alert(this)))
68
+ if (typeof option == 'string') data[option].call($this)
69
+ })
70
+ }
71
+
72
+ var old = $.fn.alert
73
+
74
+ $.fn.alert = Plugin
75
+ $.fn.alert.Constructor = Alert
76
+
77
+
78
+ // ALERT NO CONFLICT
79
+ // =================
80
+
81
+ $.fn.alert.noConflict = function () {
82
+ $.fn.alert = old
83
+ return this
84
+ }
85
+
86
+
87
+ // ALERT DATA-API
88
+ // ==============
89
+
90
+ $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
91
+
92
+ }(jQuery);
@@ -0,0 +1,110 @@
1
+ /* ========================================================================
2
+ * Bootstrap: button.js v3.2.0
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.VERSION = '3.2.0'
23
+
24
+ Button.DEFAULTS = {
25
+ loadingText: 'loading...'
26
+ }
27
+
28
+ Button.prototype.setState = function (state) {
29
+ var d = 'disabled'
30
+ var $el = this.$element
31
+ var val = $el.is('input') ? 'val' : 'html'
32
+ var data = $el.data()
33
+
34
+ state = state + 'Text'
35
+
36
+ if (data.resetText == null) $el.data('resetText', $el[val]())
37
+
38
+ $el[val](data[state] == null ? this.options[state] : data[state])
39
+
40
+ // push to event loop to allow forms to submit
41
+ setTimeout($.proxy(function () {
42
+ if (state == 'loadingText') {
43
+ this.isLoading = true
44
+ $el.addClass(d).attr(d, d)
45
+ } else if (this.isLoading) {
46
+ this.isLoading = false
47
+ $el.removeClass(d).removeAttr(d)
48
+ }
49
+ }, this), 0)
50
+ }
51
+
52
+ Button.prototype.toggle = function () {
53
+ var changed = true
54
+ var $parent = this.$element.closest('[data-toggle="buttons"]')
55
+
56
+ if ($parent.length) {
57
+ var $input = this.$element.find('input')
58
+ if ($input.prop('type') == 'radio') {
59
+ if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
60
+ else $parent.find('.active').removeClass('active')
61
+ }
62
+ if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
63
+ }
64
+
65
+ if (changed) this.$element.toggleClass('active')
66
+ }
67
+
68
+
69
+ // BUTTON PLUGIN DEFINITION
70
+ // ========================
71
+
72
+ function Plugin(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
+ var old = $.fn.button
86
+
87
+ $.fn.button = Plugin
88
+ $.fn.button.Constructor = Button
89
+
90
+
91
+ // BUTTON NO CONFLICT
92
+ // ==================
93
+
94
+ $.fn.button.noConflict = function () {
95
+ $.fn.button = old
96
+ return this
97
+ }
98
+
99
+
100
+ // BUTTON DATA-API
101
+ // ===============
102
+
103
+ $(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
104
+ var $btn = $(e.target)
105
+ if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
106
+ Plugin.call($btn, 'toggle')
107
+ e.preventDefault()
108
+ })
109
+
110
+ }(jQuery);
@@ -0,0 +1,223 @@
1
+ /* ========================================================================
2
+ * Bootstrap: carousel.js v3.2.0
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).on('keydown.bs.carousel', $.proxy(this.keydown, this))
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.bs.carousel', $.proxy(this.pause, this))
28
+ .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
29
+ }
30
+
31
+ Carousel.VERSION = '3.2.0'
32
+
33
+ Carousel.DEFAULTS = {
34
+ interval: 5000,
35
+ pause: 'hover',
36
+ wrap: true
37
+ }
38
+
39
+ Carousel.prototype.keydown = function (e) {
40
+ switch (e.which) {
41
+ case 37: this.prev(); break
42
+ case 39: this.next(); break
43
+ default: return
44
+ }
45
+
46
+ e.preventDefault()
47
+ }
48
+
49
+ Carousel.prototype.cycle = function (e) {
50
+ e || (this.paused = false)
51
+
52
+ this.interval && clearInterval(this.interval)
53
+
54
+ this.options.interval
55
+ && !this.paused
56
+ && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
57
+
58
+ return this
59
+ }
60
+
61
+ Carousel.prototype.getItemIndex = function (item) {
62
+ this.$items = item.parent().children('.item')
63
+ return this.$items.index(item || this.$active)
64
+ }
65
+
66
+ Carousel.prototype.to = function (pos) {
67
+ var that = this
68
+ var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
69
+
70
+ if (pos > (this.$items.length - 1) || pos < 0) return
71
+
72
+ if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
73
+ if (activeIndex == pos) return this.pause().cycle()
74
+
75
+ return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
76
+ }
77
+
78
+ Carousel.prototype.pause = function (e) {
79
+ e || (this.paused = true)
80
+
81
+ if (this.$element.find('.next, .prev').length && $.support.transition) {
82
+ this.$element.trigger($.support.transition.end)
83
+ this.cycle(true)
84
+ }
85
+
86
+ this.interval = clearInterval(this.interval)
87
+
88
+ return this
89
+ }
90
+
91
+ Carousel.prototype.next = function () {
92
+ if (this.sliding) return
93
+ return this.slide('next')
94
+ }
95
+
96
+ Carousel.prototype.prev = function () {
97
+ if (this.sliding) return
98
+ return this.slide('prev')
99
+ }
100
+
101
+ Carousel.prototype.slide = function (type, next) {
102
+ var $active = this.$element.find('.item.active')
103
+ var $next = next || $active[type]()
104
+ var isCycling = this.interval
105
+ var direction = type == 'next' ? 'left' : 'right'
106
+ var fallback = type == 'next' ? 'first' : 'last'
107
+ var that = this
108
+
109
+ if (!$next.length) {
110
+ if (!this.options.wrap) return
111
+ $next = this.$element.find('.item')[fallback]()
112
+ }
113
+
114
+ if ($next.hasClass('active')) return (this.sliding = false)
115
+
116
+ var relatedTarget = $next[0]
117
+ var slideEvent = $.Event('slide.bs.carousel', {
118
+ relatedTarget: relatedTarget,
119
+ direction: direction
120
+ })
121
+ this.$element.trigger(slideEvent)
122
+ if (slideEvent.isDefaultPrevented()) return
123
+
124
+ this.sliding = true
125
+
126
+ isCycling && this.pause()
127
+
128
+ if (this.$indicators.length) {
129
+ this.$indicators.find('.active').removeClass('active')
130
+ var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
131
+ $nextIndicator && $nextIndicator.addClass('active')
132
+ }
133
+
134
+ var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
135
+ if ($.support.transition && this.$element.hasClass('slide')) {
136
+ $next.addClass(type)
137
+ $next[0].offsetWidth // force reflow
138
+ $active.addClass(direction)
139
+ $next.addClass(direction)
140
+ $active
141
+ .one('bsTransitionEnd', function () {
142
+ $next.removeClass([type, direction].join(' ')).addClass('active')
143
+ $active.removeClass(['active', direction].join(' '))
144
+ that.sliding = false
145
+ setTimeout(function () {
146
+ that.$element.trigger(slidEvent)
147
+ }, 0)
148
+ })
149
+ .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
150
+ } else {
151
+ $active.removeClass('active')
152
+ $next.addClass('active')
153
+ this.sliding = false
154
+ this.$element.trigger(slidEvent)
155
+ }
156
+
157
+ isCycling && this.cycle()
158
+
159
+ return this
160
+ }
161
+
162
+
163
+ // CAROUSEL PLUGIN DEFINITION
164
+ // ==========================
165
+
166
+ function Plugin(option) {
167
+ return this.each(function () {
168
+ var $this = $(this)
169
+ var data = $this.data('bs.carousel')
170
+ var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
171
+ var action = typeof option == 'string' ? option : options.slide
172
+
173
+ if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
174
+ if (typeof option == 'number') data.to(option)
175
+ else if (action) data[action]()
176
+ else if (options.interval) data.pause().cycle()
177
+ })
178
+ }
179
+
180
+ var old = $.fn.carousel
181
+
182
+ $.fn.carousel = Plugin
183
+ $.fn.carousel.Constructor = Carousel
184
+
185
+
186
+ // CAROUSEL NO CONFLICT
187
+ // ====================
188
+
189
+ $.fn.carousel.noConflict = function () {
190
+ $.fn.carousel = old
191
+ return this
192
+ }
193
+
194
+
195
+ // CAROUSEL DATA-API
196
+ // =================
197
+
198
+ $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
199
+ var href
200
+ var $this = $(this)
201
+ var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
202
+ if (!$target.hasClass('carousel')) return
203
+ var options = $.extend({}, $target.data(), $this.data())
204
+ var slideIndex = $this.attr('data-slide-to')
205
+ if (slideIndex) options.interval = false
206
+
207
+ Plugin.call($target, options)
208
+
209
+ if (slideIndex) {
210
+ $target.data('bs.carousel').to(slideIndex)
211
+ }
212
+
213
+ e.preventDefault()
214
+ })
215
+
216
+ $(window).on('load', function () {
217
+ $('[data-ride="carousel"]').each(function () {
218
+ var $carousel = $(this)
219
+ Plugin.call($carousel, $carousel.data())
220
+ })
221
+ })
222
+
223
+ }(jQuery);
@@ -0,0 +1,170 @@
1
+ /* ========================================================================
2
+ * Bootstrap: collapse.js v3.2.0
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.VERSION = '3.2.0'
26
+
27
+ Collapse.DEFAULTS = {
28
+ toggle: true
29
+ }
30
+
31
+ Collapse.prototype.dimension = function () {
32
+ var hasWidth = this.$element.hasClass('width')
33
+ return hasWidth ? 'width' : 'height'
34
+ }
35
+
36
+ Collapse.prototype.show = function () {
37
+ if (this.transitioning || this.$element.hasClass('in')) return
38
+
39
+ var startEvent = $.Event('show.bs.collapse')
40
+ this.$element.trigger(startEvent)
41
+ if (startEvent.isDefaultPrevented()) return
42
+
43
+ var actives = this.$parent && this.$parent.find('> .panel > .in')
44
+
45
+ if (actives && actives.length) {
46
+ var hasData = actives.data('bs.collapse')
47
+ if (hasData && hasData.transitioning) return
48
+ Plugin.call(actives, 'hide')
49
+ hasData || actives.data('bs.collapse', null)
50
+ }
51
+
52
+ var dimension = this.dimension()
53
+
54
+ this.$element
55
+ .removeClass('collapse')
56
+ .addClass('collapsing')[dimension](0)
57
+
58
+ this.transitioning = 1
59
+
60
+ var complete = function () {
61
+ this.$element
62
+ .removeClass('collapsing')
63
+ .addClass('collapse in')[dimension]('')
64
+ this.transitioning = 0
65
+ this.$element
66
+ .trigger('shown.bs.collapse')
67
+ }
68
+
69
+ if (!$.support.transition) return complete.call(this)
70
+
71
+ var scrollSize = $.camelCase(['scroll', dimension].join('-'))
72
+
73
+ this.$element
74
+ .one('bsTransitionEnd', $.proxy(complete, this))
75
+ .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
76
+ }
77
+
78
+ Collapse.prototype.hide = function () {
79
+ if (this.transitioning || !this.$element.hasClass('in')) return
80
+
81
+ var startEvent = $.Event('hide.bs.collapse')
82
+ this.$element.trigger(startEvent)
83
+ if (startEvent.isDefaultPrevented()) return
84
+
85
+ var dimension = this.dimension()
86
+
87
+ this.$element[dimension](this.$element[dimension]())[0].offsetHeight
88
+
89
+ this.$element
90
+ .addClass('collapsing')
91
+ .removeClass('collapse')
92
+ .removeClass('in')
93
+
94
+ this.transitioning = 1
95
+
96
+ var complete = function () {
97
+ this.transitioning = 0
98
+ this.$element
99
+ .trigger('hidden.bs.collapse')
100
+ .removeClass('collapsing')
101
+ .addClass('collapse')
102
+ }
103
+
104
+ if (!$.support.transition) return complete.call(this)
105
+
106
+ this.$element
107
+ [dimension](0)
108
+ .one('bsTransitionEnd', $.proxy(complete, this))
109
+ .emulateTransitionEnd(350)
110
+ }
111
+
112
+ Collapse.prototype.toggle = function () {
113
+ this[this.$element.hasClass('in') ? 'hide' : 'show']()
114
+ }
115
+
116
+
117
+ // COLLAPSE PLUGIN DEFINITION
118
+ // ==========================
119
+
120
+ function Plugin(option) {
121
+ return this.each(function () {
122
+ var $this = $(this)
123
+ var data = $this.data('bs.collapse')
124
+ var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
125
+
126
+ if (!data && options.toggle && option == 'show') option = !option
127
+ if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
128
+ if (typeof option == 'string') data[option]()
129
+ })
130
+ }
131
+
132
+ var old = $.fn.collapse
133
+
134
+ $.fn.collapse = Plugin
135
+ $.fn.collapse.Constructor = Collapse
136
+
137
+
138
+ // COLLAPSE NO CONFLICT
139
+ // ====================
140
+
141
+ $.fn.collapse.noConflict = function () {
142
+ $.fn.collapse = old
143
+ return this
144
+ }
145
+
146
+
147
+ // COLLAPSE DATA-API
148
+ // =================
149
+
150
+ $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
151
+ var href
152
+ var $this = $(this)
153
+ var target = $this.attr('data-target')
154
+ || e.preventDefault()
155
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
156
+ var $target = $(target)
157
+ var data = $target.data('bs.collapse')
158
+ var option = data ? 'toggle' : $this.data()
159
+ var parent = $this.attr('data-parent')
160
+ var $parent = parent && $(parent)
161
+
162
+ if (!data || !data.transitioning) {
163
+ if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
164
+ $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
165
+ }
166
+
167
+ Plugin.call($target, option)
168
+ })
169
+
170
+ }(jQuery);