materialize-sass 0.99.0 → 0.100.0

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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -2
  3. data/app/assets/javascripts/materialize.js +6015 -5060
  4. data/app/assets/javascripts/materialize/animation.js +4 -5
  5. data/app/assets/javascripts/materialize/buttons.js +24 -38
  6. data/app/assets/javascripts/materialize/cards.js +13 -21
  7. data/app/assets/javascripts/materialize/carousel.js +122 -110
  8. data/app/assets/javascripts/materialize/character_counter.js +14 -22
  9. data/app/assets/javascripts/materialize/chips.js +41 -44
  10. data/app/assets/javascripts/materialize/collapsible.js +41 -46
  11. data/app/assets/javascripts/materialize/date_picker/picker.date.js +965 -1167
  12. data/app/assets/javascripts/materialize/date_picker/picker.js +546 -634
  13. data/app/assets/javascripts/materialize/date_picker/picker.time.js +166 -212
  14. data/app/assets/javascripts/materialize/dropdown.js +53 -68
  15. data/app/assets/javascripts/materialize/extras/nouislider.js +3 -1
  16. data/app/assets/javascripts/materialize/extras/nouislider.min.js +1 -1
  17. data/app/assets/javascripts/materialize/forms.js +156 -154
  18. data/app/assets/javascripts/materialize/global.js +34 -43
  19. data/app/assets/javascripts/materialize/hammer.min.js +424 -1
  20. data/app/assets/javascripts/materialize/initial.js +3 -3
  21. data/app/assets/javascripts/materialize/jquery.easing.1.4.js +120 -142
  22. data/app/assets/javascripts/materialize/jquery.hammer.js +9 -9
  23. data/app/assets/javascripts/materialize/materialbox.js +81 -107
  24. data/app/assets/javascripts/materialize/modal.js +373 -162
  25. data/app/assets/javascripts/materialize/parallax.js +11 -15
  26. data/app/assets/javascripts/materialize/pushpin.js +2 -5
  27. data/app/assets/javascripts/materialize/scrollFire.js +9 -11
  28. data/app/assets/javascripts/materialize/scrollspy.js +84 -92
  29. data/app/assets/javascripts/materialize/sideNav.js +128 -139
  30. data/app/assets/javascripts/materialize/slider.js +83 -112
  31. data/app/assets/javascripts/materialize/tabs.js +196 -196
  32. data/app/assets/javascripts/materialize/tapTarget.js +170 -173
  33. data/app/assets/javascripts/materialize/toasts.js +330 -112
  34. data/app/assets/javascripts/materialize/tooltip.js +134 -145
  35. data/app/assets/javascripts/materialize/transitions.js +43 -49
  36. data/app/assets/javascripts/materialize/velocity.min.js +623 -2
  37. data/app/assets/javascripts/materialize/waves.js +42 -47
  38. data/app/assets/stylesheets/materialize/components/_buttons.scss +1 -1
  39. data/app/assets/stylesheets/materialize/components/_carousel.scss +4 -5
  40. data/app/assets/stylesheets/materialize/components/_chips.scss +1 -0
  41. data/app/assets/stylesheets/materialize/components/_collapsible.scss +4 -7
  42. data/app/assets/stylesheets/materialize/components/_color.scss +1 -1
  43. data/app/assets/stylesheets/materialize/components/_global.scss +8 -14
  44. data/app/assets/stylesheets/materialize/components/_navbar.scss +0 -1
  45. data/app/assets/stylesheets/materialize/components/_tabs.scss +1 -7
  46. data/app/assets/stylesheets/materialize/components/_toast.scss +6 -12
  47. data/app/assets/stylesheets/materialize/components/_variables.scss +55 -43
  48. data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +1 -0
  49. data/app/assets/stylesheets/materialize/components/forms/_checkboxes.scss +2 -12
  50. data/app/assets/stylesheets/materialize/components/forms/_file-input.scss +6 -0
  51. data/app/assets/stylesheets/materialize/components/forms/_input-fields.scss +67 -37
  52. data/app/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +1 -3
  53. data/app/assets/stylesheets/materialize/components/forms/_select.scss +72 -11
  54. data/app/assets/stylesheets/materialize/components/forms/_switches.scss +2 -4
  55. data/app/assets/stylesheets/materialize/extras/nouislider.css +8 -1
  56. data/lib/materialize-sass/version.rb +1 -1
  57. metadata +2 -5
  58. data/app/assets/javascripts/materialize/init.js +0 -214
  59. data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -1
  60. data/app/assets/javascripts/materialize/prism.js +0 -8
