materialize-sass 1.0.0.alpha2 → 1.0.0.alpha3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +5 -5
  2. data/assets/javascripts/materialize-sprockets.js +1 -0
  3. data/assets/javascripts/materialize.js +1337 -1281
  4. data/assets/javascripts/materialize/autocomplete.js +27 -27
  5. data/assets/javascripts/materialize/buttons.js +58 -58
  6. data/assets/javascripts/materialize/carousel.js +47 -49
  7. data/assets/javascripts/materialize/cash.js +4 -4
  8. data/assets/javascripts/materialize/characterCounter.js +20 -20
  9. data/assets/javascripts/materialize/chips.js +42 -38
  10. data/assets/javascripts/materialize/collapsible.js +27 -27
  11. data/assets/javascripts/materialize/component.js +57 -0
  12. data/assets/javascripts/materialize/datepicker.js +59 -53
  13. data/assets/javascripts/materialize/dropdown.js +43 -43
  14. data/assets/javascripts/materialize/extras/nouislider.js +1 -1
  15. data/assets/javascripts/materialize/extras/nouislider.min.js +1 -1
  16. data/assets/javascripts/materialize/forms.js +8 -2
  17. data/assets/javascripts/materialize/global.js +11 -13
  18. data/assets/javascripts/materialize/materialbox.js +72 -44
  19. data/assets/javascripts/materialize/modal.js +55 -38
  20. data/assets/javascripts/materialize/parallax.js +61 -24
  21. data/assets/javascripts/materialize/pushpin.js +37 -21
  22. data/assets/javascripts/materialize/range.js +19 -21
  23. data/assets/javascripts/materialize/scrollspy.js +23 -23
  24. data/assets/javascripts/materialize/select.js +42 -36
  25. data/assets/javascripts/materialize/sidenav.js +34 -34
  26. data/assets/javascripts/materialize/slider.js +37 -39
  27. data/assets/javascripts/materialize/tabs.js +42 -49
  28. data/assets/javascripts/materialize/tapTarget.js +39 -22
  29. data/assets/javascripts/materialize/timepicker.js +579 -579
  30. data/assets/javascripts/materialize/tooltip.js +34 -31
  31. data/assets/stylesheets/materialize/components/_cards.scss +0 -2
  32. data/assets/stylesheets/materialize/components/_global.scss +4 -14
  33. data/assets/stylesheets/materialize/components/_typography.scss +0 -1
  34. data/assets/stylesheets/materialize/components/_variables.scss +1 -1
  35. data/assets/stylesheets/materialize/components/forms/_checkboxes.scss +0 -10
  36. data/assets/stylesheets/materialize/extras/nouislider.css +1 -1
  37. data/lib/materialize-sass/version.rb +1 -1
  38. metadata +4 -3
@@ -1,33 +1,45 @@
1
1
  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; }; }();
2
2
 
