twitter-bootswatch-rails 3.1.1.1 → 3.2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/twitter/bootstrap/affix.js +19 -14
- data/app/assets/javascripts/twitter/bootstrap/alert.js +10 -6
- data/app/assets/javascripts/twitter/bootstrap/button.js +11 -8
- data/app/assets/javascripts/twitter/bootstrap/carousel.js +49 -31
- data/app/assets/javascripts/twitter/bootstrap/collapse.js +22 -22
- data/app/assets/javascripts/twitter/bootstrap/dropdown.js +17 -13
- data/app/assets/javascripts/twitter/bootstrap/modal.js +66 -29
- data/app/assets/javascripts/twitter/bootstrap/popover.js +10 -7
- data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +40 -23
- data/app/assets/javascripts/twitter/bootstrap/tab.js +11 -8
- data/app/assets/javascripts/twitter/bootstrap/tooltip.js +115 -57
- data/app/assets/javascripts/twitter/bootstrap/transition.js +18 -7
- data/lib/generators/bootswatch/install/install_generator.rb +16 -5
- data/lib/generators/bootswatch/install/templates/bootstrap.less +3 -2
- data/lib/generators/bootswatch/install/templates/mixins.less.tt +35 -925
- data/lib/generators/bootswatch/install/templates/variables.less.tt +40 -23
- data/lib/twitter/bootswatch/rails/version.rb +1 -1
- data/vendor/toolkit/twitter/bootstrap/alerts.less +4 -3
- data/vendor/toolkit/twitter/bootstrap/badges.less +18 -18
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +3 -2
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +16 -2
- data/vendor/toolkit/twitter/bootstrap/buttons.less +0 -2
- data/vendor/toolkit/twitter/bootstrap/carousel.less +15 -4
- data/vendor/toolkit/twitter/bootstrap/code.less +6 -1
- data/vendor/toolkit/twitter/bootstrap/component-animations.less +6 -4
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +2 -0
- data/vendor/toolkit/twitter/bootstrap/forms.less +144 -42
- data/vendor/toolkit/twitter/bootstrap/input-groups.less +6 -2
- data/vendor/toolkit/twitter/bootstrap/jumbotron.less +4 -0
- data/vendor/toolkit/twitter/bootstrap/labels.less +1 -1
- data/vendor/toolkit/twitter/bootstrap/list-group.less +22 -1
- data/vendor/toolkit/twitter/bootstrap/mixins.less +35 -925
- data/vendor/toolkit/twitter/bootstrap/mixins/alerts.less +14 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/background-variant.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/border-radius.less +18 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/buttons.less +50 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/center-block.less +7 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/clearfix.less +22 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/forms.less +81 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/gradients.less +59 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/grid-framework.less +91 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/grid.less +122 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/hide-text.less +21 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/image.less +34 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/labels.less +12 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/list-group.less +29 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/nav-divider.less +10 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/nav-vertical-align.less +9 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/opacity.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/pagination.less +23 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/panels.less +24 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/progress-bar.less +10 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/reset-filter.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/resize.less +6 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/responsive-visibility.less +15 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/size.less +10 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/tab-focus.less +9 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/table-row.less +28 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/text-emphasis.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/text-overflow.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/vendor-prefixes.less +224 -0
- data/vendor/toolkit/twitter/bootstrap/modals.less +18 -7
- data/vendor/toolkit/twitter/bootstrap/navbar.less +41 -2
- data/vendor/toolkit/twitter/bootstrap/navs.less +1 -1
- data/vendor/toolkit/twitter/bootstrap/normalize.less +21 -19
- data/vendor/toolkit/twitter/bootstrap/panels.less +8 -6
- data/vendor/toolkit/twitter/bootstrap/popovers.less +1 -1
- data/vendor/toolkit/twitter/bootstrap/progress-bars.less +27 -2
- data/vendor/toolkit/twitter/bootstrap/responsive-embed.less +34 -0
- data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +103 -1
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +17 -1
- data/vendor/toolkit/twitter/bootstrap/tables.less +4 -4
- data/vendor/toolkit/twitter/bootstrap/theme.less +11 -0
- data/vendor/toolkit/twitter/bootstrap/type.less +32 -12
- data/vendor/toolkit/twitter/bootstrap/utilities.less +1 -0
- data/vendor/toolkit/twitter/bootstrap/variables.less +40 -23
- metadata +35 -5
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: dropdown.js v3.
|
2
|
+
* Bootstrap: dropdown.js v3.2.0
|
3
3
|
* http://getbootstrap.com/javascript/#dropdowns
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2011-2014 Twitter, Inc.
|
@@ -14,11 +14,13 @@
|
|
14
14
|
// =========================
|
15
15
|
|
16
16
|
var backdrop = '.dropdown-backdrop'
|
17
|
-
var toggle = '[data-toggle=dropdown]'
|
17
|
+
var toggle = '[data-toggle="dropdown"]'
|
18
18
|
var Dropdown = function (element) {
|
19
19
|
$(element).on('click.bs.dropdown', this.toggle)
|
20
20
|
}
|
21
21
|
|
22
|
+
Dropdown.VERSION = '3.2.0'
|
23
|
+
|
22
24
|
Dropdown.prototype.toggle = function (e) {
|
23
25
|
var $this = $(this)
|
24
26
|
|
@@ -40,11 +42,11 @@
|
|
40
42
|
|
41
43
|
if (e.isDefaultPrevented()) return
|
42
44
|
|
45
|
+
$this.trigger('focus')
|
46
|
+
|
43
47
|
$parent
|
44
48
|
.toggleClass('open')
|
45
49
|
.trigger('shown.bs.dropdown', relatedTarget)
|
46
|
-
|
47
|
-
$this.focus()
|
48
50
|
}
|
49
51
|
|
50
52
|
return false
|
@@ -64,12 +66,12 @@
|
|
64
66
|
var isActive = $parent.hasClass('open')
|
65
67
|
|
66
68
|
if (!isActive || (isActive && e.keyCode == 27)) {
|
67
|
-
if (e.which == 27) $parent.find(toggle).focus
|
68
|
-
return $this.click
|
69
|
+
if (e.which == 27) $parent.find(toggle).trigger('focus')
|
70
|
+
return $this.trigger('click')
|
69
71
|
}
|
70
72
|
|
71
73
|
var desc = ' li:not(.divider):visible a'
|
72
|
-
var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc)
|
74
|
+
var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
|
73
75
|
|
74
76
|
if (!$items.length) return
|
75
77
|
|
@@ -79,10 +81,11 @@
|
|
79
81
|
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
|
80
82
|
if (!~index) index = 0
|
81
83
|
|
82
|
-
$items.eq(index).focus
|
84
|
+
$items.eq(index).trigger('focus')
|
83
85
|
}
|
84
86
|
|
85
87
|
function clearMenus(e) {
|
88
|
+
if (e && e.which === 3) return
|
86
89
|
$(backdrop).remove()
|
87
90
|
$(toggle).each(function () {
|
88
91
|
var $parent = getParent($(this))
|
@@ -99,7 +102,7 @@
|
|
99
102
|
|
100
103
|
if (!selector) {
|
101
104
|
selector = $this.attr('href')
|
102
|
-
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
105
|
+
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
|
103
106
|
}
|
104
107
|
|
105
108
|
var $parent = selector && $(selector)
|
@@ -111,9 +114,7 @@
|
|
111
114
|
// DROPDOWN PLUGIN DEFINITION
|
112
115
|
// ==========================
|
113
116
|
|
114
|
-
|
115
|
-
|
116
|
-
$.fn.dropdown = function (option) {
|
117
|
+
function Plugin(option) {
|
117
118
|
return this.each(function () {
|
118
119
|
var $this = $(this)
|
119
120
|
var data = $this.data('bs.dropdown')
|
@@ -123,6 +124,9 @@
|
|
123
124
|
})
|
124
125
|
}
|
125
126
|
|
127
|
+
var old = $.fn.dropdown
|
128
|
+
|
129
|
+
$.fn.dropdown = Plugin
|
126
130
|
$.fn.dropdown.Constructor = Dropdown
|
127
131
|
|
128
132
|
|
@@ -142,6 +146,6 @@
|
|
142
146
|
.on('click.bs.dropdown.data-api', clearMenus)
|
143
147
|
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
144
148
|
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
|
145
|
-
.on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown)
|
149
|
+
.on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown)
|
146
150
|
|
147
151
|
}(jQuery);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: modal.js v3.
|
2
|
+
* Bootstrap: modal.js v3.2.0
|
3
3
|
* http://getbootstrap.com/javascript/#modals
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2011-2014 Twitter, Inc.
|
@@ -14,10 +14,12 @@
|
|
14
14
|
// ======================
|
15
15
|
|
16
16
|
var Modal = function (element, options) {
|
17
|
-
this.options
|
18
|
-
this.$
|
19
|
-
this.$
|
20
|
-
this
|
17
|
+
this.options = options
|
18
|
+
this.$body = $(document.body)
|
19
|
+
this.$element = $(element)
|
20
|
+
this.$backdrop =
|
21
|
+
this.isShown = null
|
22
|
+
this.scrollbarWidth = 0
|
21
23
|
|
22
24
|
if (this.options.remote) {
|
23
25
|
this.$element
|
@@ -28,6 +30,8 @@
|
|
28
30
|
}
|
29
31
|
}
|
30
32
|
|
33
|
+
Modal.VERSION = '3.2.0'
|
34
|
+
|
31
35
|
Modal.DEFAULTS = {
|
32
36
|
backdrop: true,
|
33
37
|
keyboard: true,
|
@@ -35,7 +39,7 @@
|
|
35
39
|
}
|
36
40
|
|
37
41
|
Modal.prototype.toggle = function (_relatedTarget) {
|
38
|
-
return this
|
42
|
+
return this.isShown ? this.hide() : this.show(_relatedTarget)
|
39
43
|
}
|
40
44
|
|
41
45
|
Modal.prototype.show = function (_relatedTarget) {
|
@@ -48,6 +52,10 @@
|
|
48
52
|
|
49
53
|
this.isShown = true
|
50
54
|
|
55
|
+
this.checkScrollbar()
|
56
|
+
this.$body.addClass('modal-open')
|
57
|
+
|
58
|
+
this.setScrollbar()
|
51
59
|
this.escape()
|
52
60
|
|
53
61
|
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
|
@@ -56,7 +64,7 @@
|
|
56
64
|
var transition = $.support.transition && that.$element.hasClass('fade')
|
57
65
|
|
58
66
|
if (!that.$element.parent().length) {
|
59
|
-
that.$element.appendTo(
|
67
|
+
that.$element.appendTo(that.$body) // don't move modals dom position
|
60
68
|
}
|
61
69
|
|
62
70
|
that.$element
|
@@ -77,11 +85,11 @@
|
|
77
85
|
|
78
86
|
transition ?
|
79
87
|
that.$element.find('.modal-dialog') // wait for modal to slide in
|
80
|
-
.one(
|
81
|
-
that.$element.focus
|
88
|
+
.one('bsTransitionEnd', function () {
|
89
|
+
that.$element.trigger('focus').trigger(e)
|
82
90
|
})
|
83
91
|
.emulateTransitionEnd(300) :
|
84
|
-
that.$element.focus
|
92
|
+
that.$element.trigger('focus').trigger(e)
|
85
93
|
})
|
86
94
|
}
|
87
95
|
|
@@ -96,6 +104,9 @@
|
|
96
104
|
|
97
105
|
this.isShown = false
|
98
106
|
|
107
|
+
this.$body.removeClass('modal-open')
|
108
|
+
|
109
|
+
this.resetScrollbar()
|
99
110
|
this.escape()
|
100
111
|
|
101
112
|
$(document).off('focusin.bs.modal')
|
@@ -107,7 +118,7 @@
|
|
107
118
|
|
108
119
|
$.support.transition && this.$element.hasClass('fade') ?
|
109
120
|
this.$element
|
110
|
-
.one(
|
121
|
+
.one('bsTransitionEnd', $.proxy(this.hideModal, this))
|
111
122
|
.emulateTransitionEnd(300) :
|
112
123
|
this.hideModal()
|
113
124
|
}
|
@@ -117,7 +128,7 @@
|
|
117
128
|
.off('focusin.bs.modal') // guard against infinite focus loop
|
118
129
|
.on('focusin.bs.modal', $.proxy(function (e) {
|
119
130
|
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
|
120
|
-
this.$element.focus
|
131
|
+
this.$element.trigger('focus')
|
121
132
|
}
|
122
133
|
}, this))
|
123
134
|
}
|
@@ -136,7 +147,6 @@
|
|
136
147
|
var that = this
|
137
148
|
this.$element.hide()
|
138
149
|
this.backdrop(function () {
|
139
|
-
that.removeBackdrop()
|
140
150
|
that.$element.trigger('hidden.bs.modal')
|
141
151
|
})
|
142
152
|
}
|
@@ -147,13 +157,14 @@
|
|
147
157
|
}
|
148
158
|
|
149
159
|
Modal.prototype.backdrop = function (callback) {
|
160
|
+
var that = this
|
150
161
|
var animate = this.$element.hasClass('fade') ? 'fade' : ''
|
151
162
|
|
152
163
|
if (this.isShown && this.options.backdrop) {
|
153
164
|
var doAnimate = $.support.transition && animate
|
154
165
|
|
155
166
|
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
156
|
-
.appendTo(
|
167
|
+
.appendTo(this.$body)
|
157
168
|
|
158
169
|
this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
|
159
170
|
if (e.target !== e.currentTarget) return
|
@@ -170,31 +181,56 @@
|
|
170
181
|
|
171
182
|
doAnimate ?
|
172
183
|
this.$backdrop
|
173
|
-
.one(
|
184
|
+
.one('bsTransitionEnd', callback)
|
174
185
|
.emulateTransitionEnd(150) :
|
175
186
|
callback()
|
176
187
|
|
177
188
|
} else if (!this.isShown && this.$backdrop) {
|
178
189
|
this.$backdrop.removeClass('in')
|
179
190
|
|
191
|
+
var callbackRemove = function () {
|
192
|
+
that.removeBackdrop()
|
193
|
+
callback && callback()
|
194
|
+
}
|
180
195
|
$.support.transition && this.$element.hasClass('fade') ?
|
181
196
|
this.$backdrop
|
182
|
-
.one(
|
197
|
+
.one('bsTransitionEnd', callbackRemove)
|
183
198
|
.emulateTransitionEnd(150) :
|
184
|
-
|
199
|
+
callbackRemove()
|
185
200
|
|
186
201
|
} else if (callback) {
|
187
202
|
callback()
|
188
203
|
}
|
189
204
|
}
|
190
205
|
|
206
|
+
Modal.prototype.checkScrollbar = function () {
|
207
|
+
if (document.body.clientWidth >= window.innerWidth) return
|
208
|
+
this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
|
209
|
+
}
|
210
|
+
|
211
|
+
Modal.prototype.setScrollbar = function () {
|
212
|
+
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
|
213
|
+
if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
|
214
|
+
}
|
215
|
+
|
216
|
+
Modal.prototype.resetScrollbar = function () {
|
217
|
+
this.$body.css('padding-right', '')
|
218
|
+
}
|
219
|
+
|
220
|
+
Modal.prototype.measureScrollbar = function () { // thx walsh
|
221
|
+
var scrollDiv = document.createElement('div')
|
222
|
+
scrollDiv.className = 'modal-scrollbar-measure'
|
223
|
+
this.$body.append(scrollDiv)
|
224
|
+
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
|
225
|
+
this.$body[0].removeChild(scrollDiv)
|
226
|
+
return scrollbarWidth
|
227
|
+
}
|
228
|
+
|
191
229
|
|
192
230
|
// MODAL PLUGIN DEFINITION
|
193
231
|
// =======================
|
194
232
|
|
195
|
-
|
196
|
-
|
197
|
-
$.fn.modal = function (option, _relatedTarget) {
|
233
|
+
function Plugin(option, _relatedTarget) {
|
198
234
|
return this.each(function () {
|
199
235
|
var $this = $(this)
|
200
236
|
var data = $this.data('bs.modal')
|
@@ -206,6 +242,9 @@
|
|
206
242
|
})
|
207
243
|
}
|
208
244
|
|
245
|
+
var old = $.fn.modal
|
246
|
+
|
247
|
+
$.fn.modal = Plugin
|
209
248
|
$.fn.modal.Constructor = Modal
|
210
249
|
|
211
250
|
|
@@ -224,20 +263,18 @@
|
|
224
263
|
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
|
225
264
|
var $this = $(this)
|
226
265
|
var href = $this.attr('href')
|
227
|
-
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
|
266
|
+
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
|
228
267
|
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
|
229
268
|
|
230
269
|
if ($this.is('a')) e.preventDefault()
|
231
270
|
|
232
|
-
$target
|
233
|
-
.
|
234
|
-
.one('
|
235
|
-
$this.is(':visible') && $this.focus
|
271
|
+
$target.one('show.bs.modal', function (showEvent) {
|
272
|
+
if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
|
273
|
+
$target.one('hidden.bs.modal', function () {
|
274
|
+
$this.is(':visible') && $this.trigger('focus')
|
236
275
|
})
|
276
|
+
})
|
277
|
+
Plugin.call($target, option, this)
|
237
278
|
})
|
238
279
|
|
239
|
-
$(document)
|
240
|
-
.on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
|
241
|
-
.on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
|
242
|
-
|
243
280
|
}(jQuery);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: popover.js v3.
|
2
|
+
* Bootstrap: popover.js v3.2.0
|
3
3
|
* http://getbootstrap.com/javascript/#popovers
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2011-2014 Twitter, Inc.
|
@@ -19,11 +19,13 @@
|
|
19
19
|
|
20
20
|
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
|
21
21
|
|
22
|
+
Popover.VERSION = '3.2.0'
|
23
|
+
|
22
24
|
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
|
23
25
|
placement: 'right',
|
24
26
|
trigger: 'click',
|
25
27
|
content: '',
|
26
|
-
template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
|
28
|
+
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
|
27
29
|
})
|
28
30
|
|
29
31
|
|
@@ -44,7 +46,7 @@
|
|
44
46
|
var content = this.getContent()
|
45
47
|
|
46
48
|
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
|
47
|
-
$tip.find('.popover-content')[ // we use append for html objects to maintain js events
|
49
|
+
$tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events
|
48
50
|
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
|
49
51
|
](content)
|
50
52
|
|
@@ -70,7 +72,7 @@
|
|
70
72
|
}
|
71
73
|
|
72
74
|
Popover.prototype.arrow = function () {
|
73
|
-
return this.$arrow = this.$arrow || this.tip().find('.arrow')
|
75
|
+
return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
|
74
76
|
}
|
75
77
|
|
76
78
|
Popover.prototype.tip = function () {
|
@@ -82,9 +84,7 @@
|
|
82
84
|
// POPOVER PLUGIN DEFINITION
|
83
85
|
// =========================
|
84
86
|
|
85
|
-
|
86
|
-
|
87
|
-
$.fn.popover = function (option) {
|
87
|
+
function Plugin(option) {
|
88
88
|
return this.each(function () {
|
89
89
|
var $this = $(this)
|
90
90
|
var data = $this.data('bs.popover')
|
@@ -96,6 +96,9 @@
|
|
96
96
|
})
|
97
97
|
}
|
98
98
|
|
99
|
+
var old = $.fn.popover
|
100
|
+
|
101
|
+
$.fn.popover = Plugin
|
99
102
|
$.fn.popover.Constructor = Popover
|
100
103
|
|
101
104
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: scrollspy.js v3.
|
2
|
+
* Bootstrap: scrollspy.js v3.2.0
|
3
3
|
* http://getbootstrap.com/javascript/#scrollspy
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2011-2014 Twitter, Inc.
|
@@ -14,36 +14,48 @@
|
|
14
14
|
// ==========================
|
15
15
|
|
16
16
|
function ScrollSpy(element, options) {
|
17
|
-
var href
|
18
17
|
var process = $.proxy(this.process, this)
|
19
18
|
|
20
|
-
this.$element = $(element).is('body') ? $(window) : $(element)
|
21
19
|
this.$body = $('body')
|
22
|
-
this.$scrollElement =
|
20
|
+
this.$scrollElement = $(element).is('body') ? $(window) : $(element)
|
23
21
|
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
|
24
|
-
this.selector = (this.options.target
|
25
|
-
|
26
|
-
|
27
|
-
this.offsets = $([])
|
28
|
-
this.targets = $([])
|
22
|
+
this.selector = (this.options.target || '') + ' .nav li > a'
|
23
|
+
this.offsets = []
|
24
|
+
this.targets = []
|
29
25
|
this.activeTarget = null
|
26
|
+
this.scrollHeight = 0
|
30
27
|
|
28
|
+
this.$scrollElement.on('scroll.bs.scrollspy', process)
|
31
29
|
this.refresh()
|
32
30
|
this.process()
|
33
31
|
}
|
34
32
|
|
33
|
+
ScrollSpy.VERSION = '3.2.0'
|
34
|
+
|
35
35
|
ScrollSpy.DEFAULTS = {
|
36
36
|
offset: 10
|
37
37
|
}
|
38
38
|
|
39
|
+
ScrollSpy.prototype.getScrollHeight = function () {
|
40
|
+
return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
|
41
|
+
}
|
42
|
+
|
39
43
|
ScrollSpy.prototype.refresh = function () {
|
40
|
-
var offsetMethod =
|
44
|
+
var offsetMethod = 'offset'
|
45
|
+
var offsetBase = 0
|
41
46
|
|
42
|
-
|
43
|
-
|
47
|
+
if (!$.isWindow(this.$scrollElement[0])) {
|
48
|
+
offsetMethod = 'position'
|
49
|
+
offsetBase = this.$scrollElement.scrollTop()
|
50
|
+
}
|
51
|
+
|
52
|
+
this.offsets = []
|
53
|
+
this.targets = []
|
54
|
+
this.scrollHeight = this.getScrollHeight()
|
44
55
|
|
45
56
|
var self = this
|
46
|
-
|
57
|
+
|
58
|
+
this.$body
|
47
59
|
.find(this.selector)
|
48
60
|
.map(function () {
|
49
61
|
var $el = $(this)
|
@@ -53,7 +65,7 @@
|
|
53
65
|
return ($href
|
54
66
|
&& $href.length
|
55
67
|
&& $href.is(':visible')
|
56
|
-
&& [[
|
68
|
+
&& [[$href[offsetMethod]().top + offsetBase, href]]) || null
|
57
69
|
})
|
58
70
|
.sort(function (a, b) { return a[0] - b[0] })
|
59
71
|
.each(function () {
|
@@ -64,15 +76,19 @@
|
|
64
76
|
|
65
77
|
ScrollSpy.prototype.process = function () {
|
66
78
|
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
67
|
-
var scrollHeight = this
|
68
|
-
var maxScroll = scrollHeight - this.$scrollElement.height()
|
79
|
+
var scrollHeight = this.getScrollHeight()
|
80
|
+
var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
|
69
81
|
var offsets = this.offsets
|
70
82
|
var targets = this.targets
|
71
83
|
var activeTarget = this.activeTarget
|
72
84
|
var i
|
73
85
|
|
86
|
+
if (this.scrollHeight != scrollHeight) {
|
87
|
+
this.refresh()
|
88
|
+
}
|
89
|
+
|
74
90
|
if (scrollTop >= maxScroll) {
|
75
|
-
return activeTarget != (i = targets.
|
91
|
+
return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
|
76
92
|
}
|
77
93
|
|
78
94
|
if (activeTarget && scrollTop <= offsets[0]) {
|
@@ -83,7 +99,7 @@
|
|
83
99
|
activeTarget != targets[i]
|
84
100
|
&& scrollTop >= offsets[i]
|
85
101
|
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
|
86
|
-
&& this.activate(
|
102
|
+
&& this.activate(targets[i])
|
87
103
|
}
|
88
104
|
}
|
89
105
|
|
@@ -115,9 +131,7 @@
|
|
115
131
|
// SCROLLSPY PLUGIN DEFINITION
|
116
132
|
// ===========================
|
117
133
|
|
118
|
-
|
119
|
-
|
120
|
-
$.fn.scrollspy = function (option) {
|
134
|
+
function Plugin(option) {
|
121
135
|
return this.each(function () {
|
122
136
|
var $this = $(this)
|
123
137
|
var data = $this.data('bs.scrollspy')
|
@@ -128,6 +142,9 @@
|
|
128
142
|
})
|
129
143
|
}
|
130
144
|
|
145
|
+
var old = $.fn.scrollspy
|
146
|
+
|
147
|
+
$.fn.scrollspy = Plugin
|
131
148
|
$.fn.scrollspy.Constructor = ScrollSpy
|
132
149
|
|
133
150
|
|
@@ -143,10 +160,10 @@
|
|
143
160
|
// SCROLLSPY DATA-API
|
144
161
|
// ==================
|
145
162
|
|
146
|
-
$(window).on('load', function () {
|
163
|
+
$(window).on('load.bs.scrollspy.data-api', function () {
|
147
164
|
$('[data-spy="scroll"]').each(function () {
|
148
165
|
var $spy = $(this)
|
149
|
-
|
166
|
+
Plugin.call($spy, $spy.data())
|
150
167
|
})
|
151
168
|
})
|
152
169
|
|