bootstrap-material-design 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d9d03bd14c3050ee8956c07cd9dc4f9cc28316e
4
- data.tar.gz: d1b763922760df4fdc8f7f5ab69fb4776d59a498
3
+ metadata.gz: e050d59b10f9e266f92d791194fe08178b9af7f1
4
+ data.tar.gz: 46ef06bf9319f1bb11d8f087dcb2efadb32c1a39
5
5
  SHA512:
6
- metadata.gz: 249f6cd97977e2cff63113ba83715c5c55040c44f19419beadafad211b5986745d618780d1b5a7e8b09d0e944d1d4075ea89163630939b2f7ac56afa158e78c9
7
- data.tar.gz: 1d5e1e74f4d7d4c1bfb419e8b5433f9ecc7d0665589daec9807a002854b7854438d1a4a565d1f9ccb35777e6a50068c8e79fbbfccc554370fec979be07a47ff7
6
+ metadata.gz: 040447111c651c8c4a419fc8ad4a40364c49a8bc00d6448ad9b2dbe014a0ba298d6c3caf3c064553deabb0415a549053184eea9bae53ad598aaaf83f63534ffa
7
+ data.tar.gz: d9463a3bf7f581a07a8194715e7763524de0cb65795af0c28772e8508ca94f7ed380593eb53e4b05506bc898e83b339e6ed98925bf9468effec6de896c5a03d4
@@ -1,80 +1,226 @@
1
- ! function(a) {
2
- function b(a) {
3
- return "undefined" == typeof a.which ? !0 : "number" == typeof a.which && a.which > 0 ? !a.ctrlKey && !a.metaKey && !a.altKey && 8 != a.which : !1
1
+ /* globals jQuery */
2
+
3
+ (function($) {
4
+ // Selector to select only not already processed elements
5
+ $.expr[":"].notmdproc = function(obj){
6
+ if ($(obj).data("mdproc")) {
7
+ return false;
8
+ } else {
9
+ return true;
4
10
  }
5
- a.expr[":"].notmdproc = function(b) {
6
- return a(b).data("mdproc") ? !1 : !0
7
- }, a.material = {
8
- options: {
9
- withRipples: [".btn:not(.btn-link)", ".card-image", ".navbar a:not(.withoutripple)", ".dropdown-menu a", ".nav-tabs a:not(.withoutripple)", ".withripple"].join(","),
10
- inputElements: "input.form-control, textarea.form-control, select.form-control",
11
- checkboxElements: ".checkbox > label > input[type=checkbox]",
12
- radioElements: ".radio > label > input[type=radio]"
13
- },
14
- checkbox: function(b) {
15
- a(b ? b : this.options.checkboxElements).filter(":notmdproc").data("mdproc", !0).after("<span class=ripple></span><span class=check></span>")
16
- },
17
- radio: function(b) {
18
- a(b ? b : this.options.radioElements).filter(":notmdproc").data("mdproc", !0).after("<span class=circle></span><span class=check></span>")
19
- },
20
- input: function(c) {
21
- a(c ? c : this.options.inputElements).filter(":notmdproc").data("mdproc", !0).each(function() {
22
- var b = a(this);
23
- if (b.wrap("<div class=form-control-wrapper></div>"), b.after("<span class=material-input></span>"), b.hasClass("floating-label")) {
24
- var c = b.attr("placeholder");
25
- b.attr("placeholder", null).removeClass("floating-label"), b.after("<div class=floating-label>" + c + "</div>")
26
- }
27
- if (b.attr("data-hint") && b.after("<div class=hint>" + b.attr("data-hint") + "</div>"), (null === b.val() || "undefined" == b.val() || "" === b.val()) && b.addClass("empty"), b.parent().next().is("[type=file]")) {
28
- b.parent().addClass("fileinput");
29
- var d = b.parent().next().detach();
30
- b.after(d)
31
- }
32
- }), a(document).on("change", ".checkbox input[type=checkbox]", function() {
33
- a(this).blur()
34
- }).on("keydown paste", ".form-control", function(c) {
35
- b(c) && a(this).removeClass("empty")
36
- }).on("keyup change", ".form-control", function() {
37
- var b = a(this);
38
- "" === b.val() ? b.addClass("empty") : b.removeClass("empty")
39
- }).on("focus", ".form-control-wrapper.fileinput", function() {
40
- a(this).find("input").addClass("focus")
41
- }).on("blur", ".form-control-wrapper.fileinput", function() {
42
- a(this).find("input").removeClass("focus")
43
- }).on("change", ".form-control-wrapper.fileinput [type=file]", function() {
44
- var b = "";
45
- a.each(a(this)[0].files, function(a, c) {
46
- console.log(c), b += c.name + ", "
47
- }), b = b.substring(0, b.length - 2), b ? a(this).prev().removeClass("empty") : a(this).prev().addClass("empty"), a(this).prev().val(b)
48
- })
49
- },
50
- ripples: function(a) {
51
- ripples.init(a ? a : this.options.withRipples)
52
- },
53
- init: function() {
54
- this.ripples(), this.input(), this.checkbox(), this.radio(), document.arrive && document.arrive("input, textarea, select", function() {
55
- a.material.init()
56
- }),
57
- function() {
58
- var b = setInterval(function() {
59
- a("input[type!=checkbox]").each(function() {
60
- a(this).val() && a(this).val() !== a(this).attr("value") && a(this).trigger("change")
61
- })
62
- }, 100);
63
- setTimeout(function() {
64
- clearInterval(b)
65
- }, 1e4);
66
- var c;
67
- a(document).on("focus", "input", function() {
68
- var b = a(this).parents("form").find("input");
69
- c = setInterval(function() {
70
- b.each(function() {
71
- a(this).val() !== a(this).attr("value") && a(this).trigger("change")
72
- })
73
- }, 100)
74
- }).on("blur", "input", function() {
75
- clearInterval(c)
76
- })
77
- }()
11
+ };
12
+
13
+ function _isChar(evt) {
14
+ if (typeof evt.which == "undefined") {
15
+ return true;
16
+ } else if (typeof evt.which == "number" && evt.which > 0) {
17
+ return !evt.ctrlKey && !evt.metaKey && !evt.altKey && evt.which != 8 && evt.which != 9;
18
+ }
19
+ return false;
20
+ }
21
+
22
+ $.material = {
23
+ "options": {
24
+ // These options set what will be started by $.material.init()
25
+ "input": true,
26
+ "ripples": true,
27
+ "checkbox": true,
28
+ "togglebutton": true,
29
+ "radio": true,
30
+ "arrive": true,
31
+ "autofill": false,
32
+
33
+ "withRipples": [
34
+ ".btn:not(.btn-link)",
35
+ ".card-image",
36
+ ".navbar a:not(.withoutripple)",
37
+ ".dropdown-menu a",
38
+ ".nav-tabs a:not(.withoutripple)",
39
+ ".withripple"
40
+ ].join(","),
41
+ "inputElements": "input.form-control, textarea.form-control, select.form-control",
42
+ "checkboxElements": ".checkbox > label > input[type=checkbox]",
43
+ "togglebuttonElements": ".togglebutton > label > input[type=checkbox]",
44
+ "radioElements": ".radio > label > input[type=radio]"
45
+ },
46
+ "checkbox": function(selector) {
47
+ // Add fake-checkbox to material checkboxes
48
+ $((selector) ? selector : this.options.checkboxElements)
49
+ .filter(":notmdproc")
50
+ .data("mdproc", true)
51
+ .after("<span class=ripple></span><span class=check></span>");
52
+ },
53
+ "togglebutton": function(selector) {
54
+ // Add fake-checkbox to material checkboxes
55
+ $((selector) ? selector : this.options.togglebuttonElements)
56
+ .filter(":notmdproc")
57
+ .data("mdproc", true)
58
+ .after("<span class=toggle></span>");
59
+ },
60
+ "radio": function(selector) {
61
+ // Add fake-radio to material radios
62
+ $((selector) ? selector : this.options.radioElements)
63
+ .filter(":notmdproc")
64
+ .data("mdproc", true)
65
+ .after("<span class=circle></span><span class=check></span>");
66
+ },
67
+ "input": function(selector) {
68
+ $((selector) ? selector : this.options.inputElements)
69
+ .filter(":notmdproc")
70
+ .data("mdproc", true)
71
+ .each( function() {
72
+ var $this = $(this);
73
+
74
+ if (!$(this).attr("data-hint") && !$this.hasClass("floating-label")) {
75
+ return;
76
+ }
77
+ $this.wrap("<div class=form-control-wrapper></div>");
78
+ $this.after("<span class=material-input></span>");
79
+
80
+ // Add floating label if required
81
+ if ($this.hasClass("floating-label")) {
82
+ var placeholder = $this.attr("placeholder");
83
+ $this.attr("placeholder", null).removeClass("floating-label");
84
+ $this.after("<div class=floating-label>" + placeholder + "</div>");
85
+ }
86
+
87
+ // Add hint label if required
88
+ if ($this.attr("data-hint")) {
89
+ $this.after("<div class=hint>" + $this.attr("data-hint") + "</div>");
90
+ }
91
+
92
+ // Set as empty if is empty (damn I must improve this...)
93
+ if ($this.val() === null || $this.val() == "undefined" || $this.val() === "") {
94
+ $this.addClass("empty");
95
+ }
96
+
97
+ // Support for file input
98
+ if ($this.parent().next().is("[type=file]")) {
99
+ $this.parent().addClass("fileinput");
100
+ var $input = $this.parent().next().detach();
101
+ $this.after($input);
102
+ }
103
+ });
104
+
105
+ $(document)
106
+ .on("change", ".checkbox input[type=checkbox]", function() { $(this).blur(); })
107
+ .on("keydown paste", ".form-control", function(e) {
108
+ if(_isChar(e)) {
109
+ $(this).removeClass("empty");
110
+ }
111
+ })
112
+ .on("keyup change", ".form-control", function() {
113
+ var $this = $(this);
114
+ if($this.val() === "" && $this[0].checkValidity()) {
115
+ $this.addClass("empty");
116
+ } else {
117
+ $this.removeClass("empty");
118
+ }
119
+ })
120
+ .on("focus", ".form-control-wrapper.fileinput", function() {
121
+ $(this).find("input").addClass("focus");
122
+ })
123
+ .on("blur", ".form-control-wrapper.fileinput", function() {
124
+ $(this).find("input").removeClass("focus");
125
+ })
126
+ .on("change", ".form-control-wrapper.fileinput [type=file]", function() {
127
+ var value = "";
128
+ $.each($(this)[0].files, function(i, file) {
129
+ value += file.name + ", ";
130
+ });
131
+ value = value.substring(0, value.length - 2);
132
+ if (value) {
133
+ $(this).prev().removeClass("empty");
134
+ } else {
135
+ $(this).prev().addClass("empty");
136
+ }
137
+ $(this).prev().val(value);
138
+ });
139
+ },
140
+ "ripples": function(selector) {
141
+ $((selector) ? selector : this.options.withRipples).ripples();
142
+ },
143
+ "autofill": function() {
144
+
145
+ // This part of code will detect autofill when the page is loading (username and password inputs for example)
146
+ var loading = setInterval(function() {
147
+ $("input[type!=checkbox]").each(function() {
148
+ if ($(this).val() && $(this).val() !== $(this).attr("value")) {
149
+ $(this).trigger("change");
150
+ }
151
+ });
152
+ }, 100);
153
+
154
+ // After 10 seconds we are quite sure all the needed inputs are autofilled then we can stop checking them
155
+ setTimeout(function() {
156
+ clearInterval(loading);
157
+ }, 10000);
158
+ // Now we just listen on inputs of the focused form (because user can select from the autofill dropdown only when the input has focus)
159
+ var focused;
160
+ $(document)
161
+ .on("focus", "input", function() {
162
+ var $inputs = $(this).parents("form").find("input").not("[type=file]");
163
+ focused = setInterval(function() {
164
+ $inputs.each(function() {
165
+ if ($(this).val() !== $(this).attr("value")) {
166
+ $(this).trigger("change");
167
+ }
168
+ });
169
+ }, 100);
170
+ })
171
+ .on("blur", "input", function() {
172
+ clearInterval(focused);
173
+ });
174
+ },
175
+ "init": function() {
176
+ if ($.fn.ripples && this.options.ripples) {
177
+ this.ripples();
178
+ }
179
+ if (this.options.input) {
180
+ this.input();
181
+ }
182
+ if (this.options.checkbox) {
183
+ this.checkbox();
184
+ }
185
+ if (this.options.togglebutton) {
186
+ this.togglebutton();
187
+ }
188
+ if (this.options.radio) {
189
+ this.radio();
190
+ }
191
+ if (this.options.autofill) {
192
+ this.autofill();
193
+ }
194
+
195
+ if (document.arrive && this.options.arrive) {
196
+ if ($.fn.ripples && this.options.ripples) {
197
+ $(document).arrive(this.options.withRipples, function() {
198
+ $.material.ripples($(this));
199
+ });
200
+ }
201
+ if (this.options.input) {
202
+ $(document).arrive(this.options.inputElements, function() {
203
+ $.material.input($(this));
204
+ });
205
+ }
206
+ if (this.options.checkbox) {
207
+ $(document).arrive(this.options.checkboxElements, function() {
208
+ $.material.checkbox($(this));
209
+ });
210
+ }
211
+ if (this.options.radio) {
212
+ $(document).arrive(this.options.radioElements, function() {
213
+ $.material.radio($(this));
214
+ });
215
+ }
216
+ if (this.options.togglebutton) {
217
+ $(document).arrive(this.options.togglebuttonElements, function() {
218
+ $.material.togglebutton($(this));
219
+ });
78
220
  }
221
+
222
+ }
79
223
  }
80
- }(jQuery);
224
+ };
225
+
226
+ })(jQuery);
@@ -1,79 +1,324 @@
1
- window.ripples = {
2
- done: !1,
3
- init: function(a) {
4
- "use strict";
5
-
6
- function b(a, b) {
7
- var c = a.matches || a.matchesSelector || a.webkitMatchesSelector || a.mozMatchesSelector || a.msMatchesSelector || a.oMatchesSelector;
8
- return c.call(a, b)
1
+ /* Copyright 2014+, Federico Zivolo, LICENSE at https://github.com/FezVrasta/bootstrap-material-design/blob/master/LICENSE.md */
2
+ /* globals jQuery, navigator */
3
+
4
+ (function($, window, document, undefined) {
5
+
6
+ "use strict";
7
+
8
+ /**
9
+ * Define the name of the plugin
10
+ */
11
+ var ripples = "ripples";
12
+
13
+
14
+ /**
15
+ * Get an instance of the plugin
16
+ */
17
+ var self = null;
18
+
19
+
20
+ /**
21
+ * Define the defaults of the plugin
22
+ */
23
+ var defaults = {};
24
+
25
+
26
+ /**
27
+ * Create the main plugin function
28
+ */
29
+ function Ripples(element, options) {
30
+ self = this;
31
+
32
+ this.element = $(element);
33
+
34
+ this.options = $.extend({}, defaults, options);
35
+
36
+ this._defaults = defaults;
37
+ this._name = ripples;
38
+
39
+ this.init();
40
+ }
41
+
42
+
43
+ /**
44
+ * Initialize the plugin
45
+ */
46
+ Ripples.prototype.init = function() {
47
+ var $element = this.element;
48
+
49
+ $element.on("mousedown touchstart", function(event) {
50
+ /**
51
+ * Verify if the user is just touching on a device and return if so
52
+ */
53
+ if(self.isTouch() && event.type === "mousedown") {
54
+ return false;
55
+ }
56
+
57
+
58
+ /**
59
+ * Verify if the current element already has a ripple wrapper element and
60
+ * creates if it doesn't
61
+ */
62
+ if(!($element.find(".ripple-wrapper").length)) {
63
+ $element.append("<div class=\"ripple-wrapper\"></div>");
64
+ }
65
+
66
+
67
+ /**
68
+ * Find the ripple wrapper
69
+ */
70
+ var $wrapper = $element.children(".ripple-wrapper");
71
+
72
+
73
+ /**
74
+ * Get relY and relX positions
75
+ */
76
+ var relY = self.getRelY($wrapper, event);
77
+ var relX = self.getRelX($wrapper, event);
78
+
79
+
80
+ /**
81
+ * If relY and/or relX are false, return the event
82
+ */
83
+ if(!relY && !relX) {
84
+ return;
85
+ }
86
+
87
+
88
+ /**
89
+ * Get the ripple color
90
+ */
91
+ var rippleColor = self.getRipplesColor($element);
92
+
93
+
94
+ /**
95
+ * Create the ripple element
96
+ */
97
+ var $ripple = $("<div></div>");
98
+
99
+ $ripple
100
+ .addClass("ripple")
101
+ .css({
102
+ "left": relX,
103
+ "top": relY,
104
+ "background-color": rippleColor
105
+ });
106
+
107
+
108
+ /**
109
+ * Append the ripple to the wrapper
110
+ */
111
+ $wrapper.append($ripple);
112
+
113
+
114
+ /**
115
+ * Make sure the ripple has the styles applied (ugly hack but it works)
116
+ */
117
+ (function() { return window.getComputedStyle($ripple[0]).opacity; })();
118
+
119
+
120
+ /**
121
+ * Turn on the ripple animation
122
+ */
123
+ self.rippleOn($element, $ripple);
124
+
125
+
126
+ /**
127
+ * Call the rippleEnd function when the transition "on" ends
128
+ */
129
+ setTimeout(function() {
130
+ self.rippleEnd($ripple);
131
+ }, 500);
132
+
133
+
134
+ /**
135
+ * Detect when the user leaves the element
136
+ */
137
+ $element.on("mouseup mouseleave touchend", function() {
138
+ $ripple.data("mousedown", "off");
139
+
140
+ if($ripple.data("animating") === "off") {
141
+ self.rippleOut($ripple);
9
142
  }
10
- if (this.done) return console.log("Ripples.js was already initialzied.");
11
- this.done = !0;
12
- var c = 100,
13
- d = 500,
14
- e = function(a, c, d) {
15
- "string" == typeof a && (a = [a]), a.forEach(function(a) {
16
- document.addEventListener(a, function(a) {
17
- var e = "number" != typeof a.detail ? a.detail : a.target;
18
- b(e, c) && d(a, e)
19
- })
20
- })
21
- },
22
- f = function(a, b, c) {
23
- var e, f = b,
24
- g = f.parentNode,
25
- h = document.createElement("div"),
26
- j = g.getBoundingClientRect(),
27
- k = {
28
- x: a.clientX - j.left,
29
- y: (window.ontouchstart ? a.clientY - window.scrollY : a.clientY) - j.top
30
- },
31
- l = "scale(" + Math.round(f.offsetWidth / 5) + ")",
32
- m = new CustomEvent("rippleEnd", {
33
- detail: h
34
- }),
35
- n = .3;
36
- a.touches && (k = {
37
- x: a.touches[0].clientX - j.left,
38
- y: a.touches[0].clientY - j.top
39
- }), i = h, h.className = "ripple", h.setAttribute("style", "left:" + k.x + "px; top:" + k.y + "px;");
40
- var o = window.getComputedStyle(g).color;
41
- if (o.indexOf("rgba") >= 0) {
42
- var p = o.lastIndexOf(",") + 1;
43
- o = o.substring(0, p) + n + ")"
44
- } else o = o.replace("rgb", "rgba").replace(")", ", " + n + ")");
45
- f.appendChild(h), e = window.getComputedStyle(h).opacity, h.dataset.animating = 1, h.className = "ripple ripple-on";
46
- var q = [h.getAttribute("style"), "background-color: " + o, "-ms-transform: " + l, "-moz-transform: " + l, "-webkit-transform: " + l, "transform: " + l];
47
- h.setAttribute("style", q.join(";")), setTimeout(function() {
48
- h.dataset.animating = 0, document.dispatchEvent(m), c && c()
49
- }, d)
50
- },
51
- g = function(a) {
52
- a.className = "ripple ripple-on ripple-out", setTimeout(function() {
53
- a.remove()
54
- }, c)
55
- },
56
- h = !1;
57
- e(["mousedown", "touchstart"], "*", function() {
58
- h = !0
59
- }), e(["mouseup", "touchend", "mouseout"], "*", function() {
60
- h = !1
61
- });
62
- var i, j = function(a, b) {
63
- if (0 === b.getElementsByClassName("ripple-wrapper").length) {
64
- b.className += " withripple";
65
- var c = document.createElement("div");
66
- c.className = "ripple-wrapper", b.appendChild(c)
67
- }
68
- };
69
- e(["mouseover"], a, j), e(["touchstart"], a, j), e(["mousedown", "touchstart"], ".ripple-wrapper", function(a, b) {
70
- (0 === a.which || 1 === a.which || 2 === a.which) && f(a, b)
71
- }), e("rippleEnd", ".ripple-wrapper .ripple", function(a, b) {
72
- var c = b.parentNode.getElementsByClassName("ripple");
73
- (!h || c[0] == b && c.length > 1) && g(b)
74
- }), e(["mouseup", "touchend", "mouseout"], ".ripple-wrapper", function() {
75
- var a = i;
76
- a && 1 != a.dataset.animating && g(a)
77
- })
143
+ });
144
+
145
+ });
146
+ };
147
+
148
+
149
+ /**
150
+ * Get the new size based on the element height/width and the ripple width
151
+ */
152
+ Ripples.prototype.getNewSize = function($element, $ripple) {
153
+
154
+ return (Math.max($element.outerWidth(), $element.outerHeight()) / $ripple.outerWidth()) * 2.5;
155
+ };
156
+
157
+
158
+ /**
159
+ * Get the relX
160
+ */
161
+ Ripples.prototype.getRelX = function($wrapper, event) {
162
+ var wrapperOffset = $wrapper.offset();
163
+
164
+ if(!self.isTouch()) {
165
+ /**
166
+ * Get the mouse position relative to the ripple wrapper
167
+ */
168
+ return event.pageX - wrapperOffset.left;
169
+ } else {
170
+ /**
171
+ * Make sure the user is using only one finger and then get the touch
172
+ * position relative to the ripple wrapper
173
+ */
174
+ event = event.originalEvent;
175
+
176
+ if(event.touches.length !== 1) {
177
+ return event.touches[0].pageX - wrapperOffset.left;
178
+ }
179
+
180
+ return false;
181
+ }
182
+ };
183
+
184
+
185
+ /**
186
+ * Get the relY
187
+ */
188
+ Ripples.prototype.getRelY = function($wrapper, event) {
189
+ var wrapperOffset = $wrapper.offset();
190
+
191
+ if(!self.isTouch()) {
192
+ /**
193
+ * Get the mouse position relative to the ripple wrapper
194
+ */
195
+ return event.pageY - wrapperOffset.top;
196
+ } else {
197
+ /**
198
+ * Make sure the user is using only one finger and then get the touch
199
+ * position relative to the ripple wrapper
200
+ */
201
+ event = event.originalEvent;
202
+
203
+ if(event.touches.length !== 1) {
204
+ return event.touches[0].pageY - wrapperOffset.top;
205
+ }
206
+
207
+ return false;
208
+ }
209
+ };
210
+
211
+
212
+ /**
213
+ * Get the ripple color
214
+ */
215
+ Ripples.prototype.getRipplesColor = function($element) {
216
+
217
+ var color = $element.data("ripple-color") ? $element.data("ripple-color") : window.getComputedStyle($element[0]).color;
218
+
219
+ return color;
220
+ };
221
+
222
+
223
+ /**
224
+ * Verify if the client browser has transistion support
225
+ */
226
+ Ripples.prototype.hasTransitionSupport = function() {
227
+ var thisBody = document.body || document.documentElement;
228
+ var thisStyle = thisBody.style;
229
+
230
+ var support = (
231
+ thisStyle.transition !== undefined ||
232
+ thisStyle.WebkitTransition !== undefined ||
233
+ thisStyle.MozTransition !== undefined ||
234
+ thisStyle.MsTransition !== undefined ||
235
+ thisStyle.OTransition !== undefined
236
+ );
237
+
238
+ return support;
239
+ };
240
+
241
+
242
+ /**
243
+ * Verify if the client is using a mobile device
244
+ */
245
+ Ripples.prototype.isTouch = function() {
246
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
247
+ };
248
+
249
+
250
+ /**
251
+ * End the animation of the ripple
252
+ */
253
+ Ripples.prototype.rippleEnd = function($ripple) {
254
+ $ripple.data("animating", "off");
255
+
256
+ if($ripple.data("mousedown") === "off") {
257
+ self.rippleOut($ripple);
258
+ }
259
+ };
260
+
261
+
262
+ /**
263
+ * Turn off the ripple effect
264
+ */
265
+ Ripples.prototype.rippleOut = function($ripple) {
266
+ $ripple.off();
267
+
268
+ if(self.hasTransitionSupport()) {
269
+ $ripple.addClass("ripple-out");
270
+ } else {
271
+ $ripple.animate({"opacity": 0}, 100, function() {
272
+ $ripple.trigger("transitionend");
273
+ });
274
+ }
275
+
276
+ $ripple.on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function() {
277
+ $ripple.remove();
278
+ });
279
+ };
280
+
281
+
282
+ /**
283
+ * Turn on the ripple effect
284
+ */
285
+ Ripples.prototype.rippleOn = function($element, $ripple) {
286
+ var size = self.getNewSize($element, $ripple);
287
+
288
+ if(self.hasTransitionSupport()) {
289
+ $ripple
290
+ .css({
291
+ "-ms-transform": "scale(" + size + ")",
292
+ "-moz-transform": "scale(" + size + ")",
293
+ "-webkit-transform": "scale(" + size + ")",
294
+ "transform": "scale(" + size + ")"
295
+ })
296
+ .addClass("ripple-on")
297
+ .data("animating", "on")
298
+ .data("mousedown", "on");
299
+ } else {
300
+ $ripple.animate({
301
+ "width": Math.max($element.outerWidth(), $element.outerHeight()) * 2,
302
+ "height": Math.max($element.outerWidth(), $element.outerHeight()) * 2,
303
+ "margin-left": Math.max($element.outerWidth(), $element.outerHeight()) * (-1),
304
+ "margin-top": Math.max($element.outerWidth(), $element.outerHeight()) * (-1),
305
+ "opacity": 0.2
306
+ }, 500, function() {
307
+ $ripple.trigger("transitionend");
308
+ });
78
309
  }
79
- };
310
+ };
311
+
312
+
313
+ /**
314
+ * Create the jquery plugin function
315
+ */
316
+ $.fn.ripples = function(options) {
317
+ return this.each(function() {
318
+ if(!$.data(this, "plugin_" + ripples)) {
319
+ $.data(this, "plugin_" + ripples, new Ripples(this, options));
320
+ }
321
+ });
322
+ };
323
+
324
+ })(jQuery, window, document);