3
+ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
4
+
3
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
6
 
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
+
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
+
5
11
  (function ($) {
6
12
  'use strict';
7
13
 
8
- var _defaults = {};
14
+ var _defaults = {
15
+ responsiveThreshold: 0 // breakpoint for swipeable
16
+ };
17
+
18
+ var Parallax = function (_Component) {
19
+ _inherits(Parallax, _Component);
9
20
 
10
- var Parallax = function () {
11
21
  function Parallax(el, options) {
12
22
  _classCallCheck(this, Parallax);
13
23
 
14
- // If exists, destroy and reinitialize
15
- if (!!el.M_Parallax) {
16
- el.M_Parallax.destroy();
17
- }
24
+ var _this = _possibleConstructorReturn(this, (Parallax.__proto__ || Object.getPrototypeOf(Parallax)).call(this, Parallax, el, options));
18
25
 
19
- this.el = el;
20
- this.$el = $(el);
21
- this.el.M_Parallax = this;
26
+ _this.el.M_Parallax = _this;
22
27
 
23
- this.options = $.extend({}, Parallax.defaults, options);
28
+ /**
29
+ * Options for the Parallax
30
+ * @member Parallax#options
31
+ * @prop {Number} responsiveThreshold
32
+ */
33
+ _this.options = $.extend({}, Parallax.defaults, options);
24
34
 
25
- this.$img = this.$el.find('img').first();
26
- this._updateParallax();
27
- this._setupEventHandlers();
28
- this._setupStyles();
35
+ _this.$img = _this.$el.find('img').first();
36
+ _this._enabled = window.innerWidth > _this.options.responsiveThreshold;
37
+ _this._updateParallax();
38
+ _this._setupEventHandlers();
39
+ _this._setupStyles();
29
40
 
30
- Parallax._parallaxes.push(this);
41
+ Parallax._parallaxes.push(_this);
42
+ return _this;
31
43
  }
32
44
 
33
45
  _createClass(Parallax, [{
@@ -37,7 +49,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
37
49
  /**
38
50
  * Teardown component
39
51
  */
40
- value: function destroy() {}
52
+ value: function destroy() {
53
+ Parallax._parallaxes.splice(Parallax._parallaxes.indexOf(this), 1);
54
+ this.$img[0].style.transform = '';
55
+ this._removeEventHandlers();
56
+
57
+ this.$el[0].M_Parallax = undefined;
58
+ }
41
59
  }, {
42
60
  key: '_setupEventHandlers',
43
61
  value: function _setupEventHandlers() {
@@ -47,6 +65,19 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
47
65
  if (Parallax._parallaxes.length === 0) {
48
66
  Parallax._handleScrollThrottled = M.throttle(Parallax._handleScroll, 5);
49
67
  window.addEventListener('scroll', Parallax._handleScrollThrottled);
68
+
69
+ Parallax._handleWindowResizeThrottled = M.throttle(Parallax._handleWindowResize, 5);
70
+ window.addEventListener('resize', Parallax._handleWindowResizeThrottled);
71
+ }
72
+ }
73
+ }, {
74
+ key: '_removeEventHandlers',
75
+ value: function _removeEventHandlers() {
76
+ this.$img[0].removeEventListener('load', this._handleImageLoadBound);
77
+
78
+ if (Parallax._parallaxes.length === 0) {
79
+ window.removeEventListener('scroll', Parallax._handleScrollThrottled);
80
+ window.removeEventListener('resize', Parallax._handleWindowResizeThrottled);
50
81
  }
51
82
  }
52
83
  }, {
@@ -77,18 +108,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
77
108
  var percentScrolled = (windowBottom - top) / (containerHeight + windowHeight);
78
109
  var parallax = parallaxDist * percentScrolled;
79
110
 
80
- if (bottom > scrollTop && top < scrollTop + windowHeight) {
111
+ if (!this._enabled) {
112
+ this.$img[0].style.transform = '';
113
+ } else if (bottom > scrollTop && top < scrollTop + windowHeight) {
81
114
  this.$img[0].style.transform = 'translate3D(-50%, ' + parallax + 'px, 0)';
82
115
  }
83
116
  }
84
117
  }], [{
85
118
  key: 'init',
86
- value: function init($els, options) {
87
- var arr = [];
88
- $els.each(function () {
89
- arr.push(new Parallax(this, options));
90
- });
91
- return arr;
119
+ value: function init(els, options) {
120
+ return _get(Parallax.__proto__ || Object.getPrototypeOf(Parallax), 'init', this).call(this, this, els, options);
92
121
  }
93
122
 
94
123
  /**
@@ -109,6 +138,14 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
109
138
  parallaxInstance._updateParallax.call(parallaxInstance);
110
139
  }
111
140
  }
141
+ }, {
142
+ key: '_handleWindowResize',
143
+ value: function _handleWindowResize() {
144
+ for (var i = 0; i < Parallax._parallaxes.length; i++) {
145
+ var parallaxInstance = Parallax._parallaxes[i];
146
+ parallaxInstance._enabled = window.innerWidth > parallaxInstance.options.responsiveThreshold;
147
+ }
148
+ }
112
149
  }, {
113
150
  key: 'defaults',
114
151
  get: function () {
@@ -117,7 +154,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
117
154
  }]);
118
155
 
119
156
  return Parallax;
120
- }();
157
+ }(Component);
121
158
 
122
159
  /**
123
160
  * @static
@@ -1,14 +1,21 @@
1
1
  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; }; }();
2
2
 
3
+ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
4
+
3
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
6
 
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
+
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
+
5
11
  (function ($) {
6
12
  'use strict';
7
13
 
8
14
  var _defaults = {
9
15
  top: 0,
10
16
  bottom: Infinity,
11
- offset: 0
17
+ offset: 0,
18
+ onPositionChange: null
12
19
  };
13
20
 
14
21
  /**
@@ -16,7 +23,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
16
23
  *
17
24
  */
18
25
 
19
- var Pushpin = function () {
26
+ var Pushpin = function (_Component) {
27
+ _inherits(Pushpin, _Component);
28
+
20
29
  /**
21
30
  * Construct Pushpin instance
22
31
  * @constructor
@@ -26,25 +35,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
26
35
  function Pushpin(el, options) {
27
36
  _classCallCheck(this, Pushpin);
28
37
 
29
- // If exists, destroy and reinitialize
30
- if (!!el.M_Pushpin) {
31
- el.M_Pushpin.destroy();
32
- }
38
+ var _this = _possibleConstructorReturn(this, (Pushpin.__proto__ || Object.getPrototypeOf(Pushpin)).call(this, Pushpin, el, options));
33
39
 
34
- this.el = el;
35
- this.$el = $(el);
36
- this.el.M_Pushpin = this;
40
+ _this.el.M_Pushpin = _this;
37
41
 
38
42
  /**
39
43
  * Options for the modal
40
44
  * @member Pushpin#options
41
45
  */
42
- this.options = $.extend({}, Pushpin.defaults, options);
46
+ _this.options = $.extend({}, Pushpin.defaults, options);
43
47
 
44
- this.originalOffset = this.el.offsetTop;
45
- Pushpin._pushpins.push(this);
46
- this._setupEventHandlers();
47
- this._updatePosition();
48
+ _this.originalOffset = _this.el.offsetTop;
49
+ Pushpin._pushpins.push(_this);
50
+ _this._setupEventHandlers();
51
+ _this._updatePosition();
52
+ return _this;
48
53
  }
49
54
 
50
55
  _createClass(Pushpin, [{
@@ -83,6 +88,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
83
88
 
84
89
  this.el.style.top = this.options.offset + 'px';
85
90
  this.el.classList.add('pinned');
91
+
92
+ // onPositionChange callback
93
+ if (typeof this.options.onPositionChange === 'function') {
94
+ this.options.onPositionChange.call(this, 'pinned');
95
+ }
86
96
  }
87
97
 
88
98
  // Add pin-top (when scrolled position is above top)
@@ -90,6 +100,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
90
100
  this._removePinClasses();
91
101
  this.el.style.top = 0;
92
102
  this.el.classList.add('pin-top');
103
+
104
+ // onPositionChange callback
105
+ if (typeof this.options.onPositionChange === 'function') {
106
+ this.options.onPositionChange.call(this, 'pin-top');
107
+ }
93
108
  }
94
109
 
95
110
  // Add pin-bottom (when scrolled position is below bottom)
@@ -97,6 +112,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
97
112
  this._removePinClasses();
98
113
  this.el.classList.add('pin-bottom');
99
114
  this.el.style.top = this.options.bottom - this.originalOffset + 'px';
115
+
116
+ // onPositionChange callback
117
+ if (typeof this.options.onPositionChange === 'function') {
118
+ this.options.onPositionChange.call(this, 'pin-bottom');
119
+ }
100
120
  }
101
121
  }
102
122
  }, {
@@ -106,12 +126,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
106
126
  }
107
127
  }], [{
108
128
  key: 'init',
109
- value: function init($els, options) {
110
- var arr = [];
111
- $els.each(function () {
112
- arr.push(new Pushpin(this, options));
113
- });
114
- return arr;
129
+ value: function init(els, options) {
130
+ return _get(Pushpin.__proto__ || Object.getPrototypeOf(Pushpin), 'init', this).call(this, this, els, options);
115
131
  }
116
132
 
117
133
  /**
@@ -140,7 +156,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
140
156
  }]);
141
157
 
142
158
  return Pushpin;
143
- }();
159
+ }(Component);
144
160
 
145
161
  /**
146
162
  * @static
@@ -1,7 +1,13 @@
1
1
  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; }; }();
2
2
 
3
+ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
4
+
3
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
6
 
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
+
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
+
5
11
  (function ($, anim) {
6
12
  'use strict';
7
13
 
@@ -12,7 +18,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
12
18
  *
13
19
  */
14
20
 
15
- var Range = function () {
21
+ var Range = function (_Component) {
22
+ _inherits(Range, _Component);
23
+
16
24
  /**
17
25
  * Construct Range instance
18
26
  * @constructor
@@ -22,27 +30,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
22
30
  function Range(el, options) {
23
31
  _classCallCheck(this, Range);
24
32
 
25
- // If exists, destroy and reinitialize
26
- if (!!el.M_Range) {
27
- el.M_Range.destroy();
28
- }
33
+ var _this = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options));
29
34
 
30
- this.el = el;
31
- this.$el = $(el);
32
- this.el.M_Range = this;
35
+ _this.el.M_Range = _this;
33
36
 
34
37
  /**
35
38
  * Options for the range
36
39
  * @member Range#options
37
40
  */
38
- this.options = $.extend({}, Range.defaults, options);
41
+ _this.options = $.extend({}, Range.defaults, options);
39
42
 
40
- this._mousedown = false;
43
+ _this._mousedown = false;
41
44
 
42
45
  // Setup
43
- this._setupThumb();
46
+ _this._setupThumb();
44
47
 
45
- this._setupEventHandlers();
48
+ _this._setupEventHandlers();
49
+ return _this;
46
50
  }
47
51
 
48
52
  _createClass(Range, [{
@@ -289,14 +293,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
289
293
  }
290
294
  }], [{
291
295
  key: 'init',
292
- value: function init($els, options) {
293
- var arr = [];
294
- $els.each(function () {
295
- if (!$(this).hasClass('browser-default')) {
296
- arr.push(new Range(this, options));
297
- }
298
- });
299
- return arr;
296
+ value: function init(els, options) {
297
+ return _get(Range.__proto__ || Object.getPrototypeOf(Range), 'init', this).call(this, this, els, options);
300
298
  }
301
299
 
302
300
  /**
@@ -317,7 +315,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
317
315
  }]);
318
316
 
319
317
  return Range;
320
- }();
318
+ }(Component);
321
319
 
322
320
  M.Range = Range;
323
321
 
@@ -1,7 +1,13 @@
1
1
  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; }; }();
2
2
 
3
+ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
4
+
3
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
6
 
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
+
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
+
5
11
  (function ($, anim) {
6
12
  'use strict';
7
13
 
@@ -19,7 +25,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
19
25
  *
20
26
  */
21
27
 
22
- var ScrollSpy = function () {
28
+ var ScrollSpy = function (_Component) {
29
+ _inherits(ScrollSpy, _Component);
30
+
23
31
  /**
24
32
  * Construct ScrollSpy instance
25
33
  * @constructor
@@ -29,14 +37,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
29
37
  function ScrollSpy(el, options) {
30
38
  _classCallCheck(this, ScrollSpy);
31
39
 
32
- // If exists, destroy and reinitialize
33
- if (!!el.M_ScrollSpy) {
34
- el.M_ScrollSpy.destroy();
35
- }
40
+ var _this = _possibleConstructorReturn(this, (ScrollSpy.__proto__ || Object.getPrototypeOf(ScrollSpy)).call(this, ScrollSpy, el, options));
36
41
 
37
- this.el = el;
38
- this.$el = $(el);
39
- this.el.M_ScrollSpy = this;
42
+ _this.el.M_ScrollSpy = _this;
40
43
 
41
44
  /**
42
45
  * Options for the modal
@@ -46,16 +49,17 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
46
49
  * @prop {String} [activeClass='active'] - Class applied to active elements
47
50
  * @prop {Function} [getActiveElement] - Used to find active element
48
51
  */
49
- this.options = $.extend({}, ScrollSpy.defaults, options);
52
+ _this.options = $.extend({}, ScrollSpy.defaults, options);
50
53
 
51
54
  // setup
52
- ScrollSpy._elements.push(this);
55
+ ScrollSpy._elements.push(_this);
53
56
  ScrollSpy._count++;
54
57
  ScrollSpy._increment++;
55
- this.tickId = -1;
56
- this.id = ScrollSpy._increment;
57
- this._setupEventHandlers();
58
- this._handleWindowScroll();
58
+ _this.tickId = -1;
59
+ _this.id = ScrollSpy._increment;
60
+ _this._setupEventHandlers();
61
+ _this._handleWindowScroll();
62
+ return _this;
59
63
  }
60
64
 
61
65
  _createClass(ScrollSpy, [{
@@ -208,7 +212,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
208
212
  }, {
209
213
  key: '_exit',
210
214
  value: function _exit() {
211
- var _this = this;
215
+ var _this2 = this;
212
216
 
213
217
  ScrollSpy._visibleElements = ScrollSpy._visibleElements.filter(function (value) {
214
218
  return value.height() != 0;
@@ -218,7 +222,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
218
222
  $(this.options.getActiveElement(ScrollSpy._visibleElements[0].attr('id'))).removeClass(this.options.activeClass);
219
223
 
220
224
  ScrollSpy._visibleElements = ScrollSpy._visibleElements.filter(function (el) {
221
- return el.attr('id') != _this.$el.attr('id');
225
+ return el.attr('id') != _this2.$el.attr('id');
222
226
  });
223
227
  if (ScrollSpy._visibleElements[0]) {
224
228
  // Check if empty
@@ -228,12 +232,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
228
232
  }
229
233
  }], [{
230
234
  key: 'init',
231
- value: function init($els, options) {
232
- var arr = [];
233
- $els.each(function () {
234
- arr.push(new ScrollSpy(this, options));
235
- });
236
- return arr;
235
+ value: function init(els, options) {
236
+ return _get(ScrollSpy.__proto__ || Object.getPrototypeOf(ScrollSpy), 'init', this).call(this, this, els, options);
237
237
  }
238
238
 
239
239
  /**
@@ -277,7 +277,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
277
277
  }]);
278
278
 
279
279
  return ScrollSpy;
280
- }();
280
+ }(Component);
281
281
 
282
282
  /**
283
283
  * @static