dae-material 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +3 -0
  5. data/CODE_OF_CONDUCT.md +13 -0
  6. data/Gemfile +4 -0
  7. data/README.md +39 -0
  8. data/Rakefile +1 -0
  9. data/app/assets/fonts/material-design-icons/LICENSE.txt +428 -0
  10. data/app/assets/fonts/material-design-icons/Material-Design-Icons.eot +0 -0
  11. data/app/assets/fonts/material-design-icons/Material-Design-Icons.svg +751 -0
  12. data/app/assets/fonts/material-design-icons/Material-Design-Icons.ttf +0 -0
  13. data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff +0 -0
  14. data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff2 +0 -0
  15. data/app/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
  16. data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
  17. data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
  18. data/app/assets/fonts/roboto/Roboto-Light.ttf +0 -0
  19. data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
  20. data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
  21. data/app/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
  22. data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
  23. data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
  24. data/app/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
  25. data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
  26. data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
  27. data/app/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
  28. data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
  29. data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
  30. data/app/assets/javascripts/materialize-sprockets.js +27 -0
  31. data/app/assets/javascripts/materialize.js +6023 -0
  32. data/app/assets/javascripts/materialize/animation.js +9 -0
  33. data/app/assets/javascripts/materialize/buttons.js +35 -0
  34. data/app/assets/javascripts/materialize/cards.js +27 -0
  35. data/app/assets/javascripts/materialize/character_counter.js +59 -0
  36. data/app/assets/javascripts/materialize/collapsible.js +139 -0
  37. data/app/assets/javascripts/materialize/date_picker/picker.date.js +1430 -0
  38. data/app/assets/javascripts/materialize/date_picker/picker.js +1123 -0
  39. data/app/assets/javascripts/materialize/dropdown.js +176 -0
  40. data/app/assets/javascripts/materialize/forms.js +397 -0
  41. data/app/assets/javascripts/materialize/global.js +31 -0
  42. data/app/assets/javascripts/materialize/hammer.min.js +1 -0
  43. data/app/assets/javascripts/materialize/init.js +137 -0
  44. data/app/assets/javascripts/materialize/jquery.easing.1.3.js +205 -0
  45. data/app/assets/javascripts/materialize/jquery.hammer.js +33 -0
  46. data/app/assets/javascripts/materialize/jquery.timeago.min.js +1 -0
  47. data/app/assets/javascripts/materialize/leanModal.js +139 -0
  48. data/app/assets/javascripts/materialize/materialbox.js +249 -0
  49. data/app/assets/javascripts/materialize/parallax.js +58 -0
  50. data/app/assets/javascripts/materialize/prism.js +8 -0
  51. data/app/assets/javascripts/materialize/pushpin.js +62 -0
  52. data/app/assets/javascripts/materialize/scrollFire.js +69 -0
  53. data/app/assets/javascripts/materialize/scrollspy.js +284 -0
  54. data/app/assets/javascripts/materialize/sideNav.js +335 -0
  55. data/app/assets/javascripts/materialize/slider.js +263 -0
  56. data/app/assets/javascripts/materialize/tabs.js +129 -0
  57. data/app/assets/javascripts/materialize/toasts.js +121 -0
  58. data/app/assets/javascripts/materialize/tooltip.js +166 -0
  59. data/app/assets/javascripts/materialize/transitions.js +145 -0
  60. data/app/assets/javascripts/materialize/velocity.min.js +4 -0
  61. data/app/assets/javascripts/materialize/waves.js +338 -0
  62. data/app/assets/stylesheets/materialize.scss +38 -0
  63. data/app/assets/stylesheets/materialize/components/_buttons.scss +151 -0
  64. data/app/assets/stylesheets/materialize/components/_cards.scss +150 -0
  65. data/app/assets/stylesheets/materialize/components/_collapsible.scss +88 -0
  66. data/app/assets/stylesheets/materialize/components/_color.scss +412 -0
  67. data/app/assets/stylesheets/materialize/components/_dropdown.scss +38 -0
  68. data/app/assets/stylesheets/materialize/components/_form.scss +850 -0
  69. data/app/assets/stylesheets/materialize/components/_global.scss +682 -0
  70. data/app/assets/stylesheets/materialize/components/_grid.scss +118 -0
  71. data/app/assets/stylesheets/materialize/components/_icons-material-design.scss +783 -0
  72. data/app/assets/stylesheets/materialize/components/_materialbox.scss +41 -0
  73. data/app/assets/stylesheets/materialize/components/_mixins.scss +5 -0
  74. data/app/assets/stylesheets/materialize/components/_modal.scss +89 -0
  75. data/app/assets/stylesheets/materialize/components/_navbar.scss +143 -0
  76. data/app/assets/stylesheets/materialize/components/_normalize.scss +427 -0
  77. data/app/assets/stylesheets/materialize/components/_prefixer.scss +376 -0
  78. data/app/assets/stylesheets/materialize/components/_preloader.scss +332 -0
  79. data/app/assets/stylesheets/materialize/components/_roboto.scss +38 -0
  80. data/app/assets/stylesheets/materialize/components/_sideNav.scss +111 -0
  81. data/app/assets/stylesheets/materialize/components/_slider.scss +92 -0
  82. data/app/assets/stylesheets/materialize/components/_table_of_contents.scss +33 -0
  83. data/app/assets/stylesheets/materialize/components/_tabs.scss +42 -0
  84. data/app/assets/stylesheets/materialize/components/_toast.scss +63 -0
  85. data/app/assets/stylesheets/materialize/components/_tooltip.scss +34 -0
  86. data/app/assets/stylesheets/materialize/components/_typography.scss +56 -0
  87. data/app/assets/stylesheets/materialize/components/_variables.scss +143 -0
  88. data/app/assets/stylesheets/materialize/components/_waves.scss +167 -0
  89. data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +435 -0
  90. data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +201 -0
  91. data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +125 -0
  92. data/bin/console +14 -0
  93. data/bin/setup +7 -0
  94. data/dae-material.gemspec +23 -0
  95. data/lib/dae/material.rb +7 -0
  96. data/lib/dae/material/version.rb +8 -0
  97. metadata +166 -0
