materialize-sass 0.100.2.1 → 1.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +18 -42
  3. data/Rakefile +17 -17
  4. data/{app/assets → assets}/javascripts/materialize-sprockets.js +8 -12
  5. data/assets/javascripts/materialize.js +11877 -0
  6. data/assets/javascripts/materialize/autocomplete.js +420 -0
  7. data/assets/javascripts/materialize/buttons.js +388 -0
  8. data/assets/javascripts/materialize/cards.js +28 -0
  9. data/assets/javascripts/materialize/carousel.js +791 -0
  10. data/assets/javascripts/materialize/cash.js +992 -0
  11. data/assets/javascripts/materialize/characterCounter.js +180 -0
  12. data/assets/javascripts/materialize/chips.js +555 -0
  13. data/assets/javascripts/materialize/collapsible.js +275 -0
  14. data/assets/javascripts/materialize/datepicker.js +898 -0
  15. data/assets/javascripts/materialize/dropdown.js +530 -0
  16. data/{app/assets → assets}/javascripts/materialize/extras/nouislider.js +1 -1
  17. data/{app/assets → assets}/javascripts/materialize/extras/nouislider.min.js +1 -1
  18. data/assets/javascripts/materialize/forms.js +223 -0
  19. data/assets/javascripts/materialize/global.js +353 -0
  20. data/assets/javascripts/materialize/materialbox.js +432 -0
  21. data/{app/assets → assets}/javascripts/materialize/modal.js +82 -113
  22. data/assets/javascripts/materialize/parallax.js +135 -0
  23. data/assets/javascripts/materialize/pushpin.js +158 -0
  24. data/assets/javascripts/materialize/range.js +305 -0
  25. data/assets/javascripts/materialize/scrollspy.js +322 -0
  26. data/assets/javascripts/materialize/select.js +426 -0
  27. data/assets/javascripts/materialize/sidenav.js +584 -0
  28. data/assets/javascripts/materialize/slider.js +383 -0
  29. data/assets/javascripts/materialize/tabs.js +460 -0
  30. data/assets/javascripts/materialize/tapTarget.js +347 -0
  31. data/assets/javascripts/materialize/timepicker.js +616 -0
  32. data/{app/assets → assets}/javascripts/materialize/toasts.js +42 -46
  33. data/assets/javascripts/materialize/tooltip.js +325 -0
  34. data/assets/javascripts/materialize/velocity.min.js +782 -0
  35. data/{app/assets → assets}/javascripts/materialize/waves.js +0 -0
  36. data/{app/assets → assets}/stylesheets/materialize.scss +5 -6
  37. data/{app/assets → assets}/stylesheets/materialize/components/_badges.scss +1 -1
  38. data/{app/assets → assets}/stylesheets/materialize/components/_buttons.scss +34 -2
  39. data/{app/assets → assets}/stylesheets/materialize/components/_cards.scss +0 -0
  40. data/{app/assets → assets}/stylesheets/materialize/components/_carousel.scss +1 -1
  41. data/{app/assets → assets}/stylesheets/materialize/components/_chips.scss +6 -5
  42. data/{app/assets → assets}/stylesheets/materialize/components/_collapsible.scss +3 -3
  43. data/{app/assets → assets}/stylesheets/materialize/components/_color.scss +0 -0
  44. data/assets/stylesheets/materialize/components/_datepicker.scss +180 -0
  45. data/{app/assets → assets}/stylesheets/materialize/components/_dropdown.scss +16 -15
  46. data/{app/assets → assets}/stylesheets/materialize/components/_global.scss +49 -14
  47. data/{app/assets → assets}/stylesheets/materialize/components/_grid.scss +1 -1
  48. data/{app/assets → assets}/stylesheets/materialize/components/_icons-material-design.scss +0 -0
  49. data/{app/assets → assets}/stylesheets/materialize/components/_materialbox.scss +0 -0
  50. data/assets/stylesheets/materialize/components/_mixins.scss +5 -0
  51. data/{app/assets → assets}/stylesheets/materialize/components/_modal.scss +1 -1
  52. data/{app/assets → assets}/stylesheets/materialize/components/_navbar.scss +0 -0
  53. data/assets/stylesheets/materialize/components/_normalize.scss +447 -0
  54. data/{app/assets → assets}/stylesheets/materialize/components/_preloader.scss +0 -0
  55. data/{app/assets → assets}/stylesheets/materialize/components/_pulse.scss +0 -0
  56. data/{app/assets/stylesheets/materialize/components/_sideNav.scss → assets/stylesheets/materialize/components/_sidenav.scss} +23 -21
  57. data/{app/assets → assets}/stylesheets/materialize/components/_slider.scss +0 -0
  58. data/{app/assets → assets}/stylesheets/materialize/components/_table_of_contents.scss +3 -3
  59. data/{app/assets → assets}/stylesheets/materialize/components/_tabs.scss +2 -2
  60. data/{app/assets → assets}/stylesheets/materialize/components/_tapTarget.scss +0 -0
  61. data/assets/stylesheets/materialize/components/_timepicker.scss +182 -0
  62. data/{app/assets → assets}/stylesheets/materialize/components/_toast.scss +0 -0
  63. data/{app/assets → assets}/stylesheets/materialize/components/_tooltip.scss +1 -0
  64. data/{app/assets → assets}/stylesheets/materialize/components/_transitions.scss +0 -0
  65. data/{app/assets → assets}/stylesheets/materialize/components/_typography.scss +8 -8
  66. data/{app/assets → assets}/stylesheets/materialize/components/_variables.scss +42 -44
  67. data/{app/assets → assets}/stylesheets/materialize/components/_waves.scss +0 -0
  68. data/{app/assets → assets}/stylesheets/materialize/components/forms/_checkboxes.scss +24 -24
  69. data/{app/assets → assets}/stylesheets/materialize/components/forms/_file-input.scss +0 -0
  70. data/{app/assets → assets}/stylesheets/materialize/components/forms/_forms.scss +0 -0
  71. data/{app/assets → assets}/stylesheets/materialize/components/forms/_input-fields.scss +49 -35
  72. data/{app/assets → assets}/stylesheets/materialize/components/forms/_radio-buttons.scss +29 -29
  73. data/{app/assets → assets}/stylesheets/materialize/components/forms/_range.scss +32 -31
  74. data/{app/assets → assets}/stylesheets/materialize/components/forms/_select.scss +20 -11
  75. data/{app/assets → assets}/stylesheets/materialize/components/forms/_switches.scss +0 -0
  76. data/{app/assets → assets}/stylesheets/materialize/extras/nouislider.css +1 -1
  77. data/lib/materialize-sass.rb +13 -23
  78. data/lib/materialize-sass/engine.rb +6 -9
  79. data/lib/materialize-sass/version.rb +1 -1
  80. data/materialize-sass.gemspec +2 -1
  81. metadata +97 -97
  82. data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
  83. data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
  84. data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
  85. data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
  86. data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
  87. data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
  88. data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
  89. data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
  90. data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
  91. data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
  92. data/app/assets/javascripts/materialize.js +0 -10021
  93. data/app/assets/javascripts/materialize/animation.js +0 -7
  94. data/app/assets/javascripts/materialize/buttons.js +0 -253
  95. data/app/assets/javascripts/materialize/cards.js +0 -28
  96. data/app/assets/javascripts/materialize/carousel.js +0 -543
  97. data/app/assets/javascripts/materialize/character_counter.js +0 -64
  98. data/app/assets/javascripts/materialize/chips.js +0 -315
  99. data/app/assets/javascripts/materialize/collapsible.js +0 -178
  100. data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -1399
  101. data/app/assets/javascripts/materialize/date_picker/picker.js +0 -1196
  102. data/app/assets/javascripts/materialize/date_picker/picker.time.js +0 -646
  103. data/app/assets/javascripts/materialize/dropdown.js +0 -257
  104. data/app/assets/javascripts/materialize/forms.js +0 -806
  105. data/app/assets/javascripts/materialize/global.js +0 -170
  106. data/app/assets/javascripts/materialize/hammer.min.js +0 -424
  107. data/app/assets/javascripts/materialize/initial.js +0 -10
  108. data/app/assets/javascripts/materialize/jquery.easing.1.4.js +0 -144
  109. data/app/assets/javascripts/materialize/jquery.hammer.js +0 -33
  110. data/app/assets/javascripts/materialize/materialbox.js +0 -263
  111. data/app/assets/javascripts/materialize/parallax.js +0 -54
  112. data/app/assets/javascripts/materialize/pushpin.js +0 -68
  113. data/app/assets/javascripts/materialize/scrollFire.js +0 -49
  114. data/app/assets/javascripts/materialize/scrollspy.js +0 -230
  115. data/app/assets/javascripts/materialize/sideNav.js +0 -395
  116. data/app/assets/javascripts/materialize/slider.js +0 -295
  117. data/app/assets/javascripts/materialize/tabs.js +0 -244
  118. data/app/assets/javascripts/materialize/tapTarget.js +0 -184
  119. data/app/assets/javascripts/materialize/tooltip.js +0 -227
  120. data/app/assets/javascripts/materialize/transitions.js +0 -163
  121. data/app/assets/javascripts/materialize/velocity.min.js +0 -626
  122. data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -424
  123. data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -39
  124. data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +0 -469
  125. data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +0 -216
  126. data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +0 -267
