bootstrap 4.0.0.alpha4 → 4.0.0.alpha5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bootstrap might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/assets/javascripts/bootstrap.js +1625 -1768
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/javascripts/bootstrap/alert.js +83 -96
- data/assets/javascripts/bootstrap/button.js +61 -68
- data/assets/javascripts/bootstrap/carousel.js +250 -270
- data/assets/javascripts/bootstrap/collapse.js +176 -190
- data/assets/javascripts/bootstrap/dropdown.js +143 -155
- data/assets/javascripts/bootstrap/modal.js +286 -310
- data/assets/javascripts/bootstrap/popover.js +61 -69
- data/assets/javascripts/bootstrap/scrollspy.js +145 -157
- data/assets/javascripts/bootstrap/tab.js +122 -132
- data/assets/javascripts/bootstrap/tooltip.js +313 -341
- data/assets/javascripts/bootstrap/util.js +9 -16
- data/assets/stylesheets/_bootstrap.scss +1 -1
- data/assets/stylesheets/bootstrap/_alert.scss +3 -3
- data/assets/stylesheets/bootstrap/_animation.scss +12 -3
- data/assets/stylesheets/bootstrap/_button-group.scss +1 -0
- data/assets/stylesheets/bootstrap/_card.scss +3 -1
- data/assets/stylesheets/bootstrap/_custom-forms.scss +7 -10
- data/assets/stylesheets/bootstrap/_dropdown.scss +1 -0
- data/assets/stylesheets/bootstrap/_forms.scss +16 -6
- data/assets/stylesheets/bootstrap/_images.scss +2 -11
- data/assets/stylesheets/bootstrap/_list-group.scss +2 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +1 -1
- data/assets/stylesheets/bootstrap/_modal.scss +4 -2
- data/assets/stylesheets/bootstrap/_navbar.scss +72 -13
- data/assets/stylesheets/bootstrap/_normalize.scss +51 -53
- data/assets/stylesheets/bootstrap/_popover.scss +74 -50
- data/assets/stylesheets/bootstrap/_print.scss +8 -2
- data/assets/stylesheets/bootstrap/_reboot.scss +7 -12
- data/assets/stylesheets/bootstrap/_tables.scss +1 -1
- data/assets/stylesheets/bootstrap/_tooltip.scss +15 -12
- data/assets/stylesheets/bootstrap/_utilities.scss +3 -1
- data/assets/stylesheets/bootstrap/_variables.scss +56 -28
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -1
- data/assets/stylesheets/bootstrap/mixins/{_pulls.scss → _float.scss} +2 -2
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +6 -11
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +8 -9
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +31 -8
- data/assets/stylesheets/bootstrap/mixins/_hover.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_image.scss +6 -4
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +1 -1
- data/assets/stylesheets/bootstrap/utilities/_align.scss +6 -0
- data/assets/stylesheets/bootstrap/utilities/_borders.scss +30 -0
- data/assets/stylesheets/bootstrap/utilities/_float.scss +13 -0
- data/assets/stylesheets/bootstrap/utilities/_spacing.scss +10 -9
- data/assets/stylesheets/bootstrap/utilities/_text.scss +8 -0
- data/lib/bootstrap/version.rb +2 -2
- data/templates/project/_bootstrap-variables.scss +55 -27
- metadata +6 -4
- data/assets/stylesheets/bootstrap/utilities/_pulls.scss +0 -13
@@ -1,21 +1,21 @@
|
|
1
|
-
|
1
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
2
2
|
|
3
|
-
var _createClass =
|
3
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
4
4
|
|
5
|
-
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
6
|
|
7
|
-
function
|
7
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
8
8
|
|
9
|
-
function _inherits(subClass, superClass) { if (typeof superClass !==
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
10
10
|
|
11
11
|
/**
|
12
12
|
* --------------------------------------------------------------------------
|
13
|
-
* Bootstrap (v4.0.0-alpha.
|
13
|
+
* Bootstrap (v4.0.0-alpha.5): popover.js
|
14
14
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
15
15
|
* --------------------------------------------------------------------------
|
16
16
|
*/
|
17
17
|
|
18
|
-
var Popover =
|
18
|
+
var Popover = function ($) {
|
19
19
|
|
20
20
|
/**
|
21
21
|
* ------------------------------------------------------------------------
|
@@ -24,7 +24,7 @@ var Popover = (function ($) {
|
|
24
24
|
*/
|
25
25
|
|
26
26
|
var NAME = 'popover';
|
27
|
-
var VERSION = '4.0.0-alpha.
|
27
|
+
var VERSION = '4.0.0-alpha.5';
|
28
28
|
var DATA_KEY = 'bs.popover';
|
29
29
|
var EVENT_KEY = '.' + DATA_KEY;
|
30
30
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
@@ -33,7 +33,7 @@ var Popover = (function ($) {
|
|
33
33
|
placement: 'right',
|
34
34
|
trigger: 'click',
|
35
35
|
content: '',
|
36
|
-
template: '<div class="popover" role="tooltip">' + '<
|
36
|
+
template: '<div class="popover" role="tooltip">' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>'
|
37
37
|
});
|
38
38
|
|
39
39
|
var DefaultType = $.extend({}, Tooltip.DefaultType, {
|
@@ -47,8 +47,7 @@ var Popover = (function ($) {
|
|
47
47
|
|
48
48
|
var Selector = {
|
49
49
|
TITLE: '.popover-title',
|
50
|
-
CONTENT: '.popover-content'
|
51
|
-
ARROW: '.popover-arrow'
|
50
|
+
CONTENT: '.popover-content'
|
52
51
|
};
|
53
52
|
|
54
53
|
var Event = {
|
@@ -70,85 +69,72 @@ var Popover = (function ($) {
|
|
70
69
|
* ------------------------------------------------------------------------
|
71
70
|
*/
|
72
71
|
|
73
|
-
var Popover =
|
72
|
+
var Popover = function (_Tooltip) {
|
74
73
|
_inherits(Popover, _Tooltip);
|
75
74
|
|
76
75
|
function Popover() {
|
77
76
|
_classCallCheck(this, Popover);
|
78
77
|
|
79
|
-
|
78
|
+
return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments));
|
80
79
|
}
|
81
80
|
|
82
|
-
|
83
|
-
* ------------------------------------------------------------------------
|
84
|
-
* jQuery
|
85
|
-
* ------------------------------------------------------------------------
|
86
|
-
*/
|
81
|
+
// overrides
|
87
82
|
|
88
|
-
|
89
|
-
|
83
|
+
Popover.prototype.isWithContent = function isWithContent() {
|
84
|
+
return this.getTitle() || this._getContent();
|
85
|
+
};
|
90
86
|
|
91
|
-
|
87
|
+
Popover.prototype.getTipElement = function getTipElement() {
|
88
|
+
return this.tip = this.tip || $(this.config.template)[0];
|
89
|
+
};
|
92
90
|
|
93
|
-
|
94
|
-
|
95
|
-
}
|
96
|
-
}, {
|
97
|
-
key: 'getTipElement',
|
98
|
-
value: function getTipElement() {
|
99
|
-
return this.tip = this.tip || $(this.config.template)[0];
|
100
|
-
}
|
101
|
-
}, {
|
102
|
-
key: 'setContent',
|
103
|
-
value: function setContent() {
|
104
|
-
var $tip = $(this.getTipElement());
|
91
|
+
Popover.prototype.setContent = function setContent() {
|
92
|
+
var $tip = $(this.getTipElement());
|
105
93
|
|
106
|
-
|
107
|
-
|
108
|
-
|
94
|
+
// we use append for html objects to maintain js events
|
95
|
+
this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
|
96
|
+
this.setElementContent($tip.find(Selector.CONTENT), this._getContent());
|
109
97
|
|
110
|
-
|
98
|
+
$tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
|
111
99
|
|
112
|
-
|
113
|
-
|
100
|
+
this.cleanupTether();
|
101
|
+
};
|
114
102
|
|
115
|
-
|
103
|
+
// private
|
116
104
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content);
|
121
|
-
}
|
105
|
+
Popover.prototype._getContent = function _getContent() {
|
106
|
+
return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content);
|
107
|
+
};
|
122
108
|
|
123
|
-
|
109
|
+
// static
|
124
110
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
var data = $(this).data(DATA_KEY);
|
130
|
-
var _config = typeof config === 'object' ? config : null;
|
111
|
+
Popover._jQueryInterface = function _jQueryInterface(config) {
|
112
|
+
return this.each(function () {
|
113
|
+
var data = $(this).data(DATA_KEY);
|
114
|
+
var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null;
|
131
115
|
|
132
|
-
|
133
|
-
|
134
|
-
|
116
|
+
if (!data && /destroy|hide/.test(config)) {
|
117
|
+
return;
|
118
|
+
}
|
135
119
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
120
|
+
if (!data) {
|
121
|
+
data = new Popover(this, _config);
|
122
|
+
$(this).data(DATA_KEY, data);
|
123
|
+
}
|
140
124
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
}
|
145
|
-
data[config]();
|
125
|
+
if (typeof config === 'string') {
|
126
|
+
if (data[config] === undefined) {
|
127
|
+
throw new Error('No method named "' + config + '"');
|
146
128
|
}
|
147
|
-
|
148
|
-
|
149
|
-
|
129
|
+
data[config]();
|
130
|
+
}
|
131
|
+
});
|
132
|
+
};
|
133
|
+
|
134
|
+
_createClass(Popover, null, [{
|
150
135
|
key: 'VERSION',
|
151
136
|
|
137
|
+
|
152
138
|
// getters
|
153
139
|
|
154
140
|
get: function get() {
|
@@ -187,7 +173,13 @@ var Popover = (function ($) {
|
|
187
173
|
}]);
|
188
174
|
|
189
175
|
return Popover;
|
190
|
-
}
|
176
|
+
}(Tooltip);
|
177
|
+
|
178
|
+
/**
|
179
|
+
* ------------------------------------------------------------------------
|
180
|
+
* jQuery
|
181
|
+
* ------------------------------------------------------------------------
|
182
|
+
*/
|
191
183
|
|
192
184
|
$.fn[NAME] = Popover._jQueryInterface;
|
193
185
|
$.fn[NAME].Constructor = Popover;
|
@@ -197,4 +189,4 @@ var Popover = (function ($) {
|
|
197
189
|
};
|
198
190
|
|
199
191
|
return Popover;
|
200
|
-
}
|
192
|
+
}(jQuery);
|
@@ -1,17 +1,17 @@
|
|
1
|
-
|
1
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
2
2
|
|
3
|
-
var _createClass =
|
3
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
4
4
|
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6
6
|
|
7
7
|
/**
|
8
8
|
* --------------------------------------------------------------------------
|
9
|
-
* Bootstrap (v4.0.0-alpha.
|
9
|
+
* Bootstrap (v4.0.0-alpha.5): scrollspy.js
|
10
10
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
11
11
|
* --------------------------------------------------------------------------
|
12
12
|
*/
|
13
13
|
|
14
|
-
var ScrollSpy =
|
14
|
+
var ScrollSpy = function ($) {
|
15
15
|
|
16
16
|
/**
|
17
17
|
* ------------------------------------------------------------------------
|
@@ -20,7 +20,7 @@ var ScrollSpy = (function ($) {
|
|
20
20
|
*/
|
21
21
|
|
22
22
|
var NAME = 'scrollspy';
|
23
|
-
var VERSION = '4.0.0-alpha.
|
23
|
+
var VERSION = '4.0.0-alpha.5';
|
24
24
|
var DATA_KEY = 'bs.scrollspy';
|
25
25
|
var EVENT_KEY = '.' + DATA_KEY;
|
26
26
|
var DATA_API_KEY = '.data-api';
|
@@ -75,7 +75,7 @@ var ScrollSpy = (function ($) {
|
|
75
75
|
* ------------------------------------------------------------------------
|
76
76
|
*/
|
77
77
|
|
78
|
-
var ScrollSpy =
|
78
|
+
var ScrollSpy = function () {
|
79
79
|
function ScrollSpy(element, config) {
|
80
80
|
_classCallCheck(this, ScrollSpy);
|
81
81
|
|
@@ -94,192 +94,174 @@ var ScrollSpy = (function ($) {
|
|
94
94
|
this._process();
|
95
95
|
}
|
96
96
|
|
97
|
-
/**
|
98
|
-
* ------------------------------------------------------------------------
|
99
|
-
* Data Api implementation
|
100
|
-
* ------------------------------------------------------------------------
|
101
|
-
*/
|
102
|
-
|
103
97
|
// getters
|
104
98
|
|
105
|
-
|
106
|
-
key: 'refresh',
|
99
|
+
// public
|
107
100
|
|
108
|
-
|
101
|
+
ScrollSpy.prototype.refresh = function refresh() {
|
102
|
+
var _this = this;
|
109
103
|
|
110
|
-
|
111
|
-
var _this = this;
|
104
|
+
var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
|
112
105
|
|
113
|
-
|
106
|
+
var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
|
114
107
|
|
115
|
-
|
108
|
+
var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
|
116
109
|
|
117
|
-
|
110
|
+
this._offsets = [];
|
111
|
+
this._targets = [];
|
118
112
|
|
119
|
-
|
120
|
-
this._targets = [];
|
113
|
+
this._scrollHeight = this._getScrollHeight();
|
121
114
|
|
122
|
-
|
115
|
+
var targets = $.makeArray($(this._selector));
|
123
116
|
|
124
|
-
|
117
|
+
targets.map(function (element) {
|
118
|
+
var target = void 0;
|
119
|
+
var targetSelector = Util.getSelectorFromElement(element);
|
125
120
|
|
126
|
-
|
127
|
-
|
128
|
-
|
121
|
+
if (targetSelector) {
|
122
|
+
target = $(targetSelector)[0];
|
123
|
+
}
|
129
124
|
|
130
|
-
|
131
|
-
|
132
|
-
|
125
|
+
if (target && (target.offsetWidth || target.offsetHeight)) {
|
126
|
+
// todo (fat): remove sketch reliance on jQuery position/offset
|
127
|
+
return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
|
128
|
+
}
|
129
|
+
return null;
|
130
|
+
}).filter(function (item) {
|
131
|
+
return item;
|
132
|
+
}).sort(function (a, b) {
|
133
|
+
return a[0] - b[0];
|
134
|
+
}).forEach(function (item) {
|
135
|
+
_this._offsets.push(item[0]);
|
136
|
+
_this._targets.push(item[1]);
|
137
|
+
});
|
138
|
+
};
|
139
|
+
|
140
|
+
ScrollSpy.prototype.dispose = function dispose() {
|
141
|
+
$.removeData(this._element, DATA_KEY);
|
142
|
+
$(this._scrollElement).off(EVENT_KEY);
|
143
|
+
|
144
|
+
this._element = null;
|
145
|
+
this._scrollElement = null;
|
146
|
+
this._config = null;
|
147
|
+
this._selector = null;
|
148
|
+
this._offsets = null;
|
149
|
+
this._targets = null;
|
150
|
+
this._activeTarget = null;
|
151
|
+
this._scrollHeight = null;
|
152
|
+
};
|
133
153
|
|
134
|
-
|
135
|
-
// todo (fat): remove sketch reliance on jQuery position/offset
|
136
|
-
return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
|
137
|
-
}
|
138
|
-
return null;
|
139
|
-
}).filter(function (item) {
|
140
|
-
return item;
|
141
|
-
}).sort(function (a, b) {
|
142
|
-
return a[0] - b[0];
|
143
|
-
}).forEach(function (item) {
|
144
|
-
_this._offsets.push(item[0]);
|
145
|
-
_this._targets.push(item[1]);
|
146
|
-
});
|
147
|
-
}
|
148
|
-
}, {
|
149
|
-
key: 'dispose',
|
150
|
-
value: function dispose() {
|
151
|
-
$.removeData(this._element, DATA_KEY);
|
152
|
-
$(this._scrollElement).off(EVENT_KEY);
|
153
|
-
|
154
|
-
this._element = null;
|
155
|
-
this._scrollElement = null;
|
156
|
-
this._config = null;
|
157
|
-
this._selector = null;
|
158
|
-
this._offsets = null;
|
159
|
-
this._targets = null;
|
160
|
-
this._activeTarget = null;
|
161
|
-
this._scrollHeight = null;
|
162
|
-
}
|
154
|
+
// private
|
163
155
|
|
164
|
-
|
156
|
+
ScrollSpy.prototype._getConfig = function _getConfig(config) {
|
157
|
+
config = $.extend({}, Default, config);
|
165
158
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
if (typeof config.target !== 'string') {
|
172
|
-
var id = $(config.target).attr('id');
|
173
|
-
if (!id) {
|
174
|
-
id = Util.getUID(NAME);
|
175
|
-
$(config.target).attr('id', id);
|
176
|
-
}
|
177
|
-
config.target = '#' + id;
|
159
|
+
if (typeof config.target !== 'string') {
|
160
|
+
var id = $(config.target).attr('id');
|
161
|
+
if (!id) {
|
162
|
+
id = Util.getUID(NAME);
|
163
|
+
$(config.target).attr('id', id);
|
178
164
|
}
|
165
|
+
config.target = '#' + id;
|
166
|
+
}
|
179
167
|
|
180
|
-
|
168
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
181
169
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
170
|
+
return config;
|
171
|
+
};
|
172
|
+
|
173
|
+
ScrollSpy.prototype._getScrollTop = function _getScrollTop() {
|
174
|
+
return this._scrollElement === window ? this._scrollElement.scrollY : this._scrollElement.scrollTop;
|
175
|
+
};
|
176
|
+
|
177
|
+
ScrollSpy.prototype._getScrollHeight = function _getScrollHeight() {
|
178
|
+
return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
|
179
|
+
};
|
180
|
+
|
181
|
+
ScrollSpy.prototype._process = function _process() {
|
182
|
+
var scrollTop = this._getScrollTop() + this._config.offset;
|
183
|
+
var scrollHeight = this._getScrollHeight();
|
184
|
+
var maxScroll = this._config.offset + scrollHeight - this._scrollElement.offsetHeight;
|
185
|
+
|
186
|
+
if (this._scrollHeight !== scrollHeight) {
|
187
|
+
this.refresh();
|
193
188
|
}
|
194
|
-
}, {
|
195
|
-
key: '_process',
|
196
|
-
value: function _process() {
|
197
|
-
var scrollTop = this._getScrollTop() + this._config.offset;
|
198
|
-
var scrollHeight = this._getScrollHeight();
|
199
|
-
var maxScroll = this._config.offset + scrollHeight - this._scrollElement.offsetHeight;
|
200
|
-
|
201
|
-
if (this._scrollHeight !== scrollHeight) {
|
202
|
-
this.refresh();
|
203
|
-
}
|
204
189
|
|
205
|
-
|
206
|
-
|
190
|
+
if (scrollTop >= maxScroll) {
|
191
|
+
var target = this._targets[this._targets.length - 1];
|
207
192
|
|
208
|
-
|
209
|
-
|
210
|
-
}
|
193
|
+
if (this._activeTarget !== target) {
|
194
|
+
this._activate(target);
|
211
195
|
}
|
196
|
+
}
|
212
197
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
198
|
+
if (this._activeTarget && scrollTop < this._offsets[0]) {
|
199
|
+
this._activeTarget = null;
|
200
|
+
this._clear();
|
201
|
+
return;
|
202
|
+
}
|
218
203
|
|
219
|
-
|
220
|
-
|
204
|
+
for (var i = this._offsets.length; i--;) {
|
205
|
+
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (this._offsets[i + 1] === undefined || scrollTop < this._offsets[i + 1]);
|
221
206
|
|
222
|
-
|
223
|
-
|
224
|
-
}
|
207
|
+
if (isActiveTarget) {
|
208
|
+
this._activate(this._targets[i]);
|
225
209
|
}
|
226
210
|
}
|
227
|
-
}
|
228
|
-
key: '_activate',
|
229
|
-
value: function _activate(target) {
|
230
|
-
this._activeTarget = target;
|
211
|
+
};
|
231
212
|
|
232
|
-
|
213
|
+
ScrollSpy.prototype._activate = function _activate(target) {
|
214
|
+
this._activeTarget = target;
|
233
215
|
|
234
|
-
|
235
|
-
queries = queries.map(function (selector) {
|
236
|
-
return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
|
237
|
-
});
|
216
|
+
this._clear();
|
238
217
|
|
239
|
-
|
218
|
+
var queries = this._selector.split(',');
|
219
|
+
queries = queries.map(function (selector) {
|
220
|
+
return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
|
221
|
+
});
|
240
222
|
|
241
|
-
|
242
|
-
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
|
243
|
-
$link.addClass(ClassName.ACTIVE);
|
244
|
-
} else {
|
245
|
-
// todo (fat) this is kinda sus...
|
246
|
-
// recursively add actives to tested nav-links
|
247
|
-
$link.parents(Selector.LI).find(Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
|
248
|
-
}
|
223
|
+
var $link = $(queries.join(','));
|
249
224
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
}
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
$(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
|
225
|
+
if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
|
226
|
+
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
|
227
|
+
$link.addClass(ClassName.ACTIVE);
|
228
|
+
} else {
|
229
|
+
// todo (fat) this is kinda sus...
|
230
|
+
// recursively add actives to tested nav-links
|
231
|
+
$link.parents(Selector.LI).find(Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
|
258
232
|
}
|
259
233
|
|
260
|
-
|
234
|
+
$(this._scrollElement).trigger(Event.ACTIVATE, {
|
235
|
+
relatedTarget: target
|
236
|
+
});
|
237
|
+
};
|
261
238
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
return this.each(function () {
|
266
|
-
var data = $(this).data(DATA_KEY);
|
267
|
-
var _config = typeof config === 'object' && config || null;
|
239
|
+
ScrollSpy.prototype._clear = function _clear() {
|
240
|
+
$(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
|
241
|
+
};
|
268
242
|
|
269
|
-
|
270
|
-
data = new ScrollSpy(this, _config);
|
271
|
-
$(this).data(DATA_KEY, data);
|
272
|
-
}
|
243
|
+
// static
|
273
244
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
245
|
+
ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
|
246
|
+
return this.each(function () {
|
247
|
+
var data = $(this).data(DATA_KEY);
|
248
|
+
var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config || null;
|
249
|
+
|
250
|
+
if (!data) {
|
251
|
+
data = new ScrollSpy(this, _config);
|
252
|
+
$(this).data(DATA_KEY, data);
|
253
|
+
}
|
254
|
+
|
255
|
+
if (typeof config === 'string') {
|
256
|
+
if (data[config] === undefined) {
|
257
|
+
throw new Error('No method named "' + config + '"');
|
279
258
|
}
|
280
|
-
|
281
|
-
|
282
|
-
|
259
|
+
data[config]();
|
260
|
+
}
|
261
|
+
});
|
262
|
+
};
|
263
|
+
|
264
|
+
_createClass(ScrollSpy, null, [{
|
283
265
|
key: 'VERSION',
|
284
266
|
get: function get() {
|
285
267
|
return VERSION;
|
@@ -292,7 +274,13 @@ var ScrollSpy = (function ($) {
|
|
292
274
|
}]);
|
293
275
|
|
294
276
|
return ScrollSpy;
|
295
|
-
}
|
277
|
+
}();
|
278
|
+
|
279
|
+
/**
|
280
|
+
* ------------------------------------------------------------------------
|
281
|
+
* Data Api implementation
|
282
|
+
* ------------------------------------------------------------------------
|
283
|
+
*/
|
296
284
|
|
297
285
|
$(window).on(Event.LOAD_DATA_API, function () {
|
298
286
|
var scrollSpys = $.makeArray($(Selector.DATA_SPY));
|
@@ -317,4 +305,4 @@ var ScrollSpy = (function ($) {
|
|
317
305
|
};
|
318
306
|
|
319
307
|
return ScrollSpy;
|
320
|
-
}
|
308
|
+
}(jQuery);
|