materialize-sass 0.97.0 → 1.0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitattributes +1 -0
- data/.gitignore +3 -0
- data/README.md +48 -10
- data/Rakefile +129 -1
- data/assets/javascripts/materialize/anime.min.js +417 -0
- data/assets/javascripts/materialize/autocomplete.js +504 -0
- data/assets/javascripts/materialize/buttons.js +409 -0
- data/assets/javascripts/materialize/cards.js +34 -0
- data/assets/javascripts/materialize/carousel.js +797 -0
- data/assets/javascripts/materialize/cash.js +990 -0
- data/assets/javascripts/materialize/characterCounter.js +180 -0
- data/assets/javascripts/materialize/chips.js +564 -0
- data/assets/javascripts/materialize/collapsible.js +337 -0
- data/assets/javascripts/materialize/component.js +57 -0
- data/assets/javascripts/materialize/datepicker.js +935 -0
- data/assets/javascripts/materialize/dropdown.js +659 -0
- data/assets/javascripts/materialize/extras/nouislider.js +2147 -0
- data/assets/javascripts/materialize/extras/nouislider.min.js +1 -0
- data/assets/javascripts/materialize/forms.js +244 -0
- data/assets/javascripts/materialize/global.js +408 -0
- data/assets/javascripts/materialize/materialbox.js +513 -0
- data/assets/javascripts/materialize/modal.js +449 -0
- data/assets/javascripts/materialize/parallax.js +173 -0
- data/assets/javascripts/materialize/pushpin.js +179 -0
- data/assets/javascripts/materialize/range.js +310 -0
- data/assets/javascripts/materialize/scrollspy.js +328 -0
- data/assets/javascripts/materialize/select.js +497 -0
- data/assets/javascripts/materialize/sidenav.js +655 -0
- data/assets/javascripts/materialize/slider.js +424 -0
- data/assets/javascripts/materialize/tabs.js +476 -0
- data/assets/javascripts/materialize/tapTarget.js +364 -0
- data/assets/javascripts/materialize/timepicker.js +647 -0
- data/assets/javascripts/materialize/toasts.js +355 -0
- data/assets/javascripts/materialize/tooltip.js +351 -0
- data/{app/assets → assets}/javascripts/materialize/waves.js +42 -47
- data/assets/javascripts/materialize-sprockets.js +29 -0
- data/assets/javascripts/materialize.js +12374 -0
- data/assets/stylesheets/materialize/components/_badges.scss +55 -0
- data/assets/stylesheets/materialize/components/_buttons.scss +322 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_cards.scss +72 -29
- data/assets/stylesheets/materialize/components/_carousel.scss +90 -0
- data/assets/stylesheets/materialize/components/_chips.scss +90 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_collapsible.scss +23 -17
- data/assets/stylesheets/materialize/components/_color-classes.scss +32 -0
- data/{app/assets/stylesheets/materialize/components/_color.scss → assets/stylesheets/materialize/components/_color-variables.scss} +22 -64
- data/assets/stylesheets/materialize/components/_datepicker.scss +191 -0
- data/assets/stylesheets/materialize/components/_dropdown.scss +85 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_global.scss +197 -144
- data/{app/assets → assets}/stylesheets/materialize/components/_grid.scss +57 -18
- data/assets/stylesheets/materialize/components/_icons-material-design.scss +5 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_materialbox.scss +15 -13
- data/{app/assets → assets}/stylesheets/materialize/components/_modal.scss +18 -14
- data/{app/assets → assets}/stylesheets/materialize/components/_navbar.scss +89 -25
- data/assets/stylesheets/materialize/components/_normalize.scss +447 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_preloader.scss +5 -3
- data/assets/stylesheets/materialize/components/_pulse.scss +34 -0
- data/assets/stylesheets/materialize/components/_sidenav.scss +208 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_slider.scss +2 -2
- data/{app/assets → assets}/stylesheets/materialize/components/_table_of_contents.scss +5 -5
- data/assets/stylesheets/materialize/components/_tabs.scss +99 -0
- data/assets/stylesheets/materialize/components/_tapTarget.scss +103 -0
- data/assets/stylesheets/materialize/components/_timepicker.scss +183 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_toast.scss +17 -22
- data/assets/stylesheets/materialize/components/_tooltip.scss +32 -0
- data/assets/stylesheets/materialize/components/_transitions.scss +13 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_typography.scss +11 -9
- data/assets/stylesheets/materialize/components/_variables.scss +349 -0
- data/assets/stylesheets/materialize/components/_waves.scss +114 -0
- data/assets/stylesheets/materialize/components/forms/_checkboxes.scss +200 -0
- data/assets/stylesheets/materialize/components/forms/_file-input.scss +44 -0
- data/assets/stylesheets/materialize/components/forms/_forms.scss +22 -0
- data/assets/stylesheets/materialize/components/forms/_input-fields.scss +354 -0
- data/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +115 -0
- data/assets/stylesheets/materialize/components/forms/_range.scss +161 -0
- data/assets/stylesheets/materialize/components/forms/_select.scss +190 -0
- data/assets/stylesheets/materialize/components/forms/_switches.scss +89 -0
- data/assets/stylesheets/materialize/extras/nouislider.css +406 -0
- data/{app/assets → assets}/stylesheets/materialize.scss +13 -10
- data/lib/materialize-sass/engine.rb +11 -6
- data/lib/materialize-sass/helpers.rb +38 -0
- data/lib/materialize-sass/version.rb +1 -1
- data/lib/materialize-sass.rb +13 -28
- data/materialize-sass.gemspec +5 -5
- metadata +97 -105
- data/app/assets/fonts/material-design-icons/LICENSE.txt +0 -428
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.eot +0 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.svg +0 -769
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.ttf +0 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff +0 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
- data/app/assets/javascripts/materialize/animation.js +0 -9
- data/app/assets/javascripts/materialize/buttons.js +0 -61
- data/app/assets/javascripts/materialize/cards.js +0 -27
- data/app/assets/javascripts/materialize/character_counter.js +0 -59
- data/app/assets/javascripts/materialize/collapsible.js +0 -139
- data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -1430
- data/app/assets/javascripts/materialize/date_picker/picker.js +0 -1123
- data/app/assets/javascripts/materialize/dropdown.js +0 -178
- data/app/assets/javascripts/materialize/forms.js +0 -456
- data/app/assets/javascripts/materialize/global.js +0 -36
- data/app/assets/javascripts/materialize/hammer.min.js +0 -1
- data/app/assets/javascripts/materialize/init.js +0 -136
- data/app/assets/javascripts/materialize/jquery.easing.1.3.js +0 -205
- data/app/assets/javascripts/materialize/jquery.hammer.js +0 -33
- data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -1
- data/app/assets/javascripts/materialize/leanModal.js +0 -178
- data/app/assets/javascripts/materialize/materialbox.js +0 -249
- data/app/assets/javascripts/materialize/parallax.js +0 -58
- data/app/assets/javascripts/materialize/prism.js +0 -8
- data/app/assets/javascripts/materialize/pushpin.js +0 -62
- data/app/assets/javascripts/materialize/scrollFire.js +0 -44
- data/app/assets/javascripts/materialize/scrollspy.js +0 -284
- data/app/assets/javascripts/materialize/sideNav.js +0 -312
- data/app/assets/javascripts/materialize/slider.js +0 -301
- data/app/assets/javascripts/materialize/tabs.js +0 -136
- data/app/assets/javascripts/materialize/toasts.js +0 -125
- data/app/assets/javascripts/materialize/tooltip.js +0 -166
- data/app/assets/javascripts/materialize/transitions.js +0 -154
- data/app/assets/javascripts/materialize/velocity.min.js +0 -4
- data/app/assets/javascripts/materialize-sprockets.js +0 -27
- data/app/assets/javascripts/materialize.js +0 -6159
- data/app/assets/stylesheets/materialize/components/_buttons.scss +0 -157
- data/app/assets/stylesheets/materialize/components/_dropdown.scss +0 -40
- data/app/assets/stylesheets/materialize/components/_form.scss +0 -886
- data/app/assets/stylesheets/materialize/components/_icons-material-design.scss +0 -3257
- data/app/assets/stylesheets/materialize/components/_mixins.scss +0 -5
- data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -427
- data/app/assets/stylesheets/materialize/components/_prefixer.scss +0 -376
- data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -38
- data/app/assets/stylesheets/materialize/components/_sideNav.scss +0 -111
- data/app/assets/stylesheets/materialize/components/_tabs.scss +0 -47
- data/app/assets/stylesheets/materialize/components/_tooltip.scss +0 -34
- data/app/assets/stylesheets/materialize/components/_variables.scss +0 -152
- data/app/assets/stylesheets/materialize/components/_waves.scss +0 -167
- data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +0 -435
- data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +0 -201
- data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +0 -125
@@ -0,0 +1,364 @@
|
|
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
|
+
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
|
+
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
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
|
+
|
11
|
+
(function ($) {
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
var _defaults = {
|
15
|
+
onOpen: undefined,
|
16
|
+
onClose: undefined
|
17
|
+
};
|
18
|
+
|
19
|
+
/**
|
20
|
+
* @class
|
21
|
+
*
|
22
|
+
*/
|
23
|
+
|
24
|
+
var TapTarget = function (_Component) {
|
25
|
+
_inherits(TapTarget, _Component);
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Construct TapTarget instance
|
29
|
+
* @constructor
|
30
|
+
* @param {Element} el
|
31
|
+
* @param {Object} options
|
32
|
+
*/
|
33
|
+
function TapTarget(el, options) {
|
34
|
+
_classCallCheck(this, TapTarget);
|
35
|
+
|
36
|
+
var _this = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options));
|
37
|
+
|
38
|
+
_this.el.M_TapTarget = _this;
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Options for the select
|
42
|
+
* @member TapTarget#options
|
43
|
+
* @prop {Function} onOpen - Callback function called when feature discovery is opened
|
44
|
+
* @prop {Function} onClose - Callback function called when feature discovery is closed
|
45
|
+
*/
|
46
|
+
_this.options = $.extend({}, TapTarget.defaults, options);
|
47
|
+
|
48
|
+
_this.isOpen = false;
|
49
|
+
|
50
|
+
// setup
|
51
|
+
_this.$origin = $('#' + _this.$el.attr('data-target'));
|
52
|
+
_this._setup();
|
53
|
+
|
54
|
+
_this._calculatePositioning();
|
55
|
+
_this._setupEventHandlers();
|
56
|
+
return _this;
|
57
|
+
}
|
58
|
+
|
59
|
+
_createClass(TapTarget, [{
|
60
|
+
key: 'destroy',
|
61
|
+
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Teardown component
|
65
|
+
*/
|
66
|
+
value: function destroy() {
|
67
|
+
this._removeEventHandlers();
|
68
|
+
this.el.TapTarget = undefined;
|
69
|
+
}
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Setup Event Handlers
|
73
|
+
*/
|
74
|
+
|
75
|
+
}, {
|
76
|
+
key: '_setupEventHandlers',
|
77
|
+
value: function _setupEventHandlers() {
|
78
|
+
this._handleDocumentClickBound = this._handleDocumentClick.bind(this);
|
79
|
+
this._handleTargetClickBound = this._handleTargetClick.bind(this);
|
80
|
+
this._handleOriginClickBound = this._handleOriginClick.bind(this);
|
81
|
+
|
82
|
+
this.el.addEventListener('click', this._handleTargetClickBound);
|
83
|
+
this.originEl.addEventListener('click', this._handleOriginClickBound);
|
84
|
+
|
85
|
+
// Resize
|
86
|
+
var throttledResize = M.throttle(this._handleResize, 200);
|
87
|
+
this._handleThrottledResizeBound = throttledResize.bind(this);
|
88
|
+
|
89
|
+
window.addEventListener('resize', this._handleThrottledResizeBound);
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Remove Event Handlers
|
94
|
+
*/
|
95
|
+
|
96
|
+
}, {
|
97
|
+
key: '_removeEventHandlers',
|
98
|
+
value: function _removeEventHandlers() {
|
99
|
+
this.el.removeEventListener('click', this._handleTargetClickBound);
|
100
|
+
this.originEl.removeEventListener('click', this._handleOriginClickBound);
|
101
|
+
window.removeEventListener('resize', this._handleThrottledResizeBound);
|
102
|
+
}
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Handle Target Click
|
106
|
+
* @param {Event} e
|
107
|
+
*/
|
108
|
+
|
109
|
+
}, {
|
110
|
+
key: '_handleTargetClick',
|
111
|
+
value: function _handleTargetClick(e) {
|
112
|
+
this.open();
|
113
|
+
}
|
114
|
+
|
115
|
+
/**
|
116
|
+
* Handle Origin Click
|
117
|
+
* @param {Event} e
|
118
|
+
*/
|
119
|
+
|
120
|
+
}, {
|
121
|
+
key: '_handleOriginClick',
|
122
|
+
value: function _handleOriginClick(e) {
|
123
|
+
this.close();
|
124
|
+
}
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Handle Resize
|
128
|
+
* @param {Event} e
|
129
|
+
*/
|
130
|
+
|
131
|
+
}, {
|
132
|
+
key: '_handleResize',
|
133
|
+
value: function _handleResize(e) {
|
134
|
+
this._calculatePositioning();
|
135
|
+
}
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Handle Resize
|
139
|
+
* @param {Event} e
|
140
|
+
*/
|
141
|
+
|
142
|
+
}, {
|
143
|
+
key: '_handleDocumentClick',
|
144
|
+
value: function _handleDocumentClick(e) {
|
145
|
+
if (!$(e.target).closest('.tap-target-wrapper').length) {
|
146
|
+
this.close();
|
147
|
+
e.preventDefault();
|
148
|
+
e.stopPropagation();
|
149
|
+
}
|
150
|
+
}
|
151
|
+
|
152
|
+
/**
|
153
|
+
* Setup Tap Target
|
154
|
+
*/
|
155
|
+
|
156
|
+
}, {
|
157
|
+
key: '_setup',
|
158
|
+
value: function _setup() {
|
159
|
+
// Creating tap target
|
160
|
+
this.wrapper = this.$el.parent()[0];
|
161
|
+
this.waveEl = $(this.wrapper).find('.tap-target-wave')[0];
|
162
|
+
this.originEl = $(this.wrapper).find('.tap-target-origin')[0];
|
163
|
+
this.contentEl = this.$el.find('.tap-target-content')[0];
|
164
|
+
|
165
|
+
// Creating wrapper
|
166
|
+
if (!$(this.wrapper).hasClass('.tap-target-wrapper')) {
|
167
|
+
this.wrapper = document.createElement('div');
|
168
|
+
this.wrapper.classList.add('tap-target-wrapper');
|
169
|
+
this.$el.before($(this.wrapper));
|
170
|
+
this.wrapper.append(this.el);
|
171
|
+
}
|
172
|
+
|
173
|
+
// Creating content
|
174
|
+
if (!this.contentEl) {
|
175
|
+
this.contentEl = document.createElement('div');
|
176
|
+
this.contentEl.classList.add('tap-target-content');
|
177
|
+
this.$el.append(this.contentEl);
|
178
|
+
}
|
179
|
+
|
180
|
+
// Creating foreground wave
|
181
|
+
if (!this.waveEl) {
|
182
|
+
this.waveEl = document.createElement('div');
|
183
|
+
this.waveEl.classList.add('tap-target-wave');
|
184
|
+
|
185
|
+
// Creating origin
|
186
|
+
if (!this.originEl) {
|
187
|
+
this.originEl = this.$origin.clone(true, true);
|
188
|
+
this.originEl.addClass('tap-target-origin');
|
189
|
+
this.originEl.removeAttr('id');
|
190
|
+
this.originEl.removeAttr('style');
|
191
|
+
this.originEl = this.originEl[0];
|
192
|
+
this.waveEl.append(this.originEl);
|
193
|
+
}
|
194
|
+
|
195
|
+
this.wrapper.append(this.waveEl);
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
/**
|
200
|
+
* Calculate positioning
|
201
|
+
*/
|
202
|
+
|
203
|
+
}, {
|
204
|
+
key: '_calculatePositioning',
|
205
|
+
value: function _calculatePositioning() {
|
206
|
+
// Element or parent is fixed position?
|
207
|
+
var isFixed = this.$origin.css('position') === 'fixed';
|
208
|
+
if (!isFixed) {
|
209
|
+
var parents = this.$origin.parents();
|
210
|
+
for (var i = 0; i < parents.length; i++) {
|
211
|
+
isFixed = $(parents[i]).css('position') == 'fixed';
|
212
|
+
if (isFixed) {
|
213
|
+
break;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
// Calculating origin
|
219
|
+
var originWidth = this.$origin.outerWidth();
|
220
|
+
var originHeight = this.$origin.outerHeight();
|
221
|
+
var originTop = isFixed ? this.$origin.offset().top - M.getDocumentScrollTop() : this.$origin.offset().top;
|
222
|
+
var originLeft = isFixed ? this.$origin.offset().left - M.getDocumentScrollLeft() : this.$origin.offset().left;
|
223
|
+
|
224
|
+
// Calculating screen
|
225
|
+
var windowWidth = window.innerWidth;
|
226
|
+
var windowHeight = window.innerHeight;
|
227
|
+
var centerX = windowWidth / 2;
|
228
|
+
var centerY = windowHeight / 2;
|
229
|
+
var isLeft = originLeft <= centerX;
|
230
|
+
var isRight = originLeft > centerX;
|
231
|
+
var isTop = originTop <= centerY;
|
232
|
+
var isBottom = originTop > centerY;
|
233
|
+
var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75;
|
234
|
+
|
235
|
+
// Calculating tap target
|
236
|
+
var tapTargetWidth = this.$el.outerWidth();
|
237
|
+
var tapTargetHeight = this.$el.outerHeight();
|
238
|
+
var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2;
|
239
|
+
var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2;
|
240
|
+
var tapTargetPosition = isFixed ? 'fixed' : 'absolute';
|
241
|
+
|
242
|
+
// Calculating content
|
243
|
+
var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth;
|
244
|
+
var tapTargetTextHeight = tapTargetHeight / 2;
|
245
|
+
var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0;
|
246
|
+
var tapTargetTextBottom = 0;
|
247
|
+
var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0;
|
248
|
+
var tapTargetTextRight = 0;
|
249
|
+
var tapTargetTextPadding = originWidth;
|
250
|
+
var tapTargetTextAlign = isBottom ? 'bottom' : 'top';
|
251
|
+
|
252
|
+
// Calculating wave
|
253
|
+
var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2;
|
254
|
+
var tapTargetWaveHeight = tapTargetWaveWidth;
|
255
|
+
var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2;
|
256
|
+
var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2;
|
257
|
+
|
258
|
+
// Setting tap target
|
259
|
+
var tapTargetWrapperCssObj = {};
|
260
|
+
tapTargetWrapperCssObj.top = isTop ? tapTargetTop + 'px' : '';
|
261
|
+
tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth + 'px' : '';
|
262
|
+
tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight + 'px' : '';
|
263
|
+
tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft + 'px' : '';
|
264
|
+
tapTargetWrapperCssObj.position = tapTargetPosition;
|
265
|
+
$(this.wrapper).css(tapTargetWrapperCssObj);
|
266
|
+
|
267
|
+
// Setting content
|
268
|
+
$(this.contentEl).css({
|
269
|
+
width: tapTargetTextWidth + 'px',
|
270
|
+
height: tapTargetTextHeight + 'px',
|
271
|
+
top: tapTargetTextTop + 'px',
|
272
|
+
right: tapTargetTextRight + 'px',
|
273
|
+
bottom: tapTargetTextBottom + 'px',
|
274
|
+
left: tapTargetTextLeft + 'px',
|
275
|
+
padding: tapTargetTextPadding + 'px',
|
276
|
+
verticalAlign: tapTargetTextAlign
|
277
|
+
});
|
278
|
+
|
279
|
+
// Setting wave
|
280
|
+
$(this.waveEl).css({
|
281
|
+
top: tapTargetWaveTop + 'px',
|
282
|
+
left: tapTargetWaveLeft + 'px',
|
283
|
+
width: tapTargetWaveWidth + 'px',
|
284
|
+
height: tapTargetWaveHeight + 'px'
|
285
|
+
});
|
286
|
+
}
|
287
|
+
|
288
|
+
/**
|
289
|
+
* Open TapTarget
|
290
|
+
*/
|
291
|
+
|
292
|
+
}, {
|
293
|
+
key: 'open',
|
294
|
+
value: function open() {
|
295
|
+
if (this.isOpen) {
|
296
|
+
return;
|
297
|
+
}
|
298
|
+
|
299
|
+
// onOpen callback
|
300
|
+
if (typeof this.options.onOpen === 'function') {
|
301
|
+
this.options.onOpen.call(this, this.$origin[0]);
|
302
|
+
}
|
303
|
+
|
304
|
+
this.isOpen = true;
|
305
|
+
this.wrapper.classList.add('open');
|
306
|
+
|
307
|
+
document.body.addEventListener('click', this._handleDocumentClickBound, true);
|
308
|
+
document.body.addEventListener('touchend', this._handleDocumentClickBound);
|
309
|
+
}
|
310
|
+
|
311
|
+
/**
|
312
|
+
* Close Tap Target
|
313
|
+
*/
|
314
|
+
|
315
|
+
}, {
|
316
|
+
key: 'close',
|
317
|
+
value: function close() {
|
318
|
+
if (!this.isOpen) {
|
319
|
+
return;
|
320
|
+
}
|
321
|
+
|
322
|
+
// onClose callback
|
323
|
+
if (typeof this.options.onClose === 'function') {
|
324
|
+
this.options.onClose.call(this, this.$origin[0]);
|
325
|
+
}
|
326
|
+
|
327
|
+
this.isOpen = false;
|
328
|
+
this.wrapper.classList.remove('open');
|
329
|
+
|
330
|
+
document.body.removeEventListener('click', this._handleDocumentClickBound, true);
|
331
|
+
document.body.removeEventListener('touchend', this._handleDocumentClickBound);
|
332
|
+
}
|
333
|
+
}], [{
|
334
|
+
key: 'init',
|
335
|
+
value: function init(els, options) {
|
336
|
+
return _get(TapTarget.__proto__ || Object.getPrototypeOf(TapTarget), 'init', this).call(this, this, els, options);
|
337
|
+
}
|
338
|
+
|
339
|
+
/**
|
340
|
+
* Get Instance
|
341
|
+
*/
|
342
|
+
|
343
|
+
}, {
|
344
|
+
key: 'getInstance',
|
345
|
+
value: function getInstance(el) {
|
346
|
+
var domElem = !!el.jquery ? el[0] : el;
|
347
|
+
return domElem.M_TapTarget;
|
348
|
+
}
|
349
|
+
}, {
|
350
|
+
key: 'defaults',
|
351
|
+
get: function () {
|
352
|
+
return _defaults;
|
353
|
+
}
|
354
|
+
}]);
|
355
|
+
|
356
|
+
return TapTarget;
|
357
|
+
}(Component);
|
358
|
+
|
359
|
+
M.TapTarget = TapTarget;
|
360
|
+
|
361
|
+
if (M.jQueryLoaded) {
|
362
|
+
M.initializeJqueryWrapper(TapTarget, 'tapTarget', 'M_TapTarget');
|
363
|
+
}
|
364
|
+
})(cash);
|