@@ -0,0 +1,135 @@
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
+
3
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
+
5
+ (function ($) {
6
+ 'use strict';
7
+
8
+ var _defaults = {};
9
+
10
+ var Parallax = function () {
11
+ function Parallax(el, options) {
12
+ _classCallCheck(this, Parallax);
13
+
14
+ // If exists, destroy and reinitialize
15
+ if (!!el.M_Parallax) {
16
+ el.M_Parallax.destroy();
17
+ }
18
+
19
+ this.el = el;
20
+ this.$el = $(el);
21
+ this.el.M_Parallax = this;
22
+
23
+ this.options = $.extend({}, Parallax.defaults, options);
24
+
25
+ this.$img = this.$el.find('img').first();
26
+ this._updateParallax();
27
+ this._setupEventHandlers();
28
+ this._setupStyles();
29
+
30
+ Parallax._parallaxes.push(this);
31
+ }
32
+
33
+ _createClass(Parallax, [{
34
+ key: 'destroy',
35
+
36
+
37
+ /**
38
+ * Teardown component
39
+ */
40
+ value: function destroy() {}
41
+ }, {
42
+ key: '_setupEventHandlers',
43
+ value: function _setupEventHandlers() {
44
+ this._handleImageLoadBound = this._handleImageLoad.bind(this);
45
+ this.$img[0].addEventListener('load', this._handleImageLoadBound);
46
+
47
+ if (Parallax._parallaxes.length === 0) {
48
+ Parallax._handleScrollThrottled = M.throttle(Parallax._handleScroll, 5);
49
+ window.addEventListener('scroll', Parallax._handleScrollThrottled);
50
+ }
51
+ }
52
+ }, {
53
+ key: '_setupStyles',
54
+ value: function _setupStyles() {
55
+ this.$img[0].style.opacity = 1;
56
+ }
57
+ }, {
58
+ key: '_handleImageLoad',
59
+ value: function _handleImageLoad() {
60
+ this._updateParallax();
61
+ this.$img.each(function () {
62
+ var el = this;
63
+ if (el.complete) $(el).trigger("load");
64
+ });
65
+ }
66
+ }, {
67
+ key: '_updateParallax',
68
+ value: function _updateParallax() {
69
+ var containerHeight = this.$el.height() > 0 ? this.el.parentNode.offsetHeight : 500;
70
+ var imgHeight = this.$img[0].offsetHeight;
71
+ var parallaxDist = imgHeight - containerHeight;
72
+ var bottom = this.$el.offset().top + containerHeight;
73
+ var top = this.$el.offset().top;
74
+ var scrollTop = M.getDocumentScrollTop();
75
+ var windowHeight = window.innerHeight;
76
+ var windowBottom = scrollTop + windowHeight;
77
+ var percentScrolled = (windowBottom - top) / (containerHeight + windowHeight);
78
+ var parallax = parallaxDist * percentScrolled;
79
+
80
+ if (bottom > scrollTop && top < scrollTop + windowHeight) {
81
+ this.$img[0].style.transform = 'translate3D(-50%, ' + parallax + 'px, 0)';
82
+ }
83
+ }
84
+ }], [{
85
+ 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;
92
+ }
93
+
94
+ /**
95
+ * Get Instance
96
+ */
97
+
98
+ }, {
99
+ key: 'getInstance',
100
+ value: function getInstance(el) {
101
+ var domElem = !!el.jquery ? el[0] : el;
102
+ return domElem.M_Parallax;
103
+ }
104
+ }, {
105
+ key: '_handleScroll',
106
+ value: function _handleScroll() {
107
+ for (var i = 0; i < Parallax._parallaxes.length; i++) {
108
+ var parallaxInstance = Parallax._parallaxes[i];
109
+ parallaxInstance._updateParallax.call(parallaxInstance);
110
+ }
111
+ }
112
+ }, {
113
+ key: 'defaults',
114
+ get: function () {
115
+ return _defaults;
116
+ }
117
+ }]);
118
+
119
+ return Parallax;
120
+ }();
121
+
122
+ /**
123
+ * @static
124
+ * @memberof Parallax
125
+ */
126
+
127
+
128
+ Parallax._parallaxes = [];
129
+
130
+ M.Parallax = Parallax;
131
+
132
+ if (M.jQueryLoaded) {
133
+ M.initializeJqueryWrapper(Parallax, 'parallax', 'M_Parallax');
134
+ }
135
+ })(cash);
@@ -0,0 +1,158 @@
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
+
3
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
+
5
+ (function ($) {
6
+ 'use strict';
7
+
8
+ var _defaults = {
9
+ top: 0,
10
+ bottom: Infinity,
11
+ offset: 0
12
+ };
13
+
14
+ /**
15
+ * @class
16
+ *
17
+ */
18
+
19
+ var Pushpin = function () {
20
+ /**
21
+ * Construct Pushpin instance
22
+ * @constructor
23
+ * @param {Element} el
24
+ * @param {Object} options
25
+ */
26
+ function Pushpin(el, options) {
27
+ _classCallCheck(this, Pushpin);
28
+
29
+ // If exists, destroy and reinitialize
30
+ if (!!el.M_Pushpin) {
31
+ el.M_Pushpin.destroy();
32
+ }
33
+
34
+ this.el = el;
35
+ this.$el = $(el);
36
+ this.el.M_Pushpin = this;
37
+
38
+ /**
39
+ * Options for the modal
40
+ * @member Pushpin#options
41
+ */
42
+ this.options = $.extend({}, Pushpin.defaults, options);
43
+
44
+ this.originalOffset = this.el.offsetTop;
45
+ Pushpin._pushpins.push(this);
46
+ this._setupEventHandlers();
47
+ this._updatePosition();
48
+ }
49
+
50
+ _createClass(Pushpin, [{
51
+ key: 'destroy',
52
+
53
+
54
+ /**
55
+ * Teardown component
56
+ */
57
+ value: function destroy() {
58
+ this.el.style.top = null;
59
+ this._removePinClasses();
60
+ this._removeEventHandlers();
61
+
62
+ // Remove pushpin Inst
63
+ var index = Pushpin._pushpins.indexOf(this);
64
+ Pushpin._pushpins.splice(index, 1);
65
+ }
66
+ }, {
67
+ key: '_setupEventHandlers',
68
+ value: function _setupEventHandlers() {
69
+ document.addEventListener('scroll', Pushpin._updateElements);
70
+ }
71
+ }, {
72
+ key: '_removeEventHandlers',
73
+ value: function _removeEventHandlers() {
74
+ document.removeEventListener('scroll', Pushpin._updateElements);
75
+ }
76
+ }, {
77
+ key: '_updatePosition',
78
+ value: function _updatePosition() {
79
+ var scrolled = M.getDocumentScrollTop() + this.options.offset;
80
+
81
+ if (this.options.top <= scrolled && this.options.bottom >= scrolled && !this.el.classList.contains('pinned')) {
82
+ this._removePinClasses();
83
+
84
+ this.el.style.top = this.options.offset + 'px';
85
+ this.el.classList.add('pinned');
86
+ }
87
+
88
+ // Add pin-top (when scrolled position is above top)
89
+ if (scrolled < this.options.top && !this.el.classList.contains('pin-top')) {
90
+ this._removePinClasses();
91
+ this.el.style.top = 0;
92
+ this.el.classList.add('pin-top');
93
+ }
94
+
95
+ // Add pin-bottom (when scrolled position is below bottom)
96
+ if (scrolled > this.options.bottom && !this.el.classList.contains('pin-bottom')) {
97
+ this._removePinClasses();
98
+ this.el.classList.add('pin-bottom');
99
+ this.el.style.top = this.options.bottom - this.originalOffset + 'px';
100
+ }
101
+ }
102
+ }, {
103
+ key: '_removePinClasses',
104
+ value: function _removePinClasses() {
105
+ this.el.classList.remove('pin-top', 'pinned', 'pin-bottom');
106
+ }
107
+ }], [{
108
+ 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;
115
+ }
116
+
117
+ /**
118
+ * Get Instance
119
+ */
120
+
121
+ }, {
122
+ key: 'getInstance',
123
+ value: function getInstance(el) {
124
+ var domElem = !!el.jquery ? el[0] : el;
125
+ return domElem.M_Pushpin;
126
+ }
127
+ }, {
128
+ key: '_updateElements',
129
+ value: function _updateElements() {
130
+ for (var elIndex in Pushpin._pushpins) {
131
+ var pInstance = Pushpin._pushpins[elIndex];
132
+ pInstance._updatePosition();
133
+ }
134
+ }
135
+ }, {
136
+ key: 'defaults',
137
+ get: function () {
138
+ return _defaults;
139
+ }
140
+ }]);
141
+
142
+ return Pushpin;
143
+ }();
144
+
145
+ /**
146
+ * @static
147
+ * @memberof Pushpin
148
+ */
149
+
150
+
151
+ Pushpin._pushpins = [];
152
+
153
+ M.Pushpin = Pushpin;
154
+
155
+ if (M.jQueryLoaded) {
156
+ M.initializeJqueryWrapper(Pushpin, 'pushpin', 'M_Pushpin');
157
+ }
158
+ })(cash);
@@ -0,0 +1,305 @@
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
+
3
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
+
5
+ (function ($, Vel) {
6
+ 'use strict';
7
+
8
+ var _defaults = {};
9
+
10
+ /**
11
+ * @class
12
+ *
13
+ */
14
+
15
+ var Range = function () {
16
+ /**
17
+ * Construct Range instance
18
+ * @constructor
19
+ * @param {Element} el
20
+ * @param {Object} options
21
+ */
22
+ function Range(el, options) {
23
+ _classCallCheck(this, Range);
24
+
25
+ // If exists, destroy and reinitialize
26
+ if (!!el.M_Range) {
27
+ el.M_Range.destroy();
28
+ }
29
+
30
+ this.el = el;
31
+ this.$el = $(el);
32
+ this.el.M_Range = this;
33
+
34
+ /**
35
+ * Options for the range
36
+ * @member Range#options
37
+ */
38
+ this.options = $.extend({}, Range.defaults, options);
39
+
40
+ this._mousedown = false;
41
+
42
+ // Setup
43
+ this._setupThumb();
44
+
45
+ this._setupEventHandlers();
46
+ }
47
+
48
+ _createClass(Range, [{
49
+ key: 'destroy',
50
+
51
+
52
+ /**
53
+ * Teardown component
54
+ */
55
+ value: function destroy() {
56
+ this._removeEventHandlers();
57
+ this._removeThumb();
58
+ this.el.M_Range = undefined;
59
+ }
60
+
61
+ /**
62
+ * Setup Event Handlers
63
+ */
64
+
65
+ }, {
66
+ key: '_setupEventHandlers',
67
+ value: function _setupEventHandlers() {
68
+ this._handleRangeChangeBound = this._handleRangeChange.bind(this);
69
+ this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this);
70
+ this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(this);
71
+ this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this);
72
+ this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(this);
73
+
74
+ this.el.addEventListener('change', this._handleRangeChangeBound);
75
+
76
+ this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
77
+ this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
78
+
79
+ this.el.addEventListener('input', this._handleRangeInputMousemoveTouchmoveBound);
80
+ this.el.addEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound);
81
+ this.el.addEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound);
82
+
83
+ this.el.addEventListener('mouseup', this._handleRangeMouseupTouchendBound);
84
+ this.el.addEventListener('touchend', this._handleRangeMouseupTouchendBound);
85
+
86
+ this.el.addEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound);
87
+ this.el.addEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound);
88
+ this.el.addEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound);
89
+ }
90
+
91
+ /**
92
+ * Remove Event Handlers
93
+ */
94
+
95
+ }, {
96
+ key: '_removeEventHandlers',
97
+ value: function _removeEventHandlers() {
98
+ this.el.removeEventListener('change', this._handleRangeChangeBound);
99
+
100
+ this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
101
+ this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
102
+
103
+ this.el.removeEventListener('input', this._handleRangeInputMousemoveTouchmoveBound);
104
+ this.el.removeEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound);
105
+ this.el.removeEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound);
106
+
107
+ this.el.removeEventListener('mouseup', this._handleRangeMouseupTouchendBound);
108
+ this.el.removeEventListener('touchend', this._handleRangeMouseupTouchendBound);
109
+
110
+ this.el.removeEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound);
111
+ this.el.removeEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound);
112
+ this.el.removeEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound);
113
+ }
114
+
115
+ /**
116
+ * Handle Range Change
117
+ * @param {Event} e
118
+ */
119
+
120
+ }, {
121
+ key: '_handleRangeChange',
122
+ value: function _handleRangeChange() {
123
+ $(this.value).html(this.$el.val());
124
+
125
+ if (!$(this.thumb).hasClass('active')) {
126
+ this._showRangeBubble();
127
+ }
128
+
129
+ var offsetLeft = this._calcRangeOffset();
130
+ $(this.thumb).addClass('active').css('left', offsetLeft + 'px');
131
+ }
132
+
133
+ /**
134
+ * Handle Range Mousedown and Touchstart
135
+ * @param {Event} e
136
+ */
137
+
138
+ }, {
139
+ key: '_handleRangeMousedownTouchstart',
140
+ value: function _handleRangeMousedownTouchstart(e) {
141
+ // Set indicator value
142
+ $(this.value).html(this.$el.val());
143
+
144
+ this._mousedown = true;
145
+ this.$el.addClass('active');
146
+
147
+ if (!$(this.thumb).hasClass('active')) {
148
+ this._showRangeBubble();
149
+ }
150
+
151
+ if (e.type !== 'input') {
152
+ var offsetLeft = this._calcRangeOffset();
153
+ $(this.thumb).addClass('active').css('left', offsetLeft + 'px');
154
+ }
155
+ }
156
+
157
+ /**
158
+ * Handle Range Input, Mousemove and Touchmove
159
+ */
160
+
161
+ }, {
162
+ key: '_handleRangeInputMousemoveTouchmove',
163
+ value: function _handleRangeInputMousemoveTouchmove() {
164
+ if (this._mousedown) {
165
+ if (!$(this.thumb).hasClass('active')) {
166
+ this._showRangeBubble();
167
+ }
168
+
169
+ var offsetLeft = this._calcRangeOffset();
170
+ $(this.thumb).addClass('active').css('left', offsetLeft + 'px');
171
+ $(this.value).html(this.$el.val());
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Handle Range Mouseup and Touchend
177
+ */
178
+
179
+ }, {
180
+ key: '_handleRangeMouseupTouchend',
181
+ value: function _handleRangeMouseupTouchend() {
182
+ this._mousedown = false;
183
+ this.$el.removeClass('active');
184
+ }
185
+
186
+ /**
187
+ * Handle Range Blur, Mouseout and Touchleave
188
+ */
189
+
190
+ }, {
191
+ key: '_handleRangeBlurMouseoutTouchleave',
192
+ value: function _handleRangeBlurMouseoutTouchleave() {
193
+ if (!this._mousedown) {
194
+ var paddingLeft = parseInt(this.$el.css('padding-left'));
195
+ var marginLeft = 7 + paddingLeft + 'px';
196
+
197
+ if ($(this.thumb).hasClass('active')) {
198
+ Vel(this.thumb, 'stop');
199
+ Vel(this.thumb, {
200
+ height: '0px',
201
+ width: '0px',
202
+ top: '10px',
203
+ marginLeft: marginLeft
204
+ }, { duration: 100 });
205
+ }
206
+ $(this.thumb).removeClass('active');
207
+ }
208
+ }
209
+
210
+ /**
211
+ * Setup dropdown
212
+ */
213
+
214
+ }, {
215
+ key: '_setupThumb',
216
+ value: function _setupThumb() {
217
+ this.thumb = document.createElement('span');
218
+ this.value = document.createElement('span');
219
+ $(this.thumb).addClass('thumb');
220
+ $(this.value).addClass('value');
221
+ $(this.thumb).append(this.value);
222
+ this.$el.after(this.thumb);
223
+ }
224
+
225
+ /**
226
+ * Remove dropdown
227
+ */
228
+
229
+ }, {
230
+ key: '_removeThumb',
231
+ value: function _removeThumb() {
232
+ $(this.thumb).remove();
233
+ }
234
+
235
+ /**
236
+ * morph thumb into bubble
237
+ */
238
+
239
+ }, {
240
+ key: '_showRangeBubble',
241
+ value: function _showRangeBubble() {
242
+ var paddingLeft = parseInt($(this.thumb).parent().css('padding-left'));
243
+ var marginLeft = -7 + paddingLeft + 'px'; // TODO: fix magic number?
244
+ Vel(this.thumb, {
245
+ height: "30px",
246
+ width: "30px",
247
+ top: "-30px",
248
+ marginLeft: marginLeft
249
+ }, { duration: 300, easing: 'easeOutExpo' });
250
+ }
251
+
252
+ /**
253
+ * Calculate the offset of the thumb
254
+ * @return {Number} offset in pixels
255
+ */
256
+
257
+ }, {
258
+ key: '_calcRangeOffset',
259
+ value: function _calcRangeOffset() {
260
+ var width = this.$el.width() - 15;
261
+ var max = parseFloat(this.$el.attr('max'));
262
+ var min = parseFloat(this.$el.attr('min'));
263
+ var percent = (parseFloat(this.$el.val()) - min) / (max - min);
264
+ return percent * width;
265
+ }
266
+ }], [{
267
+ key: 'init',
268
+ value: function init($els, options) {
269
+ var arr = [];
270
+ $els.each(function () {
271
+ if (!$(this).hasClass('browser-default')) {
272
+ arr.push(new Range(this, options));
273
+ }
274
+ });
275
+ return arr;
276
+ }
277
+
278
+ /**
279
+ * Get Instance
280
+ */
281
+
282
+ }, {
283
+ key: 'getInstance',
284
+ value: function getInstance(el) {
285
+ var domElem = !!el.jquery ? el[0] : el;
286
+ return domElem.M_Range;
287
+ }
288
+ }, {
289
+ key: 'defaults',
290
+ get: function () {
291
+ return _defaults;
292
+ }
293
+ }]);
294
+
295
+ return Range;
296
+ }();
297
+
298
+ M.Range = Range;
299
+
300
+ if (M.jQueryLoaded) {
301
+ M.initializeJqueryWrapper(Range, 'range', 'M_Range');
302
+ }
303
+
304
+ Range.init($('input[type=range'));
305
+ })(cash, M.Vel);