Skip to content

Commit 3cb3353

Browse files
committed
Merge remote-tracking branch 'upstream/pr/2059'
2 parents 312e53d + 0fc5434 commit 3cb3353

File tree

114 files changed

+9973
-6556
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+9973
-6556
lines changed
+99-74
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,142 @@
1-
/* ==========================================================
2-
* bootstrap-affix.js v2.3.2
3-
* http://getbootstrap.com/2.3.2/javascript.html#affix
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 ($) {
22-
23-
"use strict"; // jshint ;_;
24-
25-
26-
/* AFFIX CLASS DEFINITION
27-
* ====================== */
1+
/* ========================================================================
2+
* Bootstrap: affix.js v3.2.0
3+
* http://getbootstrap.com/javascript/#affix
4+
* ========================================================================
5+
* Copyright 2011-2014 Twitter, Inc.
6+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7+
* ======================================================================== */
8+
9+
10+
+function ($) {
11+
'use strict';
12+
13+
// AFFIX CLASS DEFINITION
14+
// ======================
2815

2916
var Affix = function (element, options) {
30-
this.options = $.extend({}, $.fn.affix.defaults, options)
31-
this.$window = $(window)
32-
.on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
33-
.on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
34-
this.$element = $(element)
17+
this.options = $.extend({}, Affix.DEFAULTS, options)
18+
19+
this.$target = $(this.options.target)
20+
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
21+
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
22+
23+
this.$element = $(element)
24+
this.affixed =
25+
this.unpin =
26+
this.pinnedOffset = null
27+
3528
this.checkPosition()
3629
}
3730

31+
Affix.VERSION = '3.2.0'
32+
33+
Affix.RESET = 'affix affix-top affix-bottom'
34+
35+
Affix.DEFAULTS = {
36+
offset: 0,
37+
target: window
38+
}
39+
40+
Affix.prototype.getPinnedOffset = function () {
41+
if (this.pinnedOffset) return this.pinnedOffset
42+
this.$element.removeClass(Affix.RESET).addClass('affix')
43+
var scrollTop = this.$target.scrollTop()
44+
var position = this.$element.offset()
45+
return (this.pinnedOffset = position.top - scrollTop)
46+
}
47+
48+
Affix.prototype.checkPositionWithEventLoop = function () {
49+
setTimeout($.proxy(this.checkPosition, this), 1)
50+
}
51+
3852
Affix.prototype.checkPosition = function () {
3953
if (!this.$element.is(':visible')) return
4054

4155
var scrollHeight = $(document).height()
42-
, scrollTop = this.$window.scrollTop()
43-
, position = this.$element.offset()
44-
, offset = this.options.offset
45-
, offsetBottom = offset.bottom
46-
, offsetTop = offset.top
47-
, reset = 'affix affix-top affix-bottom'
48-
, affix
49-
50-
if (typeof offset != 'object') offsetBottom = offsetTop = offset
51-
if (typeof offsetTop == 'function') offsetTop = offset.top()
52-
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
53-
54-
affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
55-
false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
56-
'bottom' : offsetTop != null && scrollTop <= offsetTop ?
57-
'top' : false
56+
var scrollTop = this.$target.scrollTop()
57+
var position = this.$element.offset()
58+
var offset = this.options.offset
59+
var offsetTop = offset.top
60+
var offsetBottom = offset.bottom
61+
62+
if (typeof offset != 'object') offsetBottom = offsetTop = offset
63+
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
64+
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
65+
66+
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
67+
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
68+
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
5869

5970
if (this.affixed === affix) return
71+
if (this.unpin != null) this.$element.css('top', '')
6072

61-
this.affixed = affix
62-
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
73+
var affixType = 'affix' + (affix ? '-' + affix : '')
74+
var e = $.Event(affixType + '.bs.affix')
6375

64-
this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
65-
}
76+
this.$element.trigger(e)
6677

78+
if (e.isDefaultPrevented()) return
6779

68-
/* AFFIX PLUGIN DEFINITION
69-
* ======================= */
80+
this.affixed = affix
81+
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
82+
83+
this.$element
84+
.removeClass(Affix.RESET)
85+
.addClass(affixType)
86+
.trigger($.Event(affixType.replace('affix', 'affixed')))
87+
88+
if (affix == 'bottom') {
89+
this.$element.offset({
90+
top: scrollHeight - this.$element.height() - offsetBottom
91+
})
92+
}
93+
}
7094

71-
var old = $.fn.affix
7295

