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