bootstrap_sass_rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +44 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/bootstrap.js +12 -0
- data/app/assets/javascripts/bootstrap/affix.js +126 -0
- data/app/assets/javascripts/bootstrap/alert.js +98 -0
- data/app/assets/javascripts/bootstrap/button.js +109 -0
- data/app/assets/javascripts/bootstrap/carousel.js +217 -0
- data/app/assets/javascripts/bootstrap/collapse.js +179 -0
- data/app/assets/javascripts/bootstrap/dropdown.js +154 -0
- data/app/assets/javascripts/bootstrap/modal.js +246 -0
- data/app/assets/javascripts/bootstrap/popover.js +117 -0
- data/app/assets/javascripts/bootstrap/scrollspy.js +158 -0
- data/app/assets/javascripts/bootstrap/tab.js +135 -0
- data/app/assets/javascripts/bootstrap/tooltip.js +386 -0
- data/app/assets/javascripts/bootstrap/transition.js +56 -0
- data/app/assets/stylesheets/bootstrap.css.sass +59 -0
- data/app/assets/stylesheets/bootstrap/_alerts.css.sass +55 -0
- data/app/assets/stylesheets/bootstrap/_badges.css.sass +50 -0
- data/app/assets/stylesheets/bootstrap/_breadcrumbs.css.sass +19 -0
- data/app/assets/stylesheets/bootstrap/_button-groups.css.sass +210 -0
- data/app/assets/stylesheets/bootstrap/_buttons.css.sass +135 -0
- data/app/assets/stylesheets/bootstrap/_carousel.css.sass +165 -0
- data/app/assets/stylesheets/bootstrap/_close.css.sass +28 -0
- data/app/assets/stylesheets/bootstrap/_code.css.sass +49 -0
- data/app/assets/stylesheets/bootstrap/_component-animations.css.sass +25 -0
- data/app/assets/stylesheets/bootstrap/_dropdowns.css.sass +166 -0
- data/app/assets/stylesheets/bootstrap/_forms.css.sass +309 -0
- data/app/assets/stylesheets/bootstrap/_glyphicons.css.sass +827 -0
- data/app/assets/stylesheets/bootstrap/_grid.css.sass +483 -0
- data/app/assets/stylesheets/bootstrap/_input-groups.css.sass +117 -0
- data/app/assets/stylesheets/bootstrap/_jumbotron.css.sass +28 -0
- data/app/assets/stylesheets/bootstrap/_labels.css.sass +46 -0
- data/app/assets/stylesheets/bootstrap/_list-group.css.sass +71 -0
- data/app/assets/stylesheets/bootstrap/_media.css.sass +47 -0
- data/app/assets/stylesheets/bootstrap/_mixins.css.sass +754 -0
- data/app/assets/stylesheets/bootstrap/_modals.css.sass +127 -0
- data/app/assets/stylesheets/bootstrap/_navbar.css.sass +457 -0
- data/app/assets/stylesheets/bootstrap/_navs.css.sass +171 -0
- data/app/assets/stylesheets/bootstrap/_normalize.css.sass +375 -0
- data/app/assets/stylesheets/bootstrap/_pager.css.sass +39 -0
- data/app/assets/stylesheets/bootstrap/_pagination.css.sass +66 -0
- data/app/assets/stylesheets/bootstrap/_panels.css.sass +114 -0
- data/app/assets/stylesheets/bootstrap/_popovers.css.sass +124 -0
- data/app/assets/stylesheets/bootstrap/_print.css.sass +66 -0
- data/app/assets/stylesheets/bootstrap/_progress-bars.css.sass +90 -0
- data/app/assets/stylesheets/bootstrap/_responsive-utilities.css.sass +152 -0
- data/app/assets/stylesheets/bootstrap/_scaffolding.css.sass +108 -0
- data/app/assets/stylesheets/bootstrap/_tables.css.sass +176 -0
- data/app/assets/stylesheets/bootstrap/_theme.css.sass +228 -0
- data/app/assets/stylesheets/bootstrap/_thumbnails.css.sass +26 -0
- data/app/assets/stylesheets/bootstrap/_tooltip.css.sass +91 -0
- data/app/assets/stylesheets/bootstrap/_type.css.sass +251 -0
- data/app/assets/stylesheets/bootstrap/_utilities.css.sass +36 -0
- data/app/assets/stylesheets/bootstrap/_variables.css.sass +614 -0
- data/app/assets/stylesheets/bootstrap/_wells.css.sass +25 -0
- data/bin/convert-sass.sh +3 -0
- data/bootstrap_sass_rails.gemspec +25 -0
- data/lib/bootstrap_sass_rails.rb +13 -0
- data/lib/bootstrap_sass_rails/engine.rb +4 -0
- data/lib/bootstrap_sass_rails/version.rb +3 -0
- metadata +152 -0
@@ -0,0 +1,246 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: modal.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#modals
|
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
|
+
// 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
|
+
}(window.jQuery);
|
@@ -0,0 +1,117 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: popover.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#popovers
|
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
|
+
// 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
|
+
}(window.jQuery);
|
@@ -0,0 +1,158 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: scrollspy.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#scrollspy
|
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
|
+
// 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')
|
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
|
+
}(window.jQuery);
|