73-
$.fn.affix = function (option) {
96+
// AFFIX PLUGIN DEFINITION
97+
// =======================
98+
99+
function Plugin(option) {
74100
return this.each(function () {
75-
var $this = $(this)
76-
, data = $this.data('affix')
77-
, options = typeof option == 'object' && option
78-
if (!data) $this.data('affix', (data = new Affix(this, options)))
101+
var $this = $(this)
102+
var data = $this.data('bs.affix')
103+
var options = typeof option == 'object' && option
104+
105+
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
79106
if (typeof option == 'string') data[option]()
80107
})
81108
}
82109

83-
$.fn.affix.Constructor = Affix
110+
var old = $.fn.affix
84111

85-
$.fn.affix.defaults = {
86-
offset: 0
87-
}
112+
$.fn.affix = Plugin
113+
$.fn.affix.Constructor = Affix
88114

89115

90-
/* AFFIX NO CONFLICT
91-
* ================= */
116+
// AFFIX NO CONFLICT
117+
// =================
92118

93119
$.fn.affix.noConflict = function () {
94120
$.fn.affix = old
95121
return this
96122
}
97123

98124

99-
/* AFFIX DATA-API
100-
* ============== */
125+
// AFFIX DATA-API
126+
// ==============
101127

102128
$(window).on('load', function () {
103129
$('[data-spy="affix"]').each(function () {
104130
var $spy = $(this)
105-
, data = $spy.data()
131+
var data = $spy.data()
106132

107133
data.offset = data.offset || {}
108134

109-
data.offsetBottom && (data.offset.bottom = data.offsetBottom)
110-
data.offsetTop && (data.offset.top = data.offsetTop)
135+
if (data.offsetBottom) data.offset.bottom = data.offsetBottom
136+
if (data.offsetTop) data.offset.top = data.offsetTop
111137

112-
$spy.affix(data)
138+
Plugin.call($spy, data)
113139
})
114140
})
115141

116-
117-
}(window.jQuery);
142+
}(jQuery);
+48-55
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,92 @@
1-
/* ==========================================================
2-
* bootstrap-alert.js v2.3.2
3-
* http://getbootstrap.com/2.3.2/javascript.html#alerts
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 ($) {
22-
23-
"use strict"; // jshint ;_;
24-
25-
26-
/* ALERT CLASS DEFINITION
27-
* ====================== */
1+
/* ========================================================================
2+
* Bootstrap: alert.js v3.2.0
3+
* http://getbootstrap.com/javascript/#alerts
4+
* ========================================================================
5+
* Copyright 2011-2014 Twitter, Inc.
6+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7+
* ======================================================================== */
8+
9+
10+
+function ($) {
11+
'use strict';
12+
13+
// ALERT CLASS DEFINITION
14+
// ======================
2815

2916
var dismiss = '[data-dismiss="alert"]'
30-
, Alert = function (el) {
31-
$(el).on('click', dismiss, this.close)
32-
}
17+
var Alert = function (el) {
18+
$(el).on('click', dismiss, this.close)
19+
}
20+
21+
Alert.VERSION = '3.2.0'
3322

3423
Alert.prototype.close = function (e) {
35-
var $this = $(this)
36-
, selector = $this.attr('data-target')
37-
, $parent
24+
var $this = $(this)
25+
var selector = $this.attr('data-target')
3826

3927
if (!selector) {
4028
selector = $this.attr('href')
41-
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
29+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
4230
}
4331

44-
$parent = $(selector)
32+
var $parent = $(selector)
4533

46-
e && e.preventDefault()
34+
if (e) e.preventDefault()
4735

48-
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
36+
if (!$parent.length) {
37+
$parent = $this.hasClass('alert') ? $this : $this.parent()
38+
}
4939

50-
$parent.trigger(e = $.Event('close'))
40+
$parent.trigger(e = $.Event('close.bs.alert'))
5141

5242
if (e.isDefaultPrevented()) return
5343

5444
$parent.removeClass('in')
5545

5646
function removeElement() {
57-
$parent
58-
.trigger('closed')
59-
.remove()
47+
// detach from parent, fire event then clean up data
48+
$parent.detach().trigger('closed.bs.alert').remove()
6049
}
6150

6251
$.support.transition && $parent.hasClass('fade') ?
63-
$parent.on($.support.transition.end, removeElement) :
52+
$parent
53+
.one('bsTransitionEnd', removeElement)
54+
.emulateTransitionEnd(150) :
6455
removeElement()
6556
}
6657

6758

68-
/* ALERT PLUGIN DEFINITION
69-
* ======================= */
70-
71-
var old = $.fn.alert
59+
// ALERT PLUGIN DEFINITION
60+
// =======================
7261

73-
$.fn.alert = function (option) {
62+
function Plugin(option) {
7463
return this.each(function () {
7564
var $this = $(this)
76-
, data = $this.data('alert')
77-
if (!data) $this.data('alert', (data = new Alert(this)))
65+
var data = $this.data('bs.alert')
66+
67+
if (!data) $this.data('bs.alert', (data = new Alert(this)))
7868
if (typeof option == 'string') data[option].call($this)
7969
})
8070
}
8171

72+
var old = $.fn.alert
73+
74+
$.fn.alert = Plugin
8275
$.fn.alert.Constructor = Alert
8376

8477

85-
/* ALERT NO CONFLICT
86-
* ================= */
78+
// ALERT NO CONFLICT
79+
// =================
8780

8881
$.fn.alert.noConflict = function () {
8982
$.fn.alert = old
9083
return this
9184
}
9285

9386

94-
/* ALERT DATA-API
95-
* ============== */
87+
// ALERT DATA-API
88+
// ==============
9689

97-
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
90+
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
9891

99-
}(window.jQuery);
92+
}(jQuery);

0 commit comments

Comments
 (0)