@@ -1,10 +1,10 @@
1
1
  // Check for jQuery.
2
- if (typeof(jQuery) === 'undefined') {
2
+ if (typeof jQuery === 'undefined') {
3
3
  var jQuery;
4
4
  // Check if require is a defined function.
5
- if (typeof(require) === 'function') {
5
+ if (typeof require === 'function') {
6
6
  jQuery = $ = require('jquery');
7
- // Else use the dollar sign alias.
7
+ // Else use the dollar sign alias.
8
8
  } else {
9
9
  jQuery = $;
10
10
  }
@@ -16,151 +16,129 @@
16
16
  } else {
17
17
  factory(jQuery);
18
18
  }
19
- })(function($){
19
+ })(function ($) {
20
20
 
21
- // Preserve the original jQuery "swing" easing as "jswing"
22
- $.easing['jswing'] = $.easing['swing'];
21
+ // Preserve the original jQuery "swing" easing as "jswing"
22
+ $.easing['jswing'] = $.easing['swing'];
23
23
 
24
- var pow = Math.pow,
25
- sqrt = Math.sqrt,
26
- sin = Math.sin,
27
- cos = Math.cos,
28
- PI = Math.PI,
29
- c1 = 1.70158,
30
- c2 = c1 * 1.525,
31
- c3 = c1 + 1,
32
- c4 = ( 2 * PI ) / 3,
33
- c5 = ( 2 * PI ) / 4.5;
24
+ var pow = Math.pow,
25
+ sqrt = Math.sqrt,
26
+ sin = Math.sin,
27
+ cos = Math.cos,
28
+ PI = Math.PI,
29
+ c1 = 1.70158,
30
+ c2 = c1 * 1.525,
31
+ c3 = c1 + 1,
32
+ c4 = 2 * PI / 3,
33
+ c5 = 2 * PI / 4.5;
34
34
 
35
- // x is the fraction of animation progress, in the range 0..1
36
- function bounceOut(x) {
37
- var n1 = 7.5625,
38
- d1 = 2.75;
39
- if ( x < 1/d1 ) {
40
- return n1*x*x;
41
- } else if ( x < 2/d1 ) {
42
- return n1*(x-=(1.5/d1))*x + .75;
43
- } else if ( x < 2.5/d1 ) {
44
- return n1*(x-=(2.25/d1))*x + .9375;
45
- } else {
46
- return n1*(x-=(2.625/d1))*x + .984375;
35
+ // x is the fraction of animation progress, in the range 0..1
36
+ function bounceOut(x) {
37
+ var n1 = 7.5625,
38
+ d1 = 2.75;
39
+ if (x < 1 / d1) {
40
+ return n1 * x * x;
41
+ } else if (x < 2 / d1) {
42
+ return n1 * (x -= 1.5 / d1) * x + .75;
43
+ } else if (x < 2.5 / d1) {
44
+ return n1 * (x -= 2.25 / d1) * x + .9375;
45
+ } else {
46
+ return n1 * (x -= 2.625 / d1) * x + .984375;
47
+ }
47
48
  }
48
- }
49
49
 
50
- $.extend( $.easing,
51
- {
52
- def: 'easeOutQuad',
53
- swing: function (x) {
54
- return $.easing[$.easing.def](x);
55
- },
56
- easeInQuad: function (x) {
57
- return x * x;
58
- },
59
- easeOutQuad: function (x) {
60
- return 1 - ( 1 - x ) * ( 1 - x );
61
- },
62
- easeInOutQuad: function (x) {
63
- return x < 0.5 ?
64
- 2 * x * x :
65
- 1 - pow( -2 * x + 2, 2 ) / 2;
66
- },
67
- easeInCubic: function (x) {
68
- return x * x * x;
69
- },
70
- easeOutCubic: function (x) {
71
- return 1 - pow( 1 - x, 3 );
72
- },
73
- easeInOutCubic: function (x) {
74
- return x < 0.5 ?
75
- 4 * x * x * x :
76
- 1 - pow( -2 * x + 2, 3 ) / 2;
77
- },
78
- easeInQuart: function (x) {
79
- return x * x * x * x;
80
- },
81
- easeOutQuart: function (x) {
82
- return 1 - pow( 1 - x, 4 );
83
- },
84
- easeInOutQuart: function (x) {
85
- return x < 0.5 ?
86
- 8 * x * x * x * x :
87
- 1 - pow( -2 * x + 2, 4 ) / 2;
88
- },
89
- easeInQuint: function (x) {
90
- return x * x * x * x * x;
91
- },
92
- easeOutQuint: function (x) {
93
- return 1 - pow( 1 - x, 5 );
94
- },
95
- easeInOutQuint: function (x) {
96
- return x < 0.5 ?
97
- 16 * x * x * x * x * x :
98
- 1 - pow( -2 * x + 2, 5 ) / 2;
99
- },
100
- easeInSine: function (x) {
101
- return 1 - cos( x * PI/2 );
102
- },
103
- easeOutSine: function (x) {
104
- return sin( x * PI/2 );
105
- },
106
- easeInOutSine: function (x) {
107
- return -( cos( PI * x ) - 1 ) / 2;
108
- },
109
- easeInExpo: function (x) {
110
- return x === 0 ? 0 : pow( 2, 10 * x - 10 );
111
- },
112
- easeOutExpo: function (x) {
113
- return x === 1 ? 1 : 1 - pow( 2, -10 * x );
114
- },
115
- easeInOutExpo: function (x) {
116
- return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
117
- pow( 2, 20 * x - 10 ) / 2 :
118
- ( 2 - pow( 2, -20 * x + 10 ) ) / 2;
119
- },
120
- easeInCirc: function (x) {
121
- return 1 - sqrt( 1 - pow( x, 2 ) );
122
- },
123
- easeOutCirc: function (x) {
124
- return sqrt( 1 - pow( x - 1, 2 ) );
125
- },
126
- easeInOutCirc: function (x) {
127
- return x < 0.5 ?
128
- ( 1 - sqrt( 1 - pow( 2 * x, 2 ) ) ) / 2 :
129
- ( sqrt( 1 - pow( -2 * x + 2, 2 ) ) + 1 ) / 2;
130
- },
131
- easeInElastic: function (x) {
132
- return x === 0 ? 0 : x === 1 ? 1 :
133
- -pow( 2, 10 * x - 10 ) * sin( ( x * 10 - 10.75 ) * c4 );
134
- },
135
- easeOutElastic: function (x) {
136
- return x === 0 ? 0 : x === 1 ? 1 :
137
- pow( 2, -10 * x ) * sin( ( x * 10 - 0.75 ) * c4 ) + 1;
138
- },
139
- easeInOutElastic: function (x) {
140
- return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
141
- -( pow( 2, 20 * x - 10 ) * sin( ( 20 * x - 11.125 ) * c5 )) / 2 :
142
- pow( 2, -20 * x + 10 ) * sin( ( 20 * x - 11.125 ) * c5 ) / 2 + 1;
143
- },
144
- easeInBack: function (x) {
145
- return c3 * x * x * x - c1 * x * x;
146
- },
147
- easeOutBack: function (x) {
148
- return 1 + c3 * pow( x - 1, 3 ) + c1 * pow( x - 1, 2 );
149
- },
150
- easeInOutBack: function (x) {
151
- return x < 0.5 ?
152
- ( pow( 2 * x, 2 ) * ( ( c2 + 1 ) * 2 * x - c2 ) ) / 2 :
153
- ( pow( 2 * x - 2, 2 ) *( ( c2 + 1 ) * ( x * 2 - 2 ) + c2 ) + 2 ) / 2;
154
- },
155
- easeInBounce: function (x) {
156
- return 1 - bounceOut( 1 - x );
157
- },
158
- easeOutBounce: bounceOut,
159
- easeInOutBounce: function (x) {
160
- return x < 0.5 ?
161
- ( 1 - bounceOut( 1 - 2 * x ) ) / 2 :
162
- ( 1 + bounceOut( 2 * x - 1 ) ) / 2;
163
- }
50
+ $.extend($.easing, {
51
+ def: 'easeOutQuad',
52
+ swing: function (x) {
53
+ return $.easing[$.easing.def](x);
54
+ },
55
+ easeInQuad: function (x) {
56
+ return x * x;
57
+ },
58
+ easeOutQuad: function (x) {
59
+ return 1 - (1 - x) * (1 - x);
60
+ },
61
+ easeInOutQuad: function (x) {
62
+ return x < 0.5 ? 2 * x * x : 1 - pow(-2 * x + 2, 2) / 2;
63
+ },
64
+ easeInCubic: function (x) {
65
+ return x * x * x;
66
+ },
67
+ easeOutCubic: function (x) {
68
+ return 1 - pow(1 - x, 3);
69
+ },
70
+ easeInOutCubic: function (x) {
71
+ return x < 0.5 ? 4 * x * x * x : 1 - pow(-2 * x + 2, 3) / 2;
72
+ },
73
+ easeInQuart: function (x) {
74
+ return x * x * x * x;
75
+ },
76
+ easeOutQuart: function (x) {
77
+ return 1 - pow(1 - x, 4);
78
+ },
79
+ easeInOutQuart: function (x) {
80
+ return x < 0.5 ? 8 * x * x * x * x : 1 - pow(-2 * x + 2, 4) / 2;
81
+ },
82
+ easeInQuint: function (x) {
83
+ return x * x * x * x * x;
84
+ },
85
+ easeOutQuint: function (x) {
86
+ return 1 - pow(1 - x, 5);
87
+ },
88
+ easeInOutQuint: function (x) {
89
+ return x < 0.5 ? 16 * x * x * x * x * x : 1 - pow(-2 * x + 2, 5) / 2;
90
+ },
91
+ easeInSine: function (x) {
92
+ return 1 - cos(x * PI / 2);
93
+ },
94
+ easeOutSine: function (x) {
95
+ return sin(x * PI / 2);
96
+ },
97
+ easeInOutSine: function (x) {
98
+ return -(cos(PI * x) - 1) / 2;
99
+ },
100
+ easeInExpo: function (x) {
101
+ return x === 0 ? 0 : pow(2, 10 * x - 10);
102
+ },
103
+ easeOutExpo: function (x) {
104
+ return x === 1 ? 1 : 1 - pow(2, -10 * x);
105
+ },
106
+ easeInOutExpo: function (x) {
107
+ return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2;
108
+ },
109
+ easeInCirc: function (x) {
110
+ return 1 - sqrt(1 - pow(x, 2));
111
+ },
112
+ easeOutCirc: function (x) {
113
+ return sqrt(1 - pow(x - 1, 2));
114
+ },
115
+ easeInOutCirc: function (x) {
116
+ return x < 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;
117
+ },
118
+ easeInElastic: function (x) {
119
+ return x === 0 ? 0 : x === 1 ? 1 : -pow(2, 10 * x - 10) * sin((x * 10 - 10.75) * c4);
120
+ },
121
+ easeOutElastic: function (x) {
122
+ return x === 0 ? 0 : x === 1 ? 1 : pow(2, -10 * x) * sin((x * 10 - 0.75) * c4) + 1;
123
+ },
124
+ easeInOutElastic: function (x) {
125
+ return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? -(pow(2, 20 * x - 10) * sin((20 * x - 11.125) * c5)) / 2 : pow(2, -20 * x + 10) * sin((20 * x - 11.125) * c5) / 2 + 1;
126
+ },
127
+ easeInBack: function (x) {
128
+ return c3 * x * x * x - c1 * x * x;
129
+ },
130
+ easeOutBack: function (x) {
131
+ return 1 + c3 * pow(x - 1, 3) + c1 * pow(x - 1, 2);
132
+ },
133
+ easeInOutBack: function (x) {
134
+ return x < 0.5 ? pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2) / 2 : (pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;
135
+ },
136
+ easeInBounce: function (x) {
137
+ return 1 - bounceOut(1 - x);
138
+ },
139
+ easeOutBounce: bounceOut,
140
+ easeInOutBounce: function (x) {
141
+ return x < 0.5 ? (1 - bounceOut(1 - 2 * x)) / 2 : (1 + bounceOut(2 * x - 1)) / 2;
142
+ }
143
+ });
164
144
  });
165
-
166
- });
@@ -1,4 +1,4 @@
1
- (function(factory) {
1
+ (function (factory) {
2
2
  if (typeof define === 'function' && define.amd) {
3
3
  define(['jquery', 'hammerjs'], factory);
4
4
  } else if (typeof exports === 'object') {
@@ -6,28 +6,28 @@
6
6
  } else {
7
7
  factory(jQuery, Hammer);
8
8
  }
9
- }(function($, Hammer) {
9
+ })(function ($, Hammer) {
10
10
  function hammerify(el, options) {
11
11
  var $el = $(el);
12
- if(!$el.data("hammer")) {
12
+ if (!$el.data("hammer")) {
13
13
  $el.data("hammer", new Hammer($el[0], options));
14
14
  }
15
15
  }
16
16
 
17
- $.fn.hammer = function(options) {
18
- return this.each(function() {
17
+ $.fn.hammer = function (options) {
18
+ return this.each(function () {
19
19
  hammerify(this, options);
20
20
  });
21
21
  };
22
22
 
23
23
  // extend the emit method to also trigger jQuery events
24
- Hammer.Manager.prototype.emit = (function(originalEmit) {
25
- return function(type, data) {
24
+ Hammer.Manager.prototype.emit = function (originalEmit) {
25
+ return function (type, data) {
26
26
  originalEmit.call(this, type, data);
27
27
  $(this.element).trigger({
28
28
  type: type,
29
29
  gesture: data
30
30
  });
31
31
  };
32
- })(Hammer.Manager.prototype.emit);
33
- }));
32
+ }(Hammer.Manager.prototype.emit);
33
+ });
@@ -2,7 +2,7 @@
2
2
 
3
3
  $.fn.materialbox = function () {
4
4
 
5
- return this.each(function() {
5
+ return this.each(function () {
6
6
 
7
7
  if ($(this).hasClass('initialized')) {
8
8
  return;
@@ -23,27 +23,23 @@
23
23
  var originInlineStyles = origin.attr('style');
24
24
  origin.wrap(placeholder);
25
25
 
26
-
27
26
  // Start click handler
28
- origin.on('click', function() {
27
+ origin.on('click', function () {
29
28
  var placeholder = origin.parent('.material-placeholder');
30
29
  var windowWidth = window.innerWidth;
31
30
  var windowHeight = window.innerHeight;
32
31
  var originalWidth = origin.width();
33
32
  var originalHeight = origin.height();
34
33
 
35
-
36
34
  // If already modal, return to original
37
35
  if (doneAnimating === false) {
38
36
  returnToOriginal();
39
37
  return false;
40
- }
41
- else if (overlayActive && doneAnimating===true) {
38
+ } else if (overlayActive && doneAnimating === true) {
42
39
  returnToOriginal();
43
40
  return false;
44
41
  }
45
42
 
46
-
47
43
  // Set states
48
44
  doneAnimating = false;
49
45
  origin.addClass('active');
@@ -68,8 +64,7 @@
68
64
  curr.css('overflow', 'visible');
69
65
  if (ancestorsChanged === undefined) {
70
66
  ancestorsChanged = curr;
71
- }
72
- else {
67
+ } else {
73
68
  ancestorsChanged = ancestorsChanged.add(curr);
74
69
  }
75
70
  }
@@ -81,19 +76,14 @@
81
76
  position: 'absolute',
82
77
  'z-index': 1000,
83
78
  'will-change': 'left, top, width, height'
84
- })
85
- .data('width', originalWidth)
86
- .data('height', originalHeight);
79
+ }).data('width', originalWidth).data('height', originalHeight);
87
80
 
88
81
  // Add overlay
89
- var overlay = $('<div id="materialbox-overlay"></div>')
90
- .css({
91
- opacity: 0
92
- })
93
- .click(function(){
94
- if (doneAnimating === true)
95
- returnToOriginal();
96
- });
82
+ var overlay = $('<div id="materialbox-overlay"></div>').css({
83
+ opacity: 0
84
+ }).click(function () {
85
+ if (doneAnimating === true) returnToOriginal();
86
+ });
97
87
 
98
88
  // Put before in origin image to preserve z-index layering.
99
89
  origin.before(overlay);
@@ -105,11 +95,10 @@
105
95
  height: windowHeight,
106
96
  left: -1 * overlayOffset.left,
107
97
  top: -1 * overlayOffset.top
108
- })
98
+ });
109
99
 
110
100
  // Animate Overlay
111
- overlay.velocity({opacity: 1},
112
- {duration: inDuration, queue: false, easing: 'easeOutQuad'} );
101
+ overlay.velocity({ opacity: 1 }, { duration: inDuration, queue: false, easing: 'easeOutQuad' });
113
102
 
114
103
  // Add and animate caption if it exists
115
104
  if (origin.data('caption') !== "") {
@@ -117,7 +106,7 @@
117
106
  $photo_caption.text(origin.data('caption'));
118
107
  $('body').append($photo_caption);
119
108
  $photo_caption.css({ "display": "inline" });
120
- $photo_caption.velocity({opacity: 1}, {duration: inDuration, queue: false, easing: 'easeOutQuad'});
109
+ $photo_caption.velocity({ opacity: 1 }, { duration: inDuration, queue: false, easing: 'easeOutQuad' });
121
110
  }
122
111
 
123
112
  // Resize Image
@@ -131,76 +120,66 @@
131
120
  ratio = originalHeight / originalWidth;
132
121
  newWidth = windowWidth * 0.9;
133
122
  newHeight = windowWidth * 0.9 * ratio;
134
- }
135
- else {
123
+ } else {
136
124
  ratio = originalWidth / originalHeight;
137
- newWidth = (windowHeight * 0.9) * ratio;
125
+ newWidth = windowHeight * 0.9 * ratio;
138
126
  newHeight = windowHeight * 0.9;
139
127
  }
140
128
 
141
129
  // Animate image + set z-index
142
- if(origin.hasClass('responsive-img')) {
143
- origin.velocity({'max-width': newWidth, 'width': originalWidth}, {duration: 0, queue: false,
144
- complete: function(){
145
- origin.css({left: 0, top: 0})
146
- .velocity(
147
- {
148
- height: newHeight,
149
- width: newWidth,
150
- left: $(document).scrollLeft() + windowWidth/2 - origin.parent('.material-placeholder').offset().left - newWidth/2,
151
- top: $(document).scrollTop() + windowHeight/2 - origin.parent('.material-placeholder').offset().top - newHeight/ 2
152
- },
153
- {
154
- duration: inDuration,
155
- queue: false,
156
- easing: 'easeOutQuad',
157
- complete: function(){doneAnimating = true;}
130
+ if (origin.hasClass('responsive-img')) {
131
+ origin.velocity({ 'max-width': newWidth, 'width': originalWidth }, { duration: 0, queue: false,
132
+ complete: function () {
133
+ origin.css({ left: 0, top: 0 }).velocity({
134
+ height: newHeight,
135
+ width: newWidth,
136
+ left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
137
+ top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
138
+ }, {
139
+ duration: inDuration,
140
+ queue: false,
141
+ easing: 'easeOutQuad',
142
+ complete: function () {
143
+ doneAnimating = true;
158
144
  }
159
- );
145
+ });
160
146
  } // End Complete
161
147
  }); // End Velocity
162
- }
163
- else {
164
- origin.css('left', 0)
165
- .css('top', 0)
166
- .velocity(
167
- {
168
- height: newHeight,
169
- width: newWidth,
170
- left: $(document).scrollLeft() + windowWidth/2 - origin.parent('.material-placeholder').offset().left - newWidth/2,
171
- top: $(document).scrollTop() + windowHeight/2 - origin.parent('.material-placeholder').offset().top - newHeight/ 2
172
- },
173
- {
174
- duration: inDuration,
175
- queue: false,
176
- easing: 'easeOutQuad',
177
- complete: function(){doneAnimating = true;}
148
+ } else {
149
+ origin.css('left', 0).css('top', 0).velocity({
150
+ height: newHeight,
151
+ width: newWidth,
152
+ left: $(document).scrollLeft() + windowWidth / 2 - origin.parent('.material-placeholder').offset().left - newWidth / 2,
153
+ top: $(document).scrollTop() + windowHeight / 2 - origin.parent('.material-placeholder').offset().top - newHeight / 2
154
+ }, {
155
+ duration: inDuration,
156
+ queue: false,
157
+ easing: 'easeOutQuad',
158
+ complete: function () {
159
+ doneAnimating = true;
178
160
  }
179
- ); // End Velocity
161
+ }); // End Velocity
180
162
  }
181
163
 
182
164
  // Handle Exit triggers
183
- $(window).on('scroll.materialbox', function() {
165
+ $(window).on('scroll.materialbox', function () {
184
166
  if (overlayActive) {
185
167
  returnToOriginal();
186
168
  }
187
169
  });
188
170
 
189
- $(window).on('resize.materialbox', function() {
171
+ $(window).on('resize.materialbox', function () {
190
172
  if (overlayActive) {
191
173
  returnToOriginal();
192
174
  }
193
175
  });
194
176
 
195
- $(document).on('keyup.materialbox', function(e) {
177
+ $(document).on('keyup.materialbox', function (e) {
196
178
  // ESC key
197
- if (e.keyCode === 27 &&
198
- doneAnimating === true &&
199
- overlayActive) {
179
+ if (e.keyCode === 27 && doneAnimating === true && overlayActive) {
200
180
  returnToOriginal();
201
181
  }
202
182
  });
203
-
204
183
  }); // End click handler
205
184
 
206
185
 
@@ -224,10 +203,10 @@
224
203
  $(document).off('keyup.materialbox');
225
204
  $(window).off('resize.materialbox');
226
205
 
227
- $('#materialbox-overlay').velocity({opacity: 0}, {
206
+ $('#materialbox-overlay').velocity({ opacity: 0 }, {
228
207
  duration: outDuration, // Delay prevents animation overlapping
229
208
  queue: false, easing: 'easeOutQuad',
230
- complete: function(){
209
+ complete: function () {
231
210
  // Remove Overlay
232
211
  overlayActive = false;
233
212
  $(this).remove();
@@ -235,55 +214,50 @@
235
214
  });
236
215
 
237
216
  // Resize Image
238
- origin.velocity(
239
- {
240
- width: originalWidth,
241
- height: originalHeight,
242
- left: 0,
243
- top: 0
244
- },
245
- {
246
- duration: outDuration,
247
- queue: false, easing: 'easeOutQuad',
248
- complete: function() {
249
- placeholder.css({
250
- height: '',
251
- width: '',
252
- position: '',
253
- top: '',
254
- left: ''
255
- });
256
-
257
- origin.removeAttr('style');
258
- origin.attr('style', originInlineStyles);
259
-
260
- // Remove class
261
- origin.removeClass('active');
262
- doneAnimating = true;
263
-
264
- // Remove overflow overrides on ancestors
265
- if (ancestorsChanged) {
266
- ancestorsChanged.css('overflow', '');
267
- }
217
+ origin.velocity({
218
+ width: originalWidth,
219
+ height: originalHeight,
220
+ left: 0,
221
+ top: 0
222
+ }, {
223
+ duration: outDuration,
224
+ queue: false, easing: 'easeOutQuad',
225
+ complete: function () {
226
+ placeholder.css({
227
+ height: '',
228
+ width: '',
229
+ position: '',
230
+ top: '',
231
+ left: ''
232
+ });
233
+
234
+ origin.removeAttr('style');
235
+ origin.attr('style', originInlineStyles);
236
+
237
+ // Remove class
238
+ origin.removeClass('active');
239
+ doneAnimating = true;
240
+
241
+ // Remove overflow overrides on ancestors
242
+ if (ancestorsChanged) {
243
+ ancestorsChanged.css('overflow', '');
268
244
  }
269
245
  }
270
- );
246
+ });
271
247
 
272
248
  // Remove Caption + reset css settings on image
273
- $('.materialbox-caption').velocity({opacity: 0}, {
249
+ $('.materialbox-caption').velocity({ opacity: 0 }, {
274
250
  duration: outDuration, // Delay prevents animation overlapping
275
251
  queue: false, easing: 'easeOutQuad',
276
- complete: function(){
252
+ complete: function () {
277
253
  $(this).remove();
278
254
  }
279
255
  });
280
-
281
256
  }
282
257
  });
283
258
  };
284
259
 
285
- $(document).on('ready turbolinks:load', function(){
260
+ $(document).on('ready turbolinks:load', function () {
286
261
  $('.materialboxed').materialbox();
287
262
  });
288
-
289
- }( jQuery ));
263
+ })(jQuery);