@@ -0,0 +1,263 @@
1
+ (function ($) {
2
+
3
+ $.fn.slider = function (options) {
4
+ var defaults = {
5
+ indicators: true,
6
+ height: 400,
7
+ transition: 500,
8
+ interval: 6000
9
+ }
10
+ options = $.extend(defaults, options);
11
+
12
+ return this.each(function() {
13
+
14
+ // For each slider, we want to keep track of
15
+ // which slide is active and its associated content
16
+ var $this = $(this);
17
+ var $slider = $this.find('ul.slides').first();
18
+ var $slides = $slider.find('li');
19
+ var $active_index = $slider.find('.active').index();
20
+ var $active;
21
+ if ($active_index != -1) { $active = $slides.eq($active_index); }
22
+
23
+ // Transitions the caption depending on alignment
24
+ function captionTransition(caption, duration) {
25
+ if (caption.hasClass("center-align")) {
26
+ caption.velocity({opacity: 0, translateY: -100}, {duration: duration, queue: false});
27
+ }
28
+ else if (caption.hasClass("right-align")) {
29
+ caption.velocity({opacity: 0, translateX: 100}, {duration: duration, queue: false});
30
+ }
31
+ else if (caption.hasClass("left-align")) {
32
+ caption.velocity({opacity: 0, translateX: -100}, {duration: duration, queue: false});
33
+ }
34
+ }
35
+
36
+ // This function will transition the slide to any index of the next slide
37
+ function moveToSlide(index) {
38
+ if (index >= $slides.length) index = 0;
39
+ else if (index < 0) index = $slides.length -1;
40
+
41
+ $active_index = $slider.find('.active').index();
42
+
43
+ // Only do if index changes
44
+ if ($active_index != index) {
45
+ $active = $slides.eq($active_index);
46
+ $caption = $active.find('.caption');
47
+
48
+ $active.removeClass('active');
49
+ $active.velocity({opacity: 0}, {duration: options.transition, queue: false, easing: 'easeOutQuad',
50
+ complete: function() {
51
+ $slides.not('.active').velocity({opacity: 0, translateX: 0, translateY: 0}, {duration: 0, queue: false});
52
+ } });
53
+ captionTransition($caption, options.transition);
54
+
55
+
56
+ // Update indicators
57
+ if (options.indicators) {
58
+ $indicators.eq($active_index).removeClass('active');
59
+ }
60
+
61
+ $slides.eq(index).velocity({opacity: 1}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
62
+ $slides.eq(index).find('.caption').velocity({opacity: 1, translateX: 0, translateY: 0}, {duration: options.transition, delay: options.transition, queue: false, easing: 'easeOutQuad'});
63
+ $slides.eq(index).addClass('active');
64
+
65
+
66
+ // Update indicators
67
+ if (options.indicators) {
68
+ $indicators.eq(index).addClass('active');
69
+ }
70
+ }
71
+ }
72
+
73
+ // Set height of slider
74
+ if (options.height != 400) {
75
+ $this.height(options.height + 40);
76
+ $slider.height(options.height);
77
+ }
78
+
79
+ // Set initial positions of captions
80
+ $slides.find('.caption').each(function () {
81
+ captionTransition($(this), 0);
82
+ });
83
+
84
+ // Set initial dimensions of images
85
+ // $slides.find('img').each(function () {
86
+ // $(this).load(function () {
87
+ // if ($(this).width() < $(this).parent().width()) {
88
+ // $(this).css({width: '100%', height: 'auto'});
89
+ // }
90
+ // });
91
+ // });
92
+
93
+ // Move img src into background-image
94
+ $slides.find('img').each(function () {
95
+ $(this).css('background-image', 'url(' + $(this).attr('src') + ')' );
96
+ $(this).attr('src', 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
97
+ });
98
+
99
+ // dynamically add indicators
100
+ if (options.indicators) {
101
+ var $indicators = $('<ul class="indicators"></ul>');
102
+ $slides.each(function( index ) {
103
+ var $indicator = $('<li class="indicator-item"></li>');
104
+
105
+ // Handle clicks on indicators
106
+ $indicator.click(function () {
107
+ var $parent = $slider.parent();
108
+ var curr_index = $parent.find($(this)).index();
109
+ moveToSlide(curr_index);
110
+
111
+ // reset interval
112
+ clearInterval($interval);
113
+ $interval = setInterval(
114
+ function(){
115
+ $active_index = $slider.find('.active').index();
116
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
117
+ else $active_index += 1;
118
+
119
+ moveToSlide($active_index);
120
+
121
+ }, options.transition + options.interval
122
+ );
123
+ });
124
+ $indicators.append($indicator);
125
+ });
126
+ $this.append($indicators);
127
+ $indicators = $this.find('ul.indicators').find('li.indicator-item');
128
+ }
129
+
130
+ if ($active) {
131
+ $active.show();
132
+ }
133
+ else {
134
+ $slides.first().addClass('active').velocity({opacity: 1}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
135
+
136
+ $active_index = 0;
137
+ $active = $slides.eq($active_index);
138
+
139
+ // Update indicators
140
+ if (options.indicators) {
141
+ $indicators.eq($active_index).addClass('active');
142
+ }
143
+ }
144
+
145
+ // Adjust height to current slide
146
+ $active.find('img').each(function() {
147
+ $active.find('.caption').velocity({opacity: 1, translateX: 0, translateY: 0}, {duration: options.transition, queue: false, easing: 'easeOutQuad'});
148
+ });
149
+
150
+ // auto scroll
151
+ $interval = setInterval(
152
+ function(){
153
+ $active_index = $slider.find('.active').index();
154
+ moveToSlide($active_index + 1);
155
+
156
+ }, options.transition + options.interval
157
+ );
158
+
159
+
160
+ // HammerJS, Swipe navigation
161
+
162
+ // Touch Event
163
+ var panning = false;
164
+ var swipeLeft = false;
165
+ var swipeRight = false;
166
+
167
+ $this.hammer({
168
+ prevent_default: false
169
+ }).bind('pan', function(e) {
170
+ if (e.gesture.pointerType === "touch") {
171
+
172
+ // reset interval
173
+ clearInterval($interval);
174
+
175
+ var direction = e.gesture.direction;
176
+ var x = e.gesture.deltaX;
177
+ var velocityX = e.gesture.velocityX;
178
+
179
+ $curr_slide = $slider.find('.active');
180
+ $curr_slide.velocity({ translateX: x
181
+ }, {duration: 50, queue: false, easing: 'easeOutQuad'});
182
+
183
+ // Swipe Left
184
+ if (direction === 4 && (x > ($this.innerWidth() / 2) || velocityX < -0.65)) {
185
+ swipeRight = true;
186
+ }
187
+ // Swipe Right
188
+ else if (direction === 2 && (x < (-1 * $this.innerWidth() / 2) || velocityX > 0.65)) {
189
+ swipeLeft = true;
190
+ }
191
+
192
+ // Make Slide Behind active slide visible
193
+ var next_slide;
194
+ if (swipeLeft) {
195
+ next_slide = $curr_slide.next();
196
+ if (next_slide.length === 0) {
197
+ next_slide = $slides.first();
198
+ }
199
+ next_slide.velocity({ opacity: 1
200
+ }, {duration: 300, queue: false, easing: 'easeOutQuad'});
201
+ }
202
+ if (swipeRight) {
203
+ next_slide = $curr_slide.prev();
204
+ if (next_slide.length === 0) {
205
+ next_slide = $slides.last();
206
+ }
207
+ next_slide.velocity({ opacity: 1
208
+ }, {duration: 300, queue: false, easing: 'easeOutQuad'});
209
+ }
210
+
211
+
212
+ }
213
+
214
+ }).bind('panend', function(e) {
215
+ if (e.gesture.pointerType === "touch") {
216
+
217
+ $curr_slide = $slider.find('.active');
218
+ panning = false;
219
+ curr_index = $slider.find('.active').index();
220
+
221
+ if (!swipeRight && !swipeLeft) {
222
+ // Return to original spot
223
+ $curr_slide.velocity({ translateX: 0
224
+ }, {duration: 300, queue: false, easing: 'easeOutQuad'});
225
+ }
226
+ else if (swipeLeft) {
227
+ moveToSlide(curr_index + 1);
228
+ $curr_slide.velocity({translateX: -1 * $this.innerWidth() }, {duration: 300, queue: false, easing: 'easeOutQuad',
229
+ complete: function() {
230
+ $curr_slide.velocity({opacity: 0, translateX: 0}, {duration: 0, queue: false});
231
+ } });
232
+ }
233
+ else if (swipeRight) {
234
+ moveToSlide(curr_index - 1);
235
+ $curr_slide.velocity({translateX: $this.innerWidth() }, {duration: 300, queue: false, easing: 'easeOutQuad',
236
+ complete: function() {
237
+ $curr_slide.velocity({opacity: 0, translateX: 0}, {duration: 0, queue: false});
238
+ } });
239
+ }
240
+ swipeLeft = false;
241
+ swipeRight = false;
242
+
243
+ // Restart interval
244
+ clearInterval($interval);
245
+ $interval = setInterval(
246
+ function(){
247
+ $active_index = $slider.find('.active').index();
248
+ if ($slides.length == $active_index + 1) $active_index = 0; // loop to start
249
+ else $active_index += 1;
250
+
251
+ moveToSlide($active_index);
252
+
253
+ }, options.transition + options.interval
254
+ );
255
+ }
256
+ });
257
+
258
+ });
259
+
260
+
261
+
262
+ };
263
+ }( jQuery ));
@@ -0,0 +1,129 @@
1
+ (function ($) {
2
+
3
+ var methods = {
4
+ init : function() {
5
+ return this.each(function() {
6
+
7
+ // For each set of tabs, we want to keep track of
8
+ // which tab is active and its associated content
9
+ var $this = $(this),
10
+ window_width = $(window).width();
11
+
12
+ $this.width('100%');
13
+ // Set Tab Width for each tab
14
+ var $num_tabs = $(this).children('li').length;
15
+ $this.children('li').each(function() {
16
+ $(this).width((100/$num_tabs)+'%');
17
+ });
18
+ var $active, $content, $links = $this.find('li.tab a'),
19
+ $tabs_width = $this.width(),
20
+ $tab_width = $this.find('li').first().outerWidth(),
21
+ $index = 0;
22
+
23
+ // If the location.hash matches one of the links, use that as the active tab.
24
+ $active = $($links.filter('[href="'+location.hash+'"]'));
25
+
26
+ // If no match is found, use the first link or any with class 'active' as the initial active tab.
27
+ if ($active.length === 0) {
28
+ $active = $(this).find('li.tab a.active').first();
29
+ }
30
+ if ($active.length === 0) {
31
+ $active = $(this).find('li.tab a').first();
32
+ }
33
+
34
+ $active.addClass('active');
35
+ $index = $links.index($active);
36
+ if ($index < 0) {
37
+ $index = 0;
38
+ }
39
+
40
+ $content = $($active[0].hash);
41
+
42
+ // append indicator then set indicator width to tab width
43
+ $this.append('<div class="indicator"></div>');
44
+ var $indicator = $this.find('.indicator');
45
+ if ($this.is(":visible")) {
46
+ $indicator.css({"right": $tabs_width - (($index + 1) * $tab_width)});
47
+ $indicator.css({"left": $index * $tab_width});
48
+ }
49
+ $(window).resize(function () {
50
+ $tabs_width = $this.width();
51
+ $tab_width = $this.find('li').first().outerWidth();
52
+ if ($index < 0) {
53
+ $index = 0;
54
+ }
55
+ if ($tab_width !== 0 && $tabs_width !== 0) {
56
+ $indicator.css({"right": $tabs_width - (($index + 1) * $tab_width)});
57
+ $indicator.css({"left": $index * $tab_width});
58
+ }
59
+ });
60
+
61
+ // Hide the remaining content
62
+ $links.not($active).each(function () {
63
+ $(this.hash).hide();
64
+ });
65
+
66
+
67
+ // Bind the click event handler
68
+ $this.on('click', 'a', function(e){
69
+ $tabs_width = $this.width();
70
+ $tab_width = $this.find('li').first().outerWidth();
71
+
72
+ // Make the old tab inactive.
73
+ $active.removeClass('active');
74
+ $content.hide();
75
+
76
+ // Update the variables with the new link and content
77
+ $active = $(this);
78
+ $content = $(this.hash);
79
+ $links = $this.find('li.tab a');
80
+
81
+ // Make the tab active.
82
+ $active.addClass('active');
83
+ var $prev_index = $index;
84
+ $index = $links.index($(this));
85
+ if ($index < 0) {
86
+ $index = 0;
87
+ }
88
+ // Change url to current tab
89
+ // window.location.hash = $active.attr('href');
90
+
91
+ $content.show();
92
+
93
+ // Update indicator
94
+ if (($index - $prev_index) >= 0) {
95
+ $indicator.velocity({"right": $tabs_width - (($index + 1) * $tab_width)}, { duration: 300, queue: false, easing: 'easeOutQuad'});
96
+ $indicator.velocity({"left": $index * $tab_width}, {duration: 300, queue: false, easing: 'easeOutQuad', delay: 90});
97
+
98
+ }
99
+ else {
100
+ $indicator.velocity({"left": $index * $tab_width}, { duration: 300, queue: false, easing: 'easeOutQuad'});
101
+ $indicator.velocity({"right": $tabs_width - (($index + 1) * $tab_width)}, {duration: 300, queue: false, easing: 'easeOutQuad', delay: 90});
102
+ }
103
+
104
+ // Prevent the anchor's default click action
105
+ e.preventDefault();
106
+ });
107
+ });
108
+
109
+ },
110
+ select_tab : function( id ) {
111
+ this.find('a[href="#' + id + '"]').trigger('click');
112
+ }
113
+ };
114
+
115
+ $.fn.tabs = function(methodOrOptions) {
116
+ if ( methods[methodOrOptions] ) {
117
+ return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
118
+ } else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
119
+ // Default to "init"
120
+ return methods.init.apply( this, arguments );
121
+ } else {
122
+ $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.tooltip' );
123
+ }
124
+ };
125
+
126
+ $(document).ready(function(){
127
+ $('ul.tabs').tabs();
128
+ });
129
+ }( jQuery ));
@@ -0,0 +1,121 @@
1
+ Materialize.toast = function (message, displayLength, className, completeCallback) {
2
+ className = className || "";
3
+
4
+ var container = document.getElementById('toast-container');
5
+
6
+ // Create toast container if it does not exist
7
+ if (container === null) {
8
+ // create notification container
9
+ var container = document.createElement('div');
10
+ container.id = 'toast-container';
11
+ document.body.appendChild(container);
12
+ }
13
+
14
+ // Select and append toast
15
+ var newToast = createToast(message);
16
+ container.appendChild(newToast);
17
+
18
+ newToast.style.top = '35px';
19
+ newToast.style.opacity = 0;
20
+
21
+ // Animate toast in
22
+ Vel(newToast, { "top" : "0px", opacity: 1 }, {duration: 300,
23
+ easing: 'easeOutCubic',
24
+ queue: false});
25
+
26
+ // Allows timer to be pause while being panned
27
+ var timeLeft = displayLength;
28
+ var counterInterval = setInterval (function(){
29
+
30
+
31
+ if (newToast.parentNode === null)
32
+ window.clearInterval(counterInterval);
33
+
34
+ // If toast is not being dragged, decrease its time remaining
35
+ if (!newToast.classList.contains('panning')) {
36
+ timeLeft -= 20;
37
+ }
38
+
39
+ if (timeLeft <= 0) {
40
+ // Animate toast out
41
+ Vel(newToast, {"opacity": 0, marginTop: '-40px'}, { duration: 375,
42
+ easing: 'easeOutExpo',
43
+ queue: false,
44
+ complete: function(){
45
+ // Call the optional callback
46
+ if(typeof(completeCallback) === "function")
47
+ completeCallback();
48
+ // Remove toast after it times out
49
+ this[0].parentNode.removeChild(this[0]);
50
+ }
51
+ });
52
+ window.clearInterval(counterInterval);
53
+ }
54
+ }, 20);
55
+
56
+
57
+
58
+ function createToast(html) {
59
+
60
+ // Create toast
61
+ var toast = document.createElement('div');
62
+ toast.classList.add('toast');
63
+ if (className) {
64
+ var classes = className.split(' ');
65
+
66
+ for (var i = 0, count = classes.length; i < count; i++) {
67
+ toast.classList.add(classes[i]);
68
+ }
69
+ }
70
+ toast.innerHTML = html;
71
+
72
+ // Bind hammer
73
+ var hammerHandler = new Hammer(toast, {prevent_default: false});
74
+ hammerHandler.on('pan', function(e) {
75
+ var deltaX = e.deltaX;
76
+ var activationDistance = 80;
77
+
78
+ // Change toast state
79
+ if (!toast.classList.contains('panning')){
80
+ toast.classList.add('panning');
81
+ }
82
+
83
+ var opacityPercent = 1-Math.abs(deltaX / activationDistance);
84
+ if (opacityPercent < 0)
85
+ opacityPercent = 0;
86
+
87
+ Vel(toast, {left: deltaX, opacity: opacityPercent }, {duration: 50, queue: false, easing: 'easeOutQuad'});
88
+
89
+ });
90
+
91
+ hammerHandler.on('panend', function(e) {
92
+ var deltaX = e.deltaX;
93
+ var activationDistance = 80;
94
+
95
+ // If toast dragged past activation point
96
+ if (Math.abs(deltaX) > activationDistance) {
97
+ Vel(toast, {marginTop: '-40px'}, { duration: 375,
98
+ easing: 'easeOutExpo',
99
+ queue: false,
100
+ complete: function(){
101
+ if(typeof(completeCallback) === "function") {
102
+ completeCallback();
103
+ }
104
+ toast.parentNode.removeChild(toast);
105
+ }
106
+ });
107
+
108
+ } else {
109
+ toast.classList.remove('panning');
110
+ // Put toast back into original position
111
+ Vel(toast, { left: 0, opacity: 1 }, { duration: 300,
112
+ easing: 'easeOutExpo',
113
+ queue: false
114
+ });
115
+
116
+ }
117
+ });
118
+
119
+ return toast;
120
+ }
121
+ }