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,347 @@
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
+ /**
11
+ * @class
12
+ *
13
+ */
14
+
15
+ var FeatureDiscovery = function () {
16
+ /**
17
+ * Construct FeatureDiscovery instance
18
+ * @constructor
19
+ * @param {Element} el
20
+ * @param {Object} options
21
+ */
22
+ function FeatureDiscovery(el, options) {
23
+ _classCallCheck(this, FeatureDiscovery);
24
+
25
+ // If exists, destroy and reinitialize
26
+ if (!!el.M_FeatureDiscovery) {
27
+ el.M_FeatureDiscovery.destroy();
28
+ }
29
+
30
+ this.el = el;
31
+ this.$el = $(el);
32
+ this.el.M_FeatureDiscovery = this;
33
+
34
+ /**
35
+ * Options for the select
36
+ * @member FeatureDiscovery#options
37
+ */
38
+ this.options = $.extend({}, FeatureDiscovery.defaults, options);
39
+
40
+ this.isOpen = false;
41
+
42
+ // setup
43
+ this.$origin = $('#' + this.$el.attr('data-target'));
44
+ this._setup();
45
+
46
+ this._calculatePositioning();
47
+ this._setupEventHandlers();
48
+ }
49
+
50
+ _createClass(FeatureDiscovery, [{
51
+ key: 'destroy',
52
+
53
+
54
+ /**
55
+ * Teardown component
56
+ */
57
+ value: function destroy() {
58
+ this._removeEventHandlers();
59
+ this.el.FeatureDiscovery = undefined;
60
+ }
61
+
62
+ /**
63
+ * Setup Event Handlers
64
+ */
65
+
66
+ }, {
67
+ key: '_setupEventHandlers',
68
+ value: function _setupEventHandlers() {
69
+ this._handleDocumentClickBound = this._handleDocumentClick.bind(this);
70
+ this._handleTargetClickBound = this._handleTargetClick.bind(this);
71
+ this._handleOriginClickBound = this._handleOriginClick.bind(this);
72
+
73
+ this.el.addEventListener('click', this._handleTargetClickBound);
74
+ this.originEl.addEventListener('click', this._handleOriginClickBound);
75
+
76
+ // Resize
77
+ var throttledResize = M.throttle(this._handleResize, 200);
78
+ this._handleThrottledResizeBound = throttledResize.bind(this);
79
+
80
+ window.addEventListener('resize', this._handleThrottledResizeBound);
81
+ }
82
+
83
+ /**
84
+ * Remove Event Handlers
85
+ */
86
+
87
+ }, {
88
+ key: '_removeEventHandlers',
89
+ value: function _removeEventHandlers() {
90
+ this.el.removeEventListener('click', this._handleTargetClickBound);
91
+ this.originEl.removeEventListener('click', this._handleOriginClickBound);
92
+ window.removeEventListener('resize', this._handleThrottledResizeBound);
93
+ }
94
+
95
+ /**
96
+ * Handle Target Click
97
+ * @param {Event} e
98
+ */
99
+
100
+ }, {
101
+ key: '_handleTargetClick',
102
+ value: function _handleTargetClick(e) {
103
+ this.open();
104
+ }
105
+
106
+ /**
107
+ * Handle Origin Click
108
+ * @param {Event} e
109
+ */
110
+
111
+ }, {
112
+ key: '_handleOriginClick',
113
+ value: function _handleOriginClick(e) {
114
+ this.close();
115
+ }
116
+
117
+ /**
118
+ * Handle Resize
119
+ * @param {Event} e
120
+ */
121
+
122
+ }, {
123
+ key: '_handleResize',
124
+ value: function _handleResize(e) {
125
+ this._calculatePositioning();
126
+ }
127
+
128
+ /**
129
+ * Handle Resize
130
+ * @param {Event} e
131
+ */
132
+
133
+ }, {
134
+ key: '_handleDocumentClick',
135
+ value: function _handleDocumentClick(e) {
136
+ if (!$(e.target).closest('.tap-target-wrapper').length) {
137
+ this.close();
138
+ e.preventDefault();
139
+ e.stopPropagation();
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Setup feature discovery
145
+ */
146
+
147
+ }, {
148
+ key: '_setup',
149
+ value: function _setup() {
150
+ // Creating tap target
151
+ this.wrapper = this.$el.parent()[0];
152
+ this.waveEl = $(this.wrapper).find('.tap-target-wave')[0];
153
+ this.originEl = $(this.wrapper).find('.tap-target-origin')[0];
154
+ this.contentEl = this.$el.find('.tap-target-content')[0];
155
+
156
+ // Creating wrapper
157
+ if (!$(this.wrapper).hasClass('.tap-target-wrapper')) {
158
+ this.wrapper = document.createElement('div');
159
+ this.wrapper.classList.add('tap-target-wrapper');
160
+ this.$el.before($(this.wrapper));
161
+ this.wrapper.append(this.el);
162
+ }
163
+
164
+ // Creating content
165
+ if (!this.contentEl) {
166
+ this.contentEl = document.createElement('div');
167
+ this.contentEl.classList.add('tap-target-content');
168
+ this.$el.append(this.contentEl);
169
+ }
170
+
171
+ // Creating foreground wave
172
+ if (!this.waveEl) {
173
+ this.waveEl = document.createElement('div');
174
+ this.waveEl.classList.add('tap-target-wave');
175
+
176
+ // Creating origin
177
+ if (!this.originEl) {
178
+ this.originEl = this.$origin.clone(true, true);
179
+ this.originEl.addClass('tap-target-origin');
180
+ this.originEl.removeAttr('id');
181
+ this.originEl.removeAttr('style');
182
+ this.originEl = this.originEl[0];
183
+ this.waveEl.append(this.originEl);
184
+ }
185
+
186
+ this.wrapper.append(this.waveEl);
187
+ }
188
+ }
189
+
190
+ /**
191
+ * Calculate positioning
192
+ */
193
+
194
+ }, {
195
+ key: '_calculatePositioning',
196
+ value: function _calculatePositioning() {
197
+ // Element or parent is fixed position?
198
+ var isFixed = this.$origin.css('position') === 'fixed';
199
+ if (!isFixed) {
200
+ var parents = this.$origin.parents();
201
+ for (var i = 0; i < parents.length; i++) {
202
+ isFixed = $(parents[i]).css('position') == 'fixed';
203
+ if (isFixed) {
204
+ break;
205
+ }
206
+ }
207
+ }
208
+
209
+ // Calculating origin
210
+ var originWidth = this.$origin.outerWidth();
211
+ var originHeight = this.$origin.outerHeight();
212
+ var originTop = isFixed ? this.$origin.offset().top - M.getDocumentScrollTop() : this.$origin.offset().top;
213
+ var originLeft = isFixed ? this.$origin.offset().left - M.getDocumentScrollLeft() : this.$origin.offset().left;
214
+
215
+ // Calculating screen
216
+ var windowWidth = window.innerWidth;
217
+ var windowHeight = window.innerHeight;
218
+ var centerX = windowWidth / 2;
219
+ var centerY = windowHeight / 2;
220
+ var isLeft = originLeft <= centerX;
221
+ var isRight = originLeft > centerX;
222
+ var isTop = originTop <= centerY;
223
+ var isBottom = originTop > centerY;
224
+ var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75;
225
+
226
+ // Calculating tap target
227
+ var tapTargetWidth = this.$el.outerWidth();
228
+ var tapTargetHeight = this.$el.outerHeight();
229
+ var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2;
230
+ var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2;
231
+ var tapTargetPosition = isFixed ? 'fixed' : 'absolute';
232
+
233
+ // Calculating content
234
+ var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth;
235
+ var tapTargetTextHeight = tapTargetHeight / 2;
236
+ var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0;
237
+ var tapTargetTextBottom = 0;
238
+ var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0;
239
+ var tapTargetTextRight = 0;
240
+ var tapTargetTextPadding = originWidth;
241
+ var tapTargetTextAlign = isBottom ? 'bottom' : 'top';
242
+
243
+ // Calculating wave
244
+ var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2;
245
+ var tapTargetWaveHeight = tapTargetWaveWidth;
246
+ var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2;
247
+ var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2;
248
+
249
+ // Setting tap target
250
+ var tapTargetWrapperCssObj = {};
251
+ tapTargetWrapperCssObj.top = isTop ? tapTargetTop + 'px' : '';
252
+ tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth + 'px' : '';
253
+ tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight + 'px' : '';
254
+ tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft + 'px' : '';
255
+ tapTargetWrapperCssObj.position = tapTargetPosition;
256
+ $(this.wrapper).css(tapTargetWrapperCssObj);
257
+
258
+ // Setting content
259
+ $(this.contentEl).css({
260
+ width: tapTargetTextWidth + 'px',
261
+ height: tapTargetTextHeight + 'px',
262
+ top: tapTargetTextTop + 'px',
263
+ right: tapTargetTextRight + 'px',
264
+ bottom: tapTargetTextBottom + 'px',
265
+ left: tapTargetTextLeft + 'px',
266
+ padding: tapTargetTextPadding + 'px',
267
+ verticalAlign: tapTargetTextAlign
268
+ });
269
+
270
+ // Setting wave
271
+ $(this.waveEl).css({
272
+ top: tapTargetWaveTop + 'px',
273
+ left: tapTargetWaveLeft + 'px',
274
+ width: tapTargetWaveWidth + 'px',
275
+ height: tapTargetWaveHeight + 'px'
276
+ });
277
+ }
278
+
279
+ /**
280
+ * Open Feature Discovery
281
+ */
282
+
283
+ }, {
284
+ key: 'open',
285
+ value: function open() {
286
+ if (this.isOpen) {
287
+ return;
288
+ }
289
+
290
+ this.isOpen = true;
291
+ this.wrapper.classList.add('open');
292
+
293
+ document.body.addEventListener('click', this._handleDocumentClickBound, true);
294
+ }
295
+
296
+ /**
297
+ * Close Feature Discovery
298
+ */
299
+
300
+ }, {
301
+ key: 'close',
302
+ value: function close() {
303
+ if (!this.isOpen) {
304
+ return;
305
+ }
306
+
307
+ this.isOpen = false;
308
+ this.wrapper.classList.remove('open');
309
+
310
+ document.body.removeEventListener('click', this._handleDocumentClickBound, true);
311
+ }
312
+ }], [{
313
+ key: 'init',
314
+ value: function init($els, options) {
315
+ var arr = [];
316
+ $els.each(function () {
317
+ arr.push(new FeatureDiscovery(this, options));
318
+ });
319
+ return arr;
320
+ }
321
+
322
+ /**
323
+ * Get Instance
324
+ */
325
+
326
+ }, {
327
+ key: 'getInstance',
328
+ value: function getInstance(el) {
329
+ var domElem = !!el.jquery ? el[0] : el;
330
+ return domElem.M_FeatureDiscovery;
331
+ }
332
+ }, {
333
+ key: 'defaults',
334
+ get: function () {
335
+ return _defaults;
336
+ }
337
+ }]);
338
+
339
+ return FeatureDiscovery;
340
+ }();
341
+
342
+ M.FeatureDiscovery = FeatureDiscovery;
343
+
344
+ if (M.jQueryLoaded) {
345
+ M.initializeJqueryWrapper(FeatureDiscovery, 'featureDiscovery', 'M_FeatureDiscovery');
346
+ }
347
+ })(cash);
@@ -0,0 +1,616 @@
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
+ dialRadius: 135,
10
+ outerRadius: 105,
11
+ innerRadius: 70,
12
+ tickRadius: 20,
13
+ duration: 350,
14
+ container: null,
15
+ defaultTime: 'now', // default time, 'now' or '13:14' e.g.
16
+ fromnow: 0, // Millisecond offset from the defaultTime
17
+ doneText: 'Ok', // done button text
18
+ clearText: 'Clear',
19
+ cancelText: 'Cancel',
20
+ autoClose: false, // auto close when minute is selected
21
+ twelveHour: true, // change to 12 hour AM/PM clock from 24 hour
22
+ vibrate: true // vibrate the device when dragging clock hand
23
+ };
24
+
25
+ /**
26
+ * @class
27
+ *
28
+ */
29
+
30
+ var Timepicker = function () {
31
+ function Timepicker(el, options) {
32
+ _classCallCheck(this, Timepicker);
33
+
34
+ // If exists, destroy and reinitialize
35
+ if (!!el.M_Timepicker) {
36
+ el.M_Timepicker.destroy();
37
+ }
38
+
39
+ this.el = el;
40
+ this.$el = $(el);
41
+ this.el.M_Timepicker = this;
42
+
43
+ this.options = $.extend({}, Timepicker.defaults, options);
44
+
45
+ this.id = M.guid();
46
+ this._insertHTMLIntoDOM();
47
+ this._setupModal();
48
+ this._setupVariables();
49
+ this._setupEventHandlers();
50
+
51
+ this._clockSetup();
52
+ this._pickerSetup();
53
+ }
54
+
55
+ _createClass(Timepicker, [{
56
+ key: 'destroy',
57
+
58
+
59
+ /**
60
+ * Teardown component
61
+ */
62
+ value: function destroy() {
63
+ this._removeEventHandlers();
64
+ this.modal.destroy();
65
+ $(this.modalEl).remove();
66
+ this.el.M_Timepicker = undefined;
67
+ }
68
+
69
+ /**
70
+ * Setup Event Handlers
71
+ */
72
+
73
+ }, {
74
+ key: '_setupEventHandlers',
75
+ value: function _setupEventHandlers() {
76
+ this._handleInputKeydownBound = this._handleInputKeydown.bind(this);
77
+ this._handleInputClickBound = this._handleInputClick.bind(this);
78
+ this._handleClockClickStartBound = this._handleClockClickStart.bind(this);
79
+ this._handleDocumentClickMoveBound = this._handleDocumentClickMove.bind(this);
80
+ this._handleDocumentClickEndBound = this._handleDocumentClickEnd.bind(this);
81
+
82
+ this.el.addEventListener('click', this._handleInputClickBound);
83
+ this.el.addEventListener('keydown', this._handleInputKeydownBound);
84
+ this.plate.addEventListener('mousedown', this._handleClockClickStartBound);
85
+ this.plate.addEventListener('touchstart', this._handleClockClickStartBound);
86
+
87
+ $(this.spanHours).on('click', this.showView.bind(this, 'hours'));
88
+ $(this.spanMinutes).on('click', this.showView.bind(this, 'minutes'));
89
+ }
90
+ }, {
91
+ key: '_removeEventHandlers',
92
+ value: function _removeEventHandlers() {
93
+ this.el.removeEventListener('click', this._handleInputClickBound);
94
+ this.el.removeEventListener('keydown', this._handleInputKeydownBound);
95
+ }
96
+ }, {
97
+ key: '_handleInputClick',
98
+ value: function _handleInputClick() {
99
+ this.open();
100
+ }
101
+ }, {
102
+ key: '_handleInputKeydown',
103
+ value: function _handleInputKeydown(e) {
104
+ if (e.which === M.keys.ENTER) {
105
+ e.preventDefault();
106
+ this.open();
107
+ }
108
+ }
109
+ }, {
110
+ key: '_handleClockClickStart',
111
+ value: function _handleClockClickStart(e) {
112
+ e.preventDefault();
113
+ var clockPlateBR = this.plate.getBoundingClientRect();
114
+ var offset = { x: clockPlateBR.left, y: clockPlateBR.top };
115
+
116
+ this.x0 = offset.x + this.options.dialRadius;
117
+ this.y0 = offset.y + this.options.dialRadius;
118
+ this.moved = false;
119
+ var clickPos = Timepicker._Pos(e);
120
+ this.dx = clickPos.x - this.x0;
121
+ this.dy = clickPos.y - this.y0;
122
+
123
+ // Set clock hands
124
+ this.setHand(this.dx, this.dy, false);
125
+
126
+ // Mousemove on document
127
+ document.addEventListener('mousemove', this._handleDocumentClickMoveBound);
128
+ document.addEventListener('touchmove', this._handleDocumentClickMoveBound);
129
+
130
+ // Mouseup on document
131
+ document.addEventListener('mouseup', this._handleDocumentClickEndBound);
132
+ document.addEventListener('touchend', this._handleDocumentClickEndBound);
133
+ }
134
+ }, {
135
+ key: '_handleDocumentClickMove',
136
+ value: function _handleDocumentClickMove(e) {
137
+ e.preventDefault();
138
+ var clickPos = Timepicker._Pos(e);
139
+ var x = clickPos.x - this.x0;
140
+ var y = clickPos.y - this.y0;
141
+ this.moved = true;
142
+ this.setHand(x, y, false, true);
143
+ }
144
+ }, {
145
+ key: '_handleDocumentClickEnd',
146
+ value: function _handleDocumentClickEnd(e) {
147
+ e.preventDefault();
148
+ document.removeEventListener('mouseup', this._handleDocumentClickEndBound);
149
+ document.removeEventListener('touchend', this._handleDocumentClickEndBound);
150
+ var clickPos = Timepicker._Pos(e);
151
+ var x = clickPos.x - this.x0;
152
+ var y = clickPos.y - this.y0;
153
+ if (this.moved && x === this.dx && y === this.dy) {
154
+ this.setHand(x, y);
155
+ }
156
+
157
+ if (this.currentView === 'hours') {
158
+ this.showView('minutes', this.options.duration / 2);
159
+ } else if (this.options.autoClose) {
160
+ this.minutesView.addClass('timepicker-dial-out');
161
+ setTimeout(function () {
162
+ this.done();
163
+ }, this.options.duration / 2);
164
+ }
165
+
166
+ // Unbind mousemove event
167
+ document.removeEventListener('mousemove', this._handleDocumentClickMoveBound);
168
+ document.removeEventListener('touchmove', this._handleDocumentClickMoveBound);
169
+ }
170
+ }, {
171
+ key: '_insertHTMLIntoDOM',
172
+ value: function _insertHTMLIntoDOM() {
173
+ this.$modalEl = $(Timepicker._template);
174
+ this.modalEl = this.$modalEl[0];
175
+ this.modalEl.id = 'modal-' + this.id;
176
+
177
+ // Append popover to input by default
178
+ var containerEl = document.querySelector(this.options.container);
179
+ if (this.options.container && !!containerEl) {
180
+ this.$modalEl.appendTo(containerEl);
181
+ } else {
182
+ this.$modalEl.insertBefore(this.el);
183
+ }
184
+ }
185
+ }, {
186
+ key: '_setupModal',
187
+ value: function _setupModal() {
188
+ var _this = this;
189
+
190
+ this.modal = new M.Modal(this.modalEl, {
191
+ complete: function () {
192
+ _this.isOpen = false;
193
+ }
194
+ });
195
+ }
196
+ }, {
197
+ key: '_setupVariables',
198
+ value: function _setupVariables() {
199
+ this.currentView = 'hours';
200
+ this.vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null;
201
+
202
+ this._canvas = this.modalEl.querySelector('.timepicker-canvas');
203
+ this.plate = this.modalEl.querySelector('.timepicker-plate');
204
+
205
+ this.hoursView = this.modalEl.querySelector('.timepicker-hours');
206
+ this.minutesView = this.modalEl.querySelector('.timepicker-minutes');
207
+ this.spanHours = this.modalEl.querySelector('.timepicker-span-hours');
208
+ this.spanMinutes = this.modalEl.querySelector('.timepicker-span-minutes');
209
+ this.spanAmPm = this.modalEl.querySelector('.timepicker-span-am-pm');
210
+ this.footer = this.modalEl.querySelector('.timepicker-footer');
211
+ this.amOrPm = 'PM';
212
+ }
213
+ }, {
214
+ key: '_pickerSetup',
215
+ value: function _pickerSetup() {
216
+ $('<button class="btn-flat timepicker-clear waves-effect" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.clearText + '</button>').appendTo(this.footer).on('click', this.clear.bind(this));
217
+
218
+ var confirmationBtnsContainer = $('<div class="confirmation-btns"></div>');
219
+ $('<button class="btn-flat timepicker-close waves-effect" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.cancelText + '</button>').appendTo(confirmationBtnsContainer).on('click', this.close.bind(this));
220
+ $('<button class="btn-flat timepicker-close waves-effect" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.doneText + '</button>').appendTo(confirmationBtnsContainer).on('click', this.done.bind(this));
221
+ confirmationBtnsContainer.appendTo(this.footer);
222
+ }
223
+ }, {
224
+ key: '_clockSetup',
225
+ value: function _clockSetup() {
226
+ if (this.options.twelveHour) {
227
+ this.$amBtn = $('<div class="am-btn">AM</div>');
228
+ this.$pmBtn = $('<div class="pm-btn">PM</div>');
229
+ this.$amBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm);
230
+ this.$pmBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm);
231
+ }
232
+
233
+ this._buildHoursView();
234
+ this._buildMinutesView();
235
+ this._buildSVGClock();
236
+ }
237
+ }, {
238
+ key: '_buildSVGClock',
239
+ value: function _buildSVGClock() {
240
+ // Draw clock hands and others
241
+ var dialRadius = this.options.dialRadius;
242
+ var tickRadius = this.options.tickRadius;
243
+ var diameter = dialRadius * 2;
244
+
245
+ var svg = Timepicker._createSVGEl('svg');
246
+ svg.setAttribute('class', 'timepicker-svg');
247
+ svg.setAttribute('width', diameter);
248
+ svg.setAttribute('height', diameter);
249
+ var g = Timepicker._createSVGEl('g');
250
+ g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')');
251
+ var bearing = Timepicker._createSVGEl('circle');
252
+ bearing.setAttribute('class', 'timepicker-canvas-bearing');
253
+ bearing.setAttribute('cx', 0);
254
+ bearing.setAttribute('cy', 0);
255
+ bearing.setAttribute('r', 4);
256
+ var hand = Timepicker._createSVGEl('line');
257
+ hand.setAttribute('x1', 0);
258
+ hand.setAttribute('y1', 0);
259
+ var bg = Timepicker._createSVGEl('circle');
260
+ bg.setAttribute('class', 'timepicker-canvas-bg');
261
+ bg.setAttribute('r', tickRadius);
262
+ g.appendChild(hand);
263
+ g.appendChild(bg);
264
+ g.appendChild(bearing);
265
+ svg.appendChild(g);
266
+ this._canvas.appendChild(svg);
267
+
268
+ this.hand = hand;
269
+ this.bg = bg;
270
+ this.bearing = bearing;
271
+ this.g = g;
272
+ }
273
+ }, {
274
+ key: '_buildHoursView',
275
+ value: function _buildHoursView() {
276
+ var $tick = $('<div class="timepicker-tick"></div>');
277
+ // Hours view
278
+ if (this.options.twelveHour) {
279
+ for (var i = 1; i < 13; i += 1) {
280
+ var tick = $tick.clone();
281
+ var radian = i / 6 * Math.PI;
282
+ var radius = this.options.outerRadius;
283
+ tick.css({
284
+ left: this.options.dialRadius + Math.sin(radian) * radius - this.options.tickRadius + 'px',
285
+ top: this.options.dialRadius - Math.cos(radian) * radius - this.options.tickRadius + 'px'
286
+ });
287
+ tick.html(i === 0 ? '00' : i);
288
+ this.hoursView.appendChild(tick[0]);
289
+ // tick.on(mousedownEvent, mousedown);
290
+ }
291
+ } else {
292
+ for (var _i = 0; _i < 24; _i += 1) {
293
+ var _tick = $tick.clone();
294
+ var _radian = _i / 6 * Math.PI;
295
+ var inner = _i > 0 && _i < 13;
296
+ var _radius = inner ? this.options.innerRadius : this.options.outerRadius;
297
+ _tick.css({
298
+ left: this.options.dialRadius + Math.sin(_radian) * _radius - this.options.tickRadius + 'px',
299
+ top: this.options.dialRadius - Math.cos(_radian) * _radius - this.options.tickRadius + 'px'
300
+ });
301
+ _tick.html(_i === 0 ? '00' : _i);
302
+ this.hoursView.appendChild(_tick[0]);
303
+ // tick.on(mousedownEvent, mousedown);
304
+ }
305
+ }
306
+ }
307
+ }, {
308
+ key: '_buildMinutesView',
309
+ value: function _buildMinutesView() {
310
+ var $tick = $('<div class="timepicker-tick"></div>');
311
+ // Minutes view
312
+ for (var i = 0; i < 60; i += 5) {
313
+ var tick = $tick.clone();
314
+ var radian = i / 30 * Math.PI;
315
+ tick.css({
316
+ left: this.options.dialRadius + Math.sin(radian) * this.options.outerRadius - this.options.tickRadius + 'px',
317
+ top: this.options.dialRadius - Math.cos(radian) * this.options.outerRadius - this.options.tickRadius + 'px'
318
+ });
319
+ tick.html(Timepicker._addLeadingZero(i));
320
+ this.minutesView.appendChild(tick[0]);
321
+ }
322
+ }
323
+ }, {
324
+ key: '_handleAmPmClick',
325
+ value: function _handleAmPmClick(e) {
326
+ var $btnClicked = $(e.target);
327
+ this.amOrPm = $btnClicked.hasClass('am-btn') ? 'AM' : 'PM';
328
+ this._updateAmPmView();
329
+ }
330
+ }, {
331
+ key: '_updateAmPmView',
332
+ value: function _updateAmPmView() {
333
+ this.$amBtn.toggleClass('text-primary', this.amOrPm === 'AM');
334
+ this.$pmBtn.toggleClass('text-primary', this.amOrPm === 'PM');
335
+ }
336
+ }, {
337
+ key: '_updateTimeFromInput',
338
+ value: function _updateTimeFromInput() {
339
+ // Get the time
340
+ var value = ((this.el.value || this.options.defaultTime || '') + '').split(':');
341
+ if (this.options.twelveHour && !(typeof value[1] === 'undefined')) {
342
+ if (value[1].indexOf("AM") > 0) {
343
+ this.amOrPm = 'AM';
344
+ } else {
345
+ this.amOrPm = 'PM';
346
+ }
347
+ value[1] = value[1].replace("AM", "").replace("PM", "");
348
+ }
349
+ if (value[0] === 'now') {
350
+ var now = new Date(+new Date() + this.options.fromnow);
351
+ value = [now.getHours(), now.getMinutes()];
352
+ if (this.options.twelveHour) {
353
+ this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM';
354
+ }
355
+ }
356
+ this.hours = +value[0] || 0;
357
+ this.minutes = +value[1] || 0;
358
+ this.spanHours.innerHTML = this.hours;
359
+ this.spanMinutes.innerHTML = Timepicker._addLeadingZero(this.minutes);
360
+
361
+ this._updateAmPmView();
362
+ }
363
+ }, {
364
+ key: 'showView',
365
+ value: function showView(view, delay) {
366
+ if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
367
+ // raiseCallback(this.options.beforeHourSelect);
368
+ }
369
+ var isHours = view === 'hours',
370
+ nextView = isHours ? this.hoursView : this.minutesView,
371
+ hideView = isHours ? this.minutesView : this.hoursView;
372
+ this.currentView = view;
373
+
374
+ $(this.spanHours).toggleClass('text-primary', isHours);
375
+ $(this.spanMinutes).toggleClass('text-primary', !isHours);
376
+
377
+ // Transition view
378
+ hideView.classList.add('timepicker-dial-out');
379
+ $(nextView).css('visibility', 'visible').removeClass('timepicker-dial-out');
380
+
381
+ // Reset clock hand
382
+ this.resetClock(delay);
383
+
384
+ // After transitions ended
385
+ clearTimeout(this.toggleViewTimer);
386
+ this.toggleViewTimer = setTimeout(function () {
387
+ $(hideView).css('visibility', 'hidden');
388
+ }, this.options.duration);
389
+ }
390
+ }, {
391
+ key: 'resetClock',
392
+ value: function resetClock(delay) {
393
+ var view = this.currentView,
394
+ value = this[view],
395
+ isHours = view === 'hours',
396
+ unit = Math.PI / (isHours ? 6 : 30),
397
+ radian = value * unit,
398
+ radius = isHours && value > 0 && value < 13 ? this.options.innerRadius : this.options.outerRadius,
399
+ x = Math.sin(radian) * radius,
400
+ y = -Math.cos(radian) * radius,
401
+ self = this;
402
+
403
+ if (delay) {
404
+ $(this.canvas).addClass('timepicker-canvas-out');
405
+ setTimeout(function () {
406
+ $(self.canvas).removeClass('timepicker-canvas-out');
407
+ self.setHand(x, y);
408
+ }, delay);
409
+ } else {
410
+ this.setHand(x, y);
411
+ }
412
+ }
413
+ }, {
414
+ key: 'setHand',
415
+ value: function setHand(x, y, roundBy5) {
416
+ var _this2 = this;
417
+
418
+ var radian = Math.atan2(x, -y),
419
+ isHours = this.currentView === 'hours',
420
+ unit = Math.PI / (isHours || roundBy5 ? 6 : 30),
421
+ z = Math.sqrt(x * x + y * y),
422
+ inner = isHours && z < (this.options.outerRadius + this.options.innerRadius) / 2,
423
+ radius = inner ? this.options.innerRadius : this.options.outerRadius;
424
+
425
+ if (this.options.twelveHour) {
426
+ radius = this.options.outerRadius;
427
+ }
428
+
429
+ // Radian should in range [0, 2PI]
430
+ if (radian < 0) {
431
+ radian = Math.PI * 2 + radian;
432
+ }
433
+
434
+ // Get the round value
435
+ var value = Math.round(radian / unit);
436
+
437
+ // Get the round radian
438
+ radian = value * unit;
439
+
440
+ // Correct the hours or minutes
441
+ if (this.options.twelveHour) {
442
+ if (isHours) {
443
+ if (value === 0) value = 12;
444
+ } else {
445
+ if (roundBy5) value *= 5;
446
+ if (value === 60) value = 0;
447
+ }
448
+ } else {
449
+ if (isHours) {
450
+ if (value === 12) {
451
+ value = 0;
452
+ }
453
+ value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12;
454
+ } else {
455
+ if (roundBy5) {
456
+ value *= 5;
457
+ }
458
+ if (value === 60) {
459
+ value = 0;
460
+ }
461
+ }
462
+ }
463
+
464
+ // Once hours or minutes changed, vibrate the device
465
+ if (this[this.currentView] !== value) {
466
+ if (this.vibrate && this.options.vibrate) {
467
+ // Do not vibrate too frequently
468
+ if (!this.vibrateTimer) {
469
+ navigator[this.vibrate](10);
470
+ this.vibrateTimer = setTimeout(function () {
471
+ _this2.vibrateTimer = null;
472
+ }, 100);
473
+ }
474
+ }
475
+ }
476
+
477
+ this[this.currentView] = value;
478
+ if (isHours) {
479
+ this['spanHours'].innerHTML = value;
480
+ } else {
481
+ this['spanMinutes'].innerHTML = Timepicker._addLeadingZero(value);
482
+ }
483
+
484
+ // Set clock hand and others' position
485
+ var cx1 = Math.sin(radian) * (radius - this.options.tickRadius),
486
+ cy1 = -Math.cos(radian) * (radius - this.options.tickRadius),
487
+ cx2 = Math.sin(radian) * radius,
488
+ cy2 = -Math.cos(radian) * radius;
489
+ this.hand.setAttribute('x2', cx1);
490
+ this.hand.setAttribute('y2', cy1);
491
+ this.bg.setAttribute('cx', cx2);
492
+ this.bg.setAttribute('cy', cy2);
493
+ }
494
+ }, {
495
+ key: 'open',
496
+ value: function open() {
497
+ if (this.isOpen) {
498
+ return;
499
+ }
500
+
501
+ this.isOpen = true;
502
+ this._updateTimeFromInput();
503
+ this.showView('hours');
504
+ this.modal.open();
505
+ }
506
+ }, {
507
+ key: 'close',
508
+ value: function close() {
509
+ if (!this.isOpen) {
510
+ return;
511
+ }
512
+
513
+ this.isOpen = false;
514
+ this.modal.close();
515
+ }
516
+
517
+ /**
518
+ * Finish timepicker selection.
519
+ */
520
+
521
+ }, {
522
+ key: 'done',
523
+ value: function done(e, clearValue) {
524
+ // Set input value
525
+ var last = this.el.value;
526
+ var value = clearValue ? '' : Timepicker._addLeadingZero(this.hours) + ':' + Timepicker._addLeadingZero(this.minutes);
527
+ this.time = value;
528
+ if (!clearValue && this.options.twelveHour) {
529
+ value = value + ' ' + this.amOrPm;
530
+ }
531
+ this.el.value = value;
532
+
533
+ // Trigger change event
534
+ if (value !== last) {
535
+ this.$el.trigger('change');
536
+ }
537
+
538
+ this.close();
539
+ this.el.focus();
540
+ }
541
+ }, {
542
+ key: 'clear',
543
+ value: function clear() {
544
+ this.done(null, true);
545
+ }
546
+ }], [{
547
+ key: 'init',
548
+ value: function init($els, options) {
549
+ var arr = [];
550
+ $els.each(function () {
551
+ arr.push(new Timepicker(this, options));
552
+ });
553
+ return arr;
554
+ }
555
+ }, {
556
+ key: '_addLeadingZero',
557
+ value: function _addLeadingZero(num) {
558
+ return (num < 10 ? '0' : '') + num;
559
+ }
560
+ }, {
561
+ key: '_createSVGEl',
562
+ value: function _createSVGEl(name) {
563
+ var svgNS = 'http://www.w3.org/2000/svg';
564
+ return document.createElementNS(svgNS, name);
565
+ }
566
+
567
+ /**
568
+ * @typedef {Object} Point
569
+ * @property {number} x The X Coordinate
570
+ * @property {number} y The Y Coordinate
571
+ */
572
+
573
+ /**
574
+ * Get x position of mouse or touch event
575
+ * @param {Event} e
576
+ * @return {Point} x and y location
577
+ */
578
+
579
+ }, {
580
+ key: '_Pos',
581
+ value: function _Pos(e) {
582
+ if (e.targetTouches && e.targetTouches.length >= 1) {
583
+ return { x: e.targetTouches[0].clientX, y: e.targetTouches[0].clientY };
584
+ }
585
+ // mouse event
586
+ return { x: e.clientX, y: e.clientY };
587
+ }
588
+
589
+ /**
590
+ * Get Instance
591
+ */
592
+
593
+ }, {
594
+ key: 'getInstance',
595
+ value: function getInstance(el) {
596
+ var domElem = !!el.jquery ? el[0] : el;
597
+ return domElem.M_Timepicker;
598
+ }
599
+ }, {
600
+ key: 'defaults',
601
+ get: function () {
602
+ return _defaults;
603
+ }
604
+ }]);
605
+
606
+ return Timepicker;
607
+ }();
608
+
609
+ Timepicker._template = ['<div class= "modal timepicker-modal">', '<div class="modal-content timepicker-container">', '<div class="timepicker-digital-display">', '<div class="timepicker-text-container">', '<div class="timepicker-display-column">', '<span class="timepicker-span-hours text-primary"></span>', ':', '<span class="timepicker-span-minutes"></span>', '</div>', '<div class="timepicker-display-column timepicker-display-am-pm">', '<div class="timepicker-span-am-pm"></div>', '</div>', '</div>', '</div>', '<div class="timepicker-analog-display">', '<div class="timepicker-plate">', '<div class="timepicker-canvas"></div>', '<div class="timepicker-dial timepicker-hours"></div>', '<div class="timepicker-dial timepicker-minutes timepicker-dial-out"></div>', '</div>', '<div class="timepicker-footer"></div>', '</div>', '</div>', '</div>'].join('');
610
+
611
+ M.Timepicker = Timepicker;
612
+
613
+ if (M.jQueryLoaded) {
614
+ M.initializeJqueryWrapper(Timepicker, 'timepicker', 'M_Timepicker');
615
+ }
616
+ })(cash, M.Vel);