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.
- data/LICENSE +1 -1
- data/README.md +24 -113
- data/app/assets/javascripts/twitter/bootstrap/affix.js +1 -126
- data/app/assets/javascripts/twitter/bootstrap/alert.js +1 -98
- data/app/assets/javascripts/twitter/bootstrap/button.js +1 -109
- data/app/assets/javascripts/twitter/bootstrap/carousel.js +1 -217
- data/app/assets/javascripts/twitter/bootstrap/collapse.js +1 -179
- data/app/assets/javascripts/twitter/bootstrap/dropdown.js +1 -154
- data/app/assets/javascripts/twitter/bootstrap/modal.js +1 -246
- data/app/assets/javascripts/twitter/bootstrap/popover.js +1 -117
- data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +1 -158
- data/app/assets/javascripts/twitter/bootstrap/tab.js +1 -135
- data/app/assets/javascripts/twitter/bootstrap/tooltip.js +1 -386
- data/app/assets/javascripts/twitter/bootstrap/transition.js +1 -56
- data/app/assets/javascripts/twitter/bootstrap.js +1 -12
- data/app/assets/stylesheets/twitter/bootstrap/_alerts.scss +1 -67
- data/app/assets/stylesheets/twitter/bootstrap/_badges.scss +1 -51
- data/app/assets/stylesheets/twitter/bootstrap/_breadcrumbs.scss +1 -23
- data/app/assets/stylesheets/twitter/bootstrap/_button-groups.scss +1 -248
- data/app/assets/stylesheets/twitter/bootstrap/_buttons.scss +1 -160
- data/app/assets/stylesheets/twitter/bootstrap/_carousel.scss +1 -209
- data/app/assets/stylesheets/twitter/bootstrap/_close.scss +1 -33
- data/app/assets/stylesheets/twitter/bootstrap/_code.scss +1 -56
- data/app/assets/stylesheets/twitter/bootstrap/_component-animations.scss +1 -29
- data/app/assets/stylesheets/twitter/bootstrap/_dropdowns.scss +1 -193
- data/app/assets/stylesheets/twitter/bootstrap/_forms.scss +1 -350
- data/app/assets/stylesheets/twitter/bootstrap/_glyphicons.scss +1 -232
- data/app/assets/stylesheets/twitter/bootstrap/_grid.scss +1 -346
- data/app/assets/stylesheets/twitter/bootstrap/_input-groups.scss +1 -127
- data/app/assets/stylesheets/twitter/bootstrap/_jumbotron.scss +1 -40
- data/app/assets/stylesheets/twitter/bootstrap/_labels.scss +1 -58
- data/app/assets/stylesheets/twitter/bootstrap/_list-group.scss +1 -89
- data/app/assets/stylesheets/twitter/bootstrap/_media.scss +1 -56
- data/app/assets/stylesheets/twitter/bootstrap/_mixins.scss +1 -736
- data/app/assets/stylesheets/twitter/bootstrap/_modals.scss +1 -145
- data/app/assets/stylesheets/twitter/bootstrap/_navbar.scss +1 -625
- data/app/assets/stylesheets/twitter/bootstrap/_navs.scss +1 -229
- data/app/assets/stylesheets/twitter/bootstrap/_normalize.scss +1 -396
- data/app/assets/stylesheets/twitter/bootstrap/_pager.scss +1 -55
- data/app/assets/stylesheets/twitter/bootstrap/_pagination.scss +1 -83
- data/app/assets/stylesheets/twitter/bootstrap/_panels.scss +1 -148
- data/app/assets/stylesheets/twitter/bootstrap/_popovers.scss +1 -133
- data/app/assets/stylesheets/twitter/bootstrap/_print.scss +1 -100
- data/app/assets/stylesheets/twitter/bootstrap/_progress-bars.scss +1 -95
- data/app/assets/stylesheets/twitter/bootstrap/_responsive-utilities.scss +1 -209
- data/app/assets/stylesheets/twitter/bootstrap/_scaffolding.scss +1 -130
- data/app/assets/stylesheets/twitter/bootstrap/_tables.scss +1 -236
- data/app/assets/stylesheets/twitter/bootstrap/_theme.scss +1 -232
- data/app/assets/stylesheets/twitter/bootstrap/_thumbnails.scss +1 -31
- data/app/assets/stylesheets/twitter/bootstrap/_tooltip.scss +1 -95
- data/app/assets/stylesheets/twitter/bootstrap/_type.scss +1 -238
- data/app/assets/stylesheets/twitter/bootstrap/_utilities.scss +1 -42
- data/app/assets/stylesheets/twitter/bootstrap/_variables.scss +1 -620
- data/app/assets/stylesheets/twitter/bootstrap/_wells.scss +1 -29
- data/app/assets/stylesheets/twitter/bootstrap.css.scss +1 -59
- data/lib/bootstrap/sass/rails/engine.rb +4 -1
- data/lib/bootstrap/sass/rails/version.rb +2 -1
- data/lib/bootstrap-sass-rails.rb +1 -1
- data/lib/generators/bootstrap/customize_generator.rb +37 -0
- data/lib/generators/bootstrap/templates/USAGE +23 -0
- data/lib/generators/bootstrap/templates/bootstrap-custom.css.scss +18 -0
- data/lib/generators/bootstrap/templates/bootstrap-custom.js +3 -0
- data/test/cases/less_to_sass_spec.rb +1 -1
- data/test/cases/usage_css_spec.rb +0 -3
- metadata +60 -18
- checksums.yaml +0 -15
- data/app/assets/fonts/twitter/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/twitter/bootstrap/glyphicons-halflings-regular.svg +0 -228
- data/app/assets/fonts/twitter/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/twitter/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/lib/bootstrap/sass/extensions/functions.rb +0 -15
- data/lib/bootstrap/sass/extensions.rb +0 -5
@@ -1,217 +1 @@
|
|
1
|
-
|
2
|
-
* Bootstrap: carousel.js v3.0.0
|
3
|
-
* http://twbs.github.com/bootstrap/javascript.html#carousel
|
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
|
-
// CAROUSEL CLASS DEFINITION
|
24
|
-
// =========================
|
25
|
-
|
26
|
-
var Carousel = function (element, options) {
|
27
|
-
this.$element = $(element)
|
28
|
-
this.$indicators = this.$element.find('.carousel-indicators')
|
29
|
-
this.options = options
|
30
|
-
this.paused =
|
31
|
-
this.sliding =
|
32
|
-
this.interval =
|
33
|
-
this.$active =
|
34
|
-
this.$items = null
|
35
|
-
|
36
|
-
this.options.pause == 'hover' && this.$element
|
37
|
-
.on('mouseenter', $.proxy(this.pause, this))
|
38
|
-
.on('mouseleave', $.proxy(this.cycle, this))
|
39
|
-
}
|
40
|
-
|
41
|
-
Carousel.DEFAULTS = {
|
42
|
-
interval: 5000
|
43
|
-
, pause: 'hover'
|
44
|
-
, wrap: true
|
45
|
-
}
|
46
|
-
|
47
|
-
Carousel.prototype.cycle = function (e) {
|
48
|
-
e || (this.paused = false)
|
49
|
-
|
50
|
-
this.interval && clearInterval(this.interval)
|
51
|
-
|
52
|
-
this.options.interval
|
53
|
-
&& !this.paused
|
54
|
-
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
|
55
|
-
|
56
|
-
return this
|
57
|
-
}
|
58
|
-
|
59
|
-
Carousel.prototype.getActiveIndex = function () {
|
60
|
-
this.$active = this.$element.find('.item.active')
|
61
|
-
this.$items = this.$active.parent().children()
|
62
|
-
|
63
|
-
return this.$items.index(this.$active)
|
64
|
-
}
|
65
|
-
|
66
|
-
Carousel.prototype.to = function (pos) {
|
67
|
-
var that = this
|
68
|
-
var activeIndex = this.getActiveIndex()
|
69
|
-
|
70
|
-
if (pos > (this.$items.length - 1) || pos < 0) return
|
71
|
-
|
72
|
-
if (this.sliding) return this.$element.one('slid', function () { that.to(pos) })
|
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.end) {
|
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
|
-
this.sliding = true
|
115
|
-
|
116
|
-
isCycling && this.pause()
|
117
|
-
|
118
|
-
var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
|
119
|
-
|
120
|
-
if ($next.hasClass('active')) return
|
121
|
-
|
122
|
-
if (this.$indicators.length) {
|
123
|
-
this.$indicators.find('.active').removeClass('active')
|
124
|
-
this.$element.one('slid', function () {
|
125
|
-
var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
|
126
|
-
$nextIndicator && $nextIndicator.addClass('active')
|
127
|
-
})
|
128
|
-
}
|
129
|
-
|
130
|
-
if ($.support.transition && this.$element.hasClass('slide')) {
|
131
|
-
this.$element.trigger(e)
|
132
|
-
if (e.isDefaultPrevented()) return
|
133
|
-
$next.addClass(type)
|
134
|
-
$next[0].offsetWidth // force reflow
|
135
|
-
$active.addClass(direction)
|
136
|
-
$next.addClass(direction)
|
137
|
-
$active
|
138
|
-
.one($.support.transition.end, function () {
|
139
|
-
$next.removeClass([type, direction].join(' ')).addClass('active')
|
140
|
-
$active.removeClass(['active', direction].join(' '))
|
141
|
-
that.sliding = false
|
142
|
-
setTimeout(function () { that.$element.trigger('slid') }, 0)
|
143
|
-
})
|
144
|
-
.emulateTransitionEnd(600)
|
145
|
-
} else {
|
146
|
-
this.$element.trigger(e)
|
147
|
-
if (e.isDefaultPrevented()) return
|
148
|
-
$active.removeClass('active')
|
149
|
-
$next.addClass('active')
|
150
|
-
this.sliding = false
|
151
|
-
this.$element.trigger('slid')
|
152
|
-
}
|
153
|
-
|
154
|
-
isCycling && this.cycle()
|
155
|
-
|
156
|
-
return this
|
157
|
-
}
|
158
|
-
|
159
|
-
|
160
|
-
// CAROUSEL PLUGIN DEFINITION
|
161
|
-
// ==========================
|
162
|
-
|
163
|
-
var old = $.fn.carousel
|
164
|
-
|
165
|
-
$.fn.carousel = function (option) {
|
166
|
-
return this.each(function () {
|
167
|
-
var $this = $(this)
|
168
|
-
var data = $this.data('bs.carousel')
|
169
|
-
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
170
|
-
var action = typeof option == 'string' ? option : options.slide
|
171
|
-
|
172
|
-
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
|
173
|
-
if (typeof option == 'number') data.to(option)
|
174
|
-
else if (action) data[action]()
|
175
|
-
else if (options.interval) data.pause().cycle()
|
176
|
-
})
|
177
|
-
}
|
178
|
-
|
179
|
-
$.fn.carousel.Constructor = Carousel
|
180
|
-
|
181
|
-
|
182
|
-
// CAROUSEL NO CONFLICT
|
183
|
-
// ====================
|
184
|
-
|
185
|
-
$.fn.carousel.noConflict = function () {
|
186
|
-
$.fn.carousel = old
|
187
|
-
return this
|
188
|
-
}
|
189
|
-
|
190
|
-
|
191
|
-
// CAROUSEL DATA-API
|
192
|
-
// =================
|
193
|
-
|
194
|
-
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
|
195
|
-
var $this = $(this), href
|
196
|
-
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
197
|
-
var options = $.extend({}, $target.data(), $this.data())
|
198
|
-
var slideIndex = $this.attr('data-slide-to')
|
199
|
-
if (slideIndex) options.interval = false
|
200
|
-
|
201
|
-
$target.carousel(options)
|
202
|
-
|
203
|
-
if (slideIndex = $this.attr('data-slide-to')) {
|
204
|
-
$target.data('bs.carousel').to(slideIndex)
|
205
|
-
}
|
206
|
-
|
207
|
-
e.preventDefault()
|
208
|
-
})
|
209
|
-
|
210
|
-
$(window).on('load', function () {
|
211
|
-
$('[data-ride="carousel"]').each(function () {
|
212
|
-
var $carousel = $(this)
|
213
|
-
$carousel.carousel($carousel.data())
|
214
|
-
})
|
215
|
-
})
|
216
|
-
|
217
|
-
}(window.jQuery);
|
1
|
+
//= require bootstrap/carousel
|
@@ -1,179 +1 @@
|
|
1
|
-
|
2
|
-
* Bootstrap: collapse.js v3.0.0
|
3
|
-
* http://twbs.github.com/bootstrap/javascript.html#collapse
|
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
|
-
// COLLAPSE PUBLIC CLASS DEFINITION
|
24
|
-
// ================================
|
25
|
-
|
26
|
-
var Collapse = function (element, options) {
|
27
|
-
this.$element = $(element)
|
28
|
-
this.options = $.extend({}, Collapse.DEFAULTS, options)
|
29
|
-
this.transitioning = null
|
30
|
-
|
31
|
-
if (this.options.parent) this.$parent = $(this.options.parent)
|
32
|
-
if (this.options.toggle) this.toggle()
|
33
|
-
}
|
34
|
-
|
35
|
-
Collapse.DEFAULTS = {
|
36
|
-
toggle: true
|
37
|
-
}
|
38
|
-
|
39
|
-
Collapse.prototype.dimension = function () {
|
40
|
-
var hasWidth = this.$element.hasClass('width')
|
41
|
-
return hasWidth ? 'width' : 'height'
|
42
|
-
}
|
43
|
-
|
44
|
-
Collapse.prototype.show = function () {
|
45
|
-
if (this.transitioning || this.$element.hasClass('in')) return
|
46
|
-
|
47
|
-
var startEvent = $.Event('show.bs.collapse')
|
48
|
-
this.$element.trigger(startEvent)
|
49
|
-
if (startEvent.isDefaultPrevented()) return
|
50
|
-
|
51
|
-
var actives = this.$parent && this.$parent.find('> .panel > .in')
|
52
|
-
|
53
|
-
if (actives && actives.length) {
|
54
|
-
var hasData = actives.data('bs.collapse')
|
55
|
-
if (hasData && hasData.transitioning) return
|
56
|
-
actives.collapse('hide')
|
57
|
-
hasData || actives.data('bs.collapse', null)
|
58
|
-
}
|
59
|
-
|
60
|
-
var dimension = this.dimension()
|
61
|
-
|
62
|
-
this.$element
|
63
|
-
.removeClass('collapse')
|
64
|
-
.addClass('collapsing')
|
65
|
-
[dimension](0)
|
66
|
-
|
67
|
-
this.transitioning = 1
|
68
|
-
|
69
|
-
var complete = function () {
|
70
|
-
this.$element
|
71
|
-
.removeClass('collapsing')
|
72
|
-
.addClass('in')
|
73
|
-
[dimension]('auto')
|
74
|
-
this.transitioning = 0
|
75
|
-
this.$element.trigger('shown.bs.collapse')
|
76
|
-
}
|
77
|
-
|
78
|
-
if (!$.support.transition) return complete.call(this)
|
79
|
-
|
80
|
-
var scrollSize = $.camelCase(['scroll', dimension].join('-'))
|
81
|
-
|
82
|
-
this.$element
|
83
|
-
.one($.support.transition.end, $.proxy(complete, this))
|
84
|
-
.emulateTransitionEnd(350)
|
85
|
-
[dimension](this.$element[0][scrollSize])
|
86
|
-
}
|
87
|
-
|
88
|
-
Collapse.prototype.hide = function () {
|
89
|
-
if (this.transitioning || !this.$element.hasClass('in')) return
|
90
|
-
|
91
|
-
var startEvent = $.Event('hide.bs.collapse')
|
92
|
-
this.$element.trigger(startEvent)
|
93
|
-
if (startEvent.isDefaultPrevented()) return
|
94
|
-
|
95
|
-
var dimension = this.dimension()
|
96
|
-
|
97
|
-
this.$element
|
98
|
-
[dimension](this.$element[dimension]())
|
99
|
-
[0].offsetHeight
|
100
|
-
|
101
|
-
this.$element
|
102
|
-
.addClass('collapsing')
|
103
|
-
.removeClass('collapse')
|
104
|
-
.removeClass('in')
|
105
|
-
|
106
|
-
this.transitioning = 1
|
107
|
-
|
108
|
-
var complete = function () {
|
109
|
-
this.transitioning = 0
|
110
|
-
this.$element
|
111
|
-
.trigger('hidden.bs.collapse')
|
112
|
-
.removeClass('collapsing')
|
113
|
-
.addClass('collapse')
|
114
|
-
}
|
115
|
-
|
116
|
-
if (!$.support.transition) return complete.call(this)
|
117
|
-
|
118
|
-
this.$element
|
119
|
-
[dimension](0)
|
120
|
-
.one($.support.transition.end, $.proxy(complete, this))
|
121
|
-
.emulateTransitionEnd(350)
|
122
|
-
}
|
123
|
-
|
124
|
-
Collapse.prototype.toggle = function () {
|
125
|
-
this[this.$element.hasClass('in') ? 'hide' : 'show']()
|
126
|
-
}
|
127
|
-
|
128
|
-
|
129
|
-
// COLLAPSE PLUGIN DEFINITION
|
130
|
-
// ==========================
|
131
|
-
|
132
|
-
var old = $.fn.collapse
|
133
|
-
|
134
|
-
$.fn.collapse = function (option) {
|
135
|
-
return this.each(function () {
|
136
|
-
var $this = $(this)
|
137
|
-
var data = $this.data('bs.collapse')
|
138
|
-
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
139
|
-
|
140
|
-
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
|
141
|
-
if (typeof option == 'string') data[option]()
|
142
|
-
})
|
143
|
-
}
|
144
|
-
|
145
|
-
$.fn.collapse.Constructor = Collapse
|
146
|
-
|
147
|
-
|
148
|
-
// COLLAPSE NO CONFLICT
|
149
|
-
// ====================
|
150
|
-
|
151
|
-
$.fn.collapse.noConflict = function () {
|
152
|
-
$.fn.collapse = old
|
153
|
-
return this
|
154
|
-
}
|
155
|
-
|
156
|
-
|
157
|
-
// COLLAPSE DATA-API
|
158
|
-
// =================
|
159
|
-
|
160
|
-
$(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
161
|
-
var $this = $(this), href
|
162
|
-
var target = $this.attr('data-target')
|
163
|
-
|| e.preventDefault()
|
164
|
-
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
|
165
|
-
var $target = $(target)
|
166
|
-
var data = $target.data('bs.collapse')
|
167
|
-
var option = data ? 'toggle' : $this.data()
|
168
|
-
var parent = $this.attr('data-parent')
|
169
|
-
var $parent = parent && $(parent)
|
170
|
-
|
171
|
-
if (!data || !data.transitioning) {
|
172
|
-
if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
|
173
|
-
$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
|
174
|
-
}
|
175
|
-
|
176
|
-
$target.collapse(option)
|
177
|
-
})
|
178
|
-
|
179
|
-
}(window.jQuery);
|
1
|
+
//= require bootstrap/collapse
|
@@ -1,154 +1 @@
|
|
1
|
-
|
2
|
-
* Bootstrap: dropdown.js v3.0.0
|
3
|
-
* http://twbs.github.com/bootstrap/javascript.html#dropdowns
|
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
|
-
// DROPDOWN CLASS DEFINITION
|
24
|
-
// =========================
|
25
|
-
|
26
|
-
var backdrop = '.dropdown-backdrop'
|
27
|
-
var toggle = '[data-toggle=dropdown]'
|
28
|
-
var Dropdown = function (element) {
|
29
|
-
var $el = $(element).on('click.bs.dropdown', this.toggle)
|
30
|
-
}
|
31
|
-
|
32
|
-
Dropdown.prototype.toggle = function (e) {
|
33
|
-
var $this = $(this)
|
34
|
-
|
35
|
-
if ($this.is('.disabled, :disabled')) return
|
36
|
-
|
37
|
-
var $parent = getParent($this)
|
38
|
-
var isActive = $parent.hasClass('open')
|
39
|
-
|
40
|
-
clearMenus()
|
41
|
-
|
42
|
-
if (!isActive) {
|
43
|
-
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
|
44
|
-
// if mobile we we use a backdrop because click events don't delegate
|
45
|
-
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
|
46
|
-
}
|
47
|
-
|
48
|
-
$parent.trigger(e = $.Event('show.bs.dropdown'))
|
49
|
-
|
50
|
-
if (e.isDefaultPrevented()) return
|
51
|
-
|
52
|
-
$parent
|
53
|
-
.toggleClass('open')
|
54
|
-
.trigger('shown.bs.dropdown')
|
55
|
-
|
56
|
-
$this.focus()
|
57
|
-
}
|
58
|
-
|
59
|
-
return false
|
60
|
-
}
|
61
|
-
|
62
|
-
Dropdown.prototype.keydown = function (e) {
|
63
|
-
if (!/(38|40|27)/.test(e.keyCode)) return
|
64
|
-
|
65
|
-
var $this = $(this)
|
66
|
-
|
67
|
-
e.preventDefault()
|
68
|
-
e.stopPropagation()
|
69
|
-
|
70
|
-
if ($this.is('.disabled, :disabled')) return
|
71
|
-
|
72
|
-
var $parent = getParent($this)
|
73
|
-
var isActive = $parent.hasClass('open')
|
74
|
-
|
75
|
-
if (!isActive || (isActive && e.keyCode == 27)) {
|
76
|
-
if (e.which == 27) $parent.find(toggle).focus()
|
77
|
-
return $this.click()
|
78
|
-
}
|
79
|
-
|
80
|
-
var $items = $('[role=menu] li:not(.divider):visible a', $parent)
|
81
|
-
|
82
|
-
if (!$items.length) return
|
83
|
-
|
84
|
-
var index = $items.index($items.filter(':focus'))
|
85
|
-
|
86
|
-
if (e.keyCode == 38 && index > 0) index-- // up
|
87
|
-
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
|
88
|
-
if (!~index) index=0
|
89
|
-
|
90
|
-
$items.eq(index).focus()
|
91
|
-
}
|
92
|
-
|
93
|
-
function clearMenus() {
|
94
|
-
$(backdrop).remove()
|
95
|
-
$(toggle).each(function (e) {
|
96
|
-
var $parent = getParent($(this))
|
97
|
-
if (!$parent.hasClass('open')) return
|
98
|
-
$parent.trigger(e = $.Event('hide.bs.dropdown'))
|
99
|
-
if (e.isDefaultPrevented()) return
|
100
|
-
$parent.removeClass('open').trigger('hidden.bs.dropdown')
|
101
|
-
})
|
102
|
-
}
|
103
|
-
|
104
|
-
function getParent($this) {
|
105
|
-
var selector = $this.attr('data-target')
|
106
|
-
|
107
|
-
if (!selector) {
|
108
|
-
selector = $this.attr('href')
|
109
|
-
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
110
|
-
}
|
111
|
-
|
112
|
-
var $parent = selector && $(selector)
|
113
|
-
|
114
|
-
return $parent && $parent.length ? $parent : $this.parent()
|
115
|
-
}
|
116
|
-
|
117
|
-
|
118
|
-
// DROPDOWN PLUGIN DEFINITION
|
119
|
-
// ==========================
|
120
|
-
|
121
|
-
var old = $.fn.dropdown
|
122
|
-
|
123
|
-
$.fn.dropdown = function (option) {
|
124
|
-
return this.each(function () {
|
125
|
-
var $this = $(this)
|
126
|
-
var data = $this.data('dropdown')
|
127
|
-
|
128
|
-
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
|
129
|
-
if (typeof option == 'string') data[option].call($this)
|
130
|
-
})
|
131
|
-
}
|
132
|
-
|
133
|
-
$.fn.dropdown.Constructor = Dropdown
|
134
|
-
|
135
|
-
|
136
|
-
// DROPDOWN NO CONFLICT
|
137
|
-
// ====================
|
138
|
-
|
139
|
-
$.fn.dropdown.noConflict = function () {
|
140
|
-
$.fn.dropdown = old
|
141
|
-
return this
|
142
|
-
}
|
143
|
-
|
144
|
-
|
145
|
-
// APPLY TO STANDARD DROPDOWN ELEMENTS
|
146
|
-
// ===================================
|
147
|
-
|
148
|
-
$(document)
|
149
|
-
.on('click.bs.dropdown.data-api', clearMenus)
|
150
|
-
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
151
|
-
.on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
152
|
-
.on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
153
|
-
|
154
|
-
}(window.jQuery);
|
1
|
+
//= require bootstrap/dropdown
|