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.
Files changed (153) hide show
  1. checksums.yaml +5 -5
  2. data/.gitattributes +1 -0
  3. data/.gitignore +3 -0
  4. data/README.md +48 -10
  5. data/Rakefile +129 -1
  6. data/assets/javascripts/materialize/anime.min.js +417 -0
  7. data/assets/javascripts/materialize/autocomplete.js +504 -0
  8. data/assets/javascripts/materialize/buttons.js +409 -0
  9. data/assets/javascripts/materialize/cards.js +34 -0
  10. data/assets/javascripts/materialize/carousel.js +797 -0
  11. data/assets/javascripts/materialize/cash.js +990 -0
  12. data/assets/javascripts/materialize/characterCounter.js +180 -0
  13. data/assets/javascripts/materialize/chips.js +564 -0
  14. data/assets/javascripts/materialize/collapsible.js +337 -0
  15. data/assets/javascripts/materialize/component.js +57 -0
  16. data/assets/javascripts/materialize/datepicker.js +935 -0
  17. data/assets/javascripts/materialize/dropdown.js +659 -0
  18. data/assets/javascripts/materialize/extras/nouislider.js +2147 -0
  19. data/assets/javascripts/materialize/extras/nouislider.min.js +1 -0
  20. data/assets/javascripts/materialize/forms.js +244 -0
  21. data/assets/javascripts/materialize/global.js +408 -0
  22. data/assets/javascripts/materialize/materialbox.js +513 -0
  23. data/assets/javascripts/materialize/modal.js +449 -0
  24. data/assets/javascripts/materialize/parallax.js +173 -0
  25. data/assets/javascripts/materialize/pushpin.js +179 -0
  26. data/assets/javascripts/materialize/range.js +310 -0
  27. data/assets/javascripts/materialize/scrollspy.js +328 -0
  28. data/assets/javascripts/materialize/select.js +497 -0
  29. data/assets/javascripts/materialize/sidenav.js +655 -0
  30. data/assets/javascripts/materialize/slider.js +424 -0
  31. data/assets/javascripts/materialize/tabs.js +476 -0
  32. data/assets/javascripts/materialize/tapTarget.js +364 -0
  33. data/assets/javascripts/materialize/timepicker.js +647 -0
  34. data/assets/javascripts/materialize/toasts.js +355 -0
  35. data/assets/javascripts/materialize/tooltip.js +351 -0
  36. data/{app/assets → assets}/javascripts/materialize/waves.js +42 -47
  37. data/assets/javascripts/materialize-sprockets.js +29 -0
  38. data/assets/javascripts/materialize.js +12374 -0
  39. data/assets/stylesheets/materialize/components/_badges.scss +55 -0
  40. data/assets/stylesheets/materialize/components/_buttons.scss +322 -0
  41. data/{app/assets → assets}/stylesheets/materialize/components/_cards.scss +72 -29
  42. data/assets/stylesheets/materialize/components/_carousel.scss +90 -0
  43. data/assets/stylesheets/materialize/components/_chips.scss +90 -0
  44. data/{app/assets → assets}/stylesheets/materialize/components/_collapsible.scss +23 -17
  45. data/assets/stylesheets/materialize/components/_color-classes.scss +32 -0
  46. data/{app/assets/stylesheets/materialize/components/_color.scss → assets/stylesheets/materialize/components/_color-variables.scss} +22 -64
  47. data/assets/stylesheets/materialize/components/_datepicker.scss +191 -0
  48. data/assets/stylesheets/materialize/components/_dropdown.scss +85 -0
  49. data/{app/assets → assets}/stylesheets/materialize/components/_global.scss +197 -144
  50. data/{app/assets → assets}/stylesheets/materialize/components/_grid.scss +57 -18
  51. data/assets/stylesheets/materialize/components/_icons-material-design.scss +5 -0
  52. data/{app/assets → assets}/stylesheets/materialize/components/_materialbox.scss +15 -13
  53. data/{app/assets → assets}/stylesheets/materialize/components/_modal.scss +18 -14
  54. data/{app/assets → assets}/stylesheets/materialize/components/_navbar.scss +89 -25
  55. data/assets/stylesheets/materialize/components/_normalize.scss +447 -0
  56. data/{app/assets → assets}/stylesheets/materialize/components/_preloader.scss +5 -3
  57. data/assets/stylesheets/materialize/components/_pulse.scss +34 -0
  58. data/assets/stylesheets/materialize/components/_sidenav.scss +208 -0
  59. data/{app/assets → assets}/stylesheets/materialize/components/_slider.scss +2 -2
  60. data/{app/assets → assets}/stylesheets/materialize/components/_table_of_contents.scss +5 -5
  61. data/assets/stylesheets/materialize/components/_tabs.scss +99 -0
  62. data/assets/stylesheets/materialize/components/_tapTarget.scss +103 -0
  63. data/assets/stylesheets/materialize/components/_timepicker.scss +183 -0
  64. data/{app/assets → assets}/stylesheets/materialize/components/_toast.scss +17 -22
  65. data/assets/stylesheets/materialize/components/_tooltip.scss +32 -0
  66. data/assets/stylesheets/materialize/components/_transitions.scss +13 -0
  67. data/{app/assets → assets}/stylesheets/materialize/components/_typography.scss +11 -9
  68. data/assets/stylesheets/materialize/components/_variables.scss +349 -0
  69. data/assets/stylesheets/materialize/components/_waves.scss +114 -0
  70. data/assets/stylesheets/materialize/components/forms/_checkboxes.scss +200 -0
  71. data/assets/stylesheets/materialize/components/forms/_file-input.scss +44 -0
  72. data/assets/stylesheets/materialize/components/forms/_forms.scss +22 -0
  73. data/assets/stylesheets/materialize/components/forms/_input-fields.scss +354 -0
  74. data/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +115 -0
  75. data/assets/stylesheets/materialize/components/forms/_range.scss +161 -0
  76. data/assets/stylesheets/materialize/components/forms/_select.scss +190 -0
  77. data/assets/stylesheets/materialize/components/forms/_switches.scss +89 -0
  78. data/assets/stylesheets/materialize/extras/nouislider.css +406 -0
  79. data/{app/assets → assets}/stylesheets/materialize.scss +13 -10
  80. data/lib/materialize-sass/engine.rb +11 -6
  81. data/lib/materialize-sass/helpers.rb +38 -0
  82. data/lib/materialize-sass/version.rb +1 -1
  83. data/lib/materialize-sass.rb +13 -28
  84. data/materialize-sass.gemspec +5 -5
  85. metadata +97 -105
  86. data/app/assets/fonts/material-design-icons/LICENSE.txt +0 -428
  87. data/app/assets/fonts/material-design-icons/Material-Design-Icons.eot +0 -0
  88. data/app/assets/fonts/material-design-icons/Material-Design-Icons.svg +0 -769
  89. data/app/assets/fonts/material-design-icons/Material-Design-Icons.ttf +0 -0
  90. data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff +0 -0
  91. data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff2 +0 -0
  92. data/app/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
  93. data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
  94. data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
  95. data/app/assets/fonts/roboto/Roboto-Light.ttf +0 -0
  96. data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
  97. data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
  98. data/app/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
  99. data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
  100. data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
  101. data/app/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
  102. data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
  103. data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
  104. data/app/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
  105. data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
  106. data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
  107. data/app/assets/javascripts/materialize/animation.js +0 -9
  108. data/app/assets/javascripts/materialize/buttons.js +0 -61
  109. data/app/assets/javascripts/materialize/cards.js +0 -27
  110. data/app/assets/javascripts/materialize/character_counter.js +0 -59
  111. data/app/assets/javascripts/materialize/collapsible.js +0 -139
  112. data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -1430
  113. data/app/assets/javascripts/materialize/date_picker/picker.js +0 -1123
  114. data/app/assets/javascripts/materialize/dropdown.js +0 -178
  115. data/app/assets/javascripts/materialize/forms.js +0 -456
  116. data/app/assets/javascripts/materialize/global.js +0 -36
  117. data/app/assets/javascripts/materialize/hammer.min.js +0 -1
  118. data/app/assets/javascripts/materialize/init.js +0 -136
  119. data/app/assets/javascripts/materialize/jquery.easing.1.3.js +0 -205
  120. data/app/assets/javascripts/materialize/jquery.hammer.js +0 -33
  121. data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -1
  122. data/app/assets/javascripts/materialize/leanModal.js +0 -178
  123. data/app/assets/javascripts/materialize/materialbox.js +0 -249
  124. data/app/assets/javascripts/materialize/parallax.js +0 -58
  125. data/app/assets/javascripts/materialize/prism.js +0 -8
  126. data/app/assets/javascripts/materialize/pushpin.js +0 -62
  127. data/app/assets/javascripts/materialize/scrollFire.js +0 -44
  128. data/app/assets/javascripts/materialize/scrollspy.js +0 -284
  129. data/app/assets/javascripts/materialize/sideNav.js +0 -312
  130. data/app/assets/javascripts/materialize/slider.js +0 -301
  131. data/app/assets/javascripts/materialize/tabs.js +0 -136
  132. data/app/assets/javascripts/materialize/toasts.js +0 -125
  133. data/app/assets/javascripts/materialize/tooltip.js +0 -166
  134. data/app/assets/javascripts/materialize/transitions.js +0 -154
  135. data/app/assets/javascripts/materialize/velocity.min.js +0 -4
  136. data/app/assets/javascripts/materialize-sprockets.js +0 -27
  137. data/app/assets/javascripts/materialize.js +0 -6159
  138. data/app/assets/stylesheets/materialize/components/_buttons.scss +0 -157
  139. data/app/assets/stylesheets/materialize/components/_dropdown.scss +0 -40
  140. data/app/assets/stylesheets/materialize/components/_form.scss +0 -886
  141. data/app/assets/stylesheets/materialize/components/_icons-material-design.scss +0 -3257
  142. data/app/assets/stylesheets/materialize/components/_mixins.scss +0 -5
  143. data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -427
  144. data/app/assets/stylesheets/materialize/components/_prefixer.scss +0 -376
  145. data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -38
  146. data/app/assets/stylesheets/materialize/components/_sideNav.scss +0 -111
  147. data/app/assets/stylesheets/materialize/components/_tabs.scss +0 -47
  148. data/app/assets/stylesheets/materialize/components/_tooltip.scss +0 -34
  149. data/app/assets/stylesheets/materialize/components/_variables.scss +0 -152
  150. data/app/assets/stylesheets/materialize/components/_waves.scss +0 -167
  151. data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +0 -435
  152. data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +0 -201
  153. data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +0 -125
@@ -0,0 +1,990 @@
1
+ /*! cash-dom 1.3.5, https://github.com/kenwheeler/cash @license MIT */
2
+ (function (factory) {
3
+ window.cash = factory();
4
+ })(function () {
5
+ var doc = document,
6
+ win = window,
7
+ ArrayProto = Array.prototype,
8
+ slice = ArrayProto.slice,
9
+ filter = ArrayProto.filter,
10
+ push = ArrayProto.push;
11
+
12
+ var noop = function () {},
13
+ isFunction = function (item) {
14
+ // @see https://crbug.com/568448
15
+ return typeof item === typeof noop && item.call;
16
+ },
17
+ isString = function (item) {
18
+ return typeof item === typeof "";
19
+ };
20
+
21
+ var idMatch = /^#[\w-]*$/,
22
+ classMatch = /^\.[\w-]*$/,
23
+ htmlMatch = /<.+>/,
24
+ singlet = /^\w+$/;
25
+
26
+ function find(selector, context) {
27
+ context = context || doc;
28
+ var elems = classMatch.test(selector) ? context.getElementsByClassName(selector.slice(1)) : singlet.test(selector) ? context.getElementsByTagName(selector) : context.querySelectorAll(selector);
29
+ return elems;
30
+ }
31
+
32
+ var frag;
33
+ function parseHTML(str) {
34
+ if (!frag) {
35
+ frag = doc.implementation.createHTMLDocument(null);
36
+ var base = frag.createElement("base");
37
+ base.href = doc.location.href;
38
+ frag.head.appendChild(base);
39
+ }
40
+
41
+ frag.body.innerHTML = str;
42
+
43
+ return frag.body.childNodes;
44
+ }
45
+
46
+ function onReady(fn) {
47
+ if (doc.readyState !== "loading") {
48
+ fn();
49
+ } else {
50
+ doc.addEventListener("DOMContentLoaded", fn);
51
+ }
52
+ }
53
+
54
+ function Init(selector, context) {
55
+ if (!selector) {
56
+ return this;
57
+ }
58
+
59
+ // If already a cash collection, don't do any further processing
60
+ if (selector.cash && selector !== win) {
61
+ return selector;
62
+ }
63
+
64
+ var elems = selector,
65
+ i = 0,
66
+ length;
67
+
68
+ if (isString(selector)) {
69
+ elems = idMatch.test(selector) ?
70
+ // If an ID use the faster getElementById check
71
+ doc.getElementById(selector.slice(1)) : htmlMatch.test(selector) ?
72
+ // If HTML, parse it into real elements
73
+ parseHTML(selector) :
74
+ // else use `find`
75
+ find(selector, context);
76
+
77
+ // If function, use as shortcut for DOM ready
78
+ } else if (isFunction(selector)) {
79
+ onReady(selector);return this;
80
+ }
81
+
82
+ if (!elems) {
83
+ return this;
84
+ }
85
+
86
+ // If a single DOM element is passed in or received via ID, return the single element
87
+ if (elems.nodeType || elems === win) {
88
+ this[0] = elems;
89
+ this.length = 1;
90
+ } else {
91
+ // Treat like an array and loop through each item.
92
+ length = this.length = elems.length;
93
+ for (; i < length; i++) {
94
+ this[i] = elems[i];
95
+ }
96
+ }
97
+
98
+ return this;
99
+ }
100
+
101
+ function cash(selector, context) {
102
+ return new Init(selector, context);
103
+ }
104
+
105
+ var fn = cash.fn = cash.prototype = Init.prototype = { // jshint ignore:line
106
+ cash: true,
107
+ length: 0,
108
+ push: push,
109
+ splice: ArrayProto.splice,
110
+ map: ArrayProto.map,
111
+ init: Init
112
+ };
113
+
114
+ Object.defineProperty(fn, "constructor", { value: cash });
115
+
116
+ cash.parseHTML = parseHTML;
117
+ cash.noop = noop;
118
+ cash.isFunction = isFunction;
119
+ cash.isString = isString;
120
+
121
+ cash.extend = fn.extend = function (target) {
122
+ target = target || {};
123
+
124
+ var args = slice.call(arguments),
125
+ length = args.length,
126
+ i = 1;
127
+
128
+ if (args.length === 1) {
129
+ target = this;
130
+ i = 0;
131
+ }
132
+
133
+ for (; i < length; i++) {
134
+ if (!args[i]) {
135
+ continue;
136
+ }
137
+ for (var key in args[i]) {
138
+ if (args[i].hasOwnProperty(key)) {
139
+ target[key] = args[i][key];
140
+ }
141
+ }
142
+ }
143
+
144
+ return target;
145
+ };
146
+
147
+ function each(collection, callback) {
148
+ var l = collection.length,
149
+ i = 0;
150
+
151
+ for (; i < l; i++) {
152
+ if (callback.call(collection[i], collection[i], i, collection) === false) {
153
+ break;
154
+ }
155
+ }
156
+ }
157
+
158
+ function matches(el, selector) {
159
+ var m = el && (el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector || el.oMatchesSelector);
160
+ return !!m && m.call(el, selector);
161
+ }
162
+
163
+ function getCompareFunction(selector) {
164
+ return (
165
+ /* Use browser's `matches` function if string */
166
+ isString(selector) ? matches :
167
+ /* Match a cash element */
168
+ selector.cash ? function (el) {
169
+ return selector.is(el);
170
+ } :
171
+ /* Direct comparison */
172
+ function (el, selector) {
173
+ return el === selector;
174
+ }
175
+ );
176
+ }
177
+
178
+ function unique(collection) {
179
+ return cash(slice.call(collection).filter(function (item, index, self) {
180
+ return self.indexOf(item) === index;
181
+ }));
182
+ }
183
+
184
+ cash.extend({
185
+ merge: function (first, second) {
186
+ var len = +second.length,
187
+ i = first.length,
188
+ j = 0;
189
+
190
+ for (; j < len; i++, j++) {
191
+ first[i] = second[j];
192
+ }
193
+
194
+ first.length = i;
195
+ return first;
196
+ },
197
+
198
+ each: each,
199
+ matches: matches,
200
+ unique: unique,
201
+ isArray: Array.isArray,
202
+ isNumeric: function (n) {
203
+ return !isNaN(parseFloat(n)) && isFinite(n);
204
+ }
205
+
206
+ });
207
+
208
+ var uid = cash.uid = "_cash" + Date.now();
209
+
210
+ function getDataCache(node) {
211
+ return node[uid] = node[uid] || {};
212
+ }
213
+
214
+ function setData(node, key, value) {
215
+ return getDataCache(node)[key] = value;
216
+ }
217
+
218
+ function getData(node, key) {
219
+ var c = getDataCache(node);
220
+ if (c[key] === undefined) {
221
+ c[key] = node.dataset ? node.dataset[key] : cash(node).attr("data-" + key);
222
+ }
223
+ return c[key];
224
+ }
225
+
226
+ function removeData(node, key) {
227
+ var c = getDataCache(node);
228
+ if (c) {
229
+ delete c[key];
230
+ } else if (node.dataset) {
231
+ delete node.dataset[key];
232
+ } else {
233
+ cash(node).removeAttr("data-" + name);
234
+ }
235
+ }
236
+
237
+ fn.extend({
238
+ data: function (name, value) {
239
+ if (isString(name)) {
240
+ return value === undefined ? getData(this[0], name) : this.each(function (v) {
241
+ return setData(v, name, value);
242
+ });
243
+ }
244
+
245
+ for (var key in name) {
246
+ this.data(key, name[key]);
247
+ }
248
+
249
+ return this;
250
+ },
251
+
252
+ removeData: function (key) {
253
+ return this.each(function (v) {
254
+ return removeData(v, key);
255
+ });
256
+ }
257
+
258
+ });
259
+
260
+ var notWhiteMatch = /\S+/g;
261
+
262
+ function getClasses(c) {
263
+ return isString(c) && c.match(notWhiteMatch);
264
+ }
265
+
266
+ function hasClass(v, c) {
267
+ return v.classList ? v.classList.contains(c) : new RegExp("(^| )" + c + "( |$)", "gi").test(v.className);
268
+ }
269
+
270
+ function addClass(v, c, spacedName) {
271
+ if (v.classList) {
272
+ v.classList.add(c);
273
+ } else if (spacedName.indexOf(" " + c + " ")) {
274
+ v.className += " " + c;
275
+ }
276
+ }
277
+
278
+ function removeClass(v, c) {
279
+ if (v.classList) {
280
+ v.classList.remove(c);
281
+ } else {
282
+ v.className = v.className.replace(c, "");
283
+ }
284
+ }
285
+
286
+ fn.extend({
287
+ addClass: function (c) {
288
+ var classes = getClasses(c);
289
+
290
+ return classes ? this.each(function (v) {
291
+ var spacedName = " " + v.className + " ";
292
+ each(classes, function (c) {
293
+ addClass(v, c, spacedName);
294
+ });
295
+ }) : this;
296
+ },
297
+
298
+ attr: function (name, value) {
299
+ if (!name) {
300
+ return undefined;
301
+ }
302
+
303
+ if (isString(name)) {
304
+ if (value === undefined) {
305
+ return this[0] ? this[0].getAttribute ? this[0].getAttribute(name) : this[0][name] : undefined;
306
+ }
307
+
308
+ return this.each(function (v) {
309
+ if (v.setAttribute) {
310
+ v.setAttribute(name, value);
311
+ } else {
312
+ v[name] = value;
313
+ }
314
+ });
315
+ }
316
+
317
+ for (var key in name) {
318
+ this.attr(key, name[key]);
319
+ }
320
+
321
+ return this;
322
+ },
323
+
324
+ hasClass: function (c) {
325
+ var check = false,
326
+ classes = getClasses(c);
327
+ if (classes && classes.length) {
328
+ this.each(function (v) {
329
+ check = hasClass(v, classes[0]);
330
+ return !check;
331
+ });
332
+ }
333
+ return check;
334
+ },
335
+
336
+ prop: function (name, value) {
337
+ if (isString(name)) {
338
+ return value === undefined ? this[0][name] : this.each(function (v) {
339
+ v[name] = value;
340
+ });
341
+ }
342
+
343
+ for (var key in name) {
344
+ this.prop(key, name[key]);
345
+ }
346
+
347
+ return this;
348
+ },
349
+
350
+ removeAttr: function (name) {
351
+ return this.each(function (v) {
352
+ if (v.removeAttribute) {
353
+ v.removeAttribute(name);
354
+ } else {
355
+ delete v[name];
356
+ }
357
+ });
358
+ },
359
+
360
+ removeClass: function (c) {
361
+ if (!arguments.length) {
362
+ return this.attr("class", "");
363
+ }
364
+ var classes = getClasses(c);
365
+ return classes ? this.each(function (v) {
366
+ each(classes, function (c) {
367
+ removeClass(v, c);
368
+ });
369
+ }) : this;
370
+ },
371
+
372
+ removeProp: function (name) {
373
+ return this.each(function (v) {
374
+ delete v[name];
375
+ });
376
+ },
377
+
378
+ toggleClass: function (c, state) {
379
+ if (state !== undefined) {
380
+ return this[state ? "addClass" : "removeClass"](c);
381
+ }
382
+ var classes = getClasses(c);
383
+ return classes ? this.each(function (v) {
384
+ var spacedName = " " + v.className + " ";
385
+ each(classes, function (c) {
386
+ if (hasClass(v, c)) {
387
+ removeClass(v, c);
388
+ } else {
389
+ addClass(v, c, spacedName);
390
+ }
391
+ });
392
+ }) : this;
393
+ } });
394
+
395
+ fn.extend({
396
+ add: function (selector, context) {
397
+ return unique(cash.merge(this, cash(selector, context)));
398
+ },
399
+
400
+ each: function (callback) {
401
+ each(this, callback);
402
+ return this;
403
+ },
404
+
405
+ eq: function (index) {
406
+ return cash(this.get(index));
407
+ },
408
+
409
+ filter: function (selector) {
410
+ if (!selector) {
411
+ return this;
412
+ }
413
+
414
+ var comparator = isFunction(selector) ? selector : getCompareFunction(selector);
415
+
416
+ return cash(filter.call(this, function (e) {
417
+ return comparator(e, selector);
418
+ }));
419
+ },
420
+
421
+ first: function () {
422
+ return this.eq(0);
423
+ },
424
+
425
+ get: function (index) {
426
+ if (index === undefined) {
427
+ return slice.call(this);
428
+ }
429
+ return index < 0 ? this[index + this.length] : this[index];
430
+ },
431
+
432
+ index: function (elem) {
433
+ var child = elem ? cash(elem)[0] : this[0],
434
+ collection = elem ? this : cash(child).parent().children();
435
+ return slice.call(collection).indexOf(child);
436
+ },
437
+
438
+ last: function () {
439
+ return this.eq(-1);
440
+ }
441
+
442
+ });
443
+
444
+ var camelCase = function () {
445
+ var camelRegex = /(?:^\w|[A-Z]|\b\w)/g,
446
+ whiteSpace = /[\s-_]+/g;
447
+ return function (str) {
448
+ return str.replace(camelRegex, function (letter, index) {
449
+ return letter[index === 0 ? "toLowerCase" : "toUpperCase"]();
450
+ }).replace(whiteSpace, "");
451
+ };
452
+ }();
453
+
454
+ var getPrefixedProp = function () {
455
+ var cache = {},
456
+ doc = document,
457
+ div = doc.createElement("div"),
458
+ style = div.style;
459
+
460
+ return function (prop) {
461
+ prop = camelCase(prop);
462
+ if (cache[prop]) {
463
+ return cache[prop];
464
+ }
465
+
466
+ var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
467
+ prefixes = ["webkit", "moz", "ms", "o"],
468
+ props = (prop + " " + prefixes.join(ucProp + " ") + ucProp).split(" ");
469
+
470
+ each(props, function (p) {
471
+ if (p in style) {
472
+ cache[p] = prop = cache[prop] = p;
473
+ return false;
474
+ }
475
+ });
476
+
477
+ return cache[prop];
478
+ };
479
+ }();
480
+
481
+ cash.prefixedProp = getPrefixedProp;
482
+ cash.camelCase = camelCase;
483
+
484
+ fn.extend({
485
+ css: function (prop, value) {
486
+ if (isString(prop)) {
487
+ prop = getPrefixedProp(prop);
488
+ return arguments.length > 1 ? this.each(function (v) {
489
+ return v.style[prop] = value;
490
+ }) : win.getComputedStyle(this[0])[prop];
491
+ }
492
+
493
+ for (var key in prop) {
494
+ this.css(key, prop[key]);
495
+ }
496
+
497
+ return this;
498
+ }
499
+
500
+ });
501
+
502
+ function compute(el, prop) {
503
+ return parseInt(win.getComputedStyle(el[0], null)[prop], 10) || 0;
504
+ }
505
+
506
+ each(["Width", "Height"], function (v) {
507
+ var lower = v.toLowerCase();
508
+
509
+ fn[lower] = function () {
510
+ return this[0].getBoundingClientRect()[lower];
511
+ };
512
+
513
+ fn["inner" + v] = function () {
514
+ return this[0]["client" + v];
515
+ };
516
+
517
+ fn["outer" + v] = function (margins) {
518
+ return this[0]["offset" + v] + (margins ? compute(this, "margin" + (v === "Width" ? "Left" : "Top")) + compute(this, "margin" + (v === "Width" ? "Right" : "Bottom")) : 0);
519
+ };
520
+ });
521
+
522
+ function registerEvent(node, eventName, callback) {
523
+ var eventCache = getData(node, "_cashEvents") || setData(node, "_cashEvents", {});
524
+ eventCache[eventName] = eventCache[eventName] || [];
525
+ eventCache[eventName].push(callback);
526
+ node.addEventListener(eventName, callback);
527
+ }
528
+
529
+ function removeEvent(node, eventName, callback) {
530
+ var events = getData(node, "_cashEvents"),
531
+ eventCache = events && events[eventName],
532
+ index;
533
+
534
+ if (!eventCache) {
535
+ return;
536
+ }
537
+
538
+ if (callback) {
539
+ node.removeEventListener(eventName, callback);
540
+ index = eventCache.indexOf(callback);
541
+ if (index >= 0) {
542
+ eventCache.splice(index, 1);
543
+ }
544
+ } else {
545
+ each(eventCache, function (event) {
546
+ node.removeEventListener(eventName, event);
547
+ });
548
+ eventCache = [];
549
+ }
550
+ }
551
+
552
+ fn.extend({
553
+ off: function (eventName, callback) {
554
+ return this.each(function (v) {
555
+ return removeEvent(v, eventName, callback);
556
+ });
557
+ },
558
+
559
+ on: function (eventName, delegate, callback, runOnce) {
560
+ // jshint ignore:line
561
+ var originalCallback;
562
+ if (!isString(eventName)) {
563
+ for (var key in eventName) {
564
+ this.on(key, delegate, eventName[key]);
565
+ }
566
+ return this;
567
+ }
568
+
569
+ if (isFunction(delegate)) {
570
+ callback = delegate;
571
+ delegate = null;
572
+ }
573
+
574
+ if (eventName === "ready") {
575
+ onReady(callback);
576
+ return this;
577
+ }
578
+
579
+ if (delegate) {
580
+ originalCallback = callback;
581
+ callback = function (e) {
582
+ var t = e.target;
583
+ while (!matches(t, delegate)) {
584
+ if (t === this || t === null) {
585
+ return t = false;
586
+ }
587
+
588
+ t = t.parentNode;
589
+ }
590
+
591
+ if (t) {
592
+ originalCallback.call(t, e);
593
+ }
594
+ };
595
+ }
596
+
597
+ return this.each(function (v) {
598
+ var finalCallback = callback;
599
+ if (runOnce) {
600
+ finalCallback = function () {
601
+ callback.apply(this, arguments);
602
+ removeEvent(v, eventName, finalCallback);
603
+ };
604
+ }
605
+ registerEvent(v, eventName, finalCallback);
606
+ });
607
+ },
608
+
609
+ one: function (eventName, delegate, callback) {
610
+ return this.on(eventName, delegate, callback, true);
611
+ },
612
+
613
+ ready: onReady,
614
+
615
+ /**
616
+ * Modified
617
+ * Triggers browser event
618
+ * @param String eventName
619
+ * @param Object data - Add properties to event object
620
+ */
621
+ trigger: function (eventName, data) {
622
+ if (document.createEvent) {
623
+ var evt = document.createEvent('HTMLEvents');
624
+ evt.initEvent(eventName, true, false);
625
+ evt = this.extend(evt, data);
626
+ return this.each(function (v) {
627
+ return v.dispatchEvent(evt);
628
+ });
629
+ }
630
+ }
631
+
632
+ });
633
+
634
+ function encode(name, value) {
635
+ return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+");
636
+ }
637
+
638
+ function getSelectMultiple_(el) {
639
+ var values = [];
640
+ each(el.options, function (o) {
641
+ if (o.selected) {
642
+ values.push(o.value);
643
+ }
644
+ });
645
+ return values.length ? values : null;
646
+ }
647
+
648
+ function getSelectSingle_(el) {
649
+ var selectedIndex = el.selectedIndex;
650
+ return selectedIndex >= 0 ? el.options[selectedIndex].value : null;
651
+ }
652
+
653
+ function getValue(el) {
654
+ var type = el.type;
655
+ if (!type) {
656
+ return null;
657
+ }
658
+ switch (type.toLowerCase()) {
659
+ case "select-one":
660
+ return getSelectSingle_(el);
661
+ case "select-multiple":
662
+ return getSelectMultiple_(el);
663
+ case "radio":
664
+ return el.checked ? el.value : null;
665
+ case "checkbox":
666
+ return el.checked ? el.value : null;
667
+ default:
668
+ return el.value ? el.value : null;
669
+ }
670
+ }
671
+
672
+ fn.extend({
673
+ serialize: function () {
674
+ var query = "";
675
+
676
+ each(this[0].elements || this, function (el) {
677
+ if (el.disabled || el.tagName === "FIELDSET") {
678
+ return;
679
+ }
680
+ var name = el.name;
681
+ switch (el.type.toLowerCase()) {
682
+ case "file":
683
+ case "reset":
684
+ case "submit":
685
+ case "button":
686
+ break;
687
+ case "select-multiple":
688
+ var values = getValue(el);
689
+ if (values !== null) {
690
+ each(values, function (value) {
691
+ query += encode(name, value);
692
+ });
693
+ }
694
+ break;
695
+ default:
696
+ var value = getValue(el);
697
+ if (value !== null) {
698
+ query += encode(name, value);
699
+ }
700
+ }
701
+ });
702
+
703
+ return query.substr(1);
704
+ },
705
+
706
+ val: function (value) {
707
+ if (value === undefined) {
708
+ return getValue(this[0]);
709
+ }
710
+
711
+ return this.each(function (v) {
712
+ return v.value = value;
713
+ });
714
+ }
715
+
716
+ });
717
+
718
+ function insertElement(el, child, prepend) {
719
+ if (prepend) {
720
+ var first = el.childNodes[0];
721
+ el.insertBefore(child, first);
722
+ } else {
723
+ el.appendChild(child);
724
+ }
725
+ }
726
+
727
+ function insertContent(parent, child, prepend) {
728
+ var str = isString(child);
729
+
730
+ if (!str && child.length) {
731
+ each(child, function (v) {
732
+ return insertContent(parent, v, prepend);
733
+ });
734
+ return;
735
+ }
736
+
737
+ each(parent, str ? function (v) {
738
+ return v.insertAdjacentHTML(prepend ? "afterbegin" : "beforeend", child);
739
+ } : function (v, i) {
740
+ return insertElement(v, i === 0 ? child : child.cloneNode(true), prepend);
741
+ });
742
+ }
743
+
744
+ fn.extend({
745
+ after: function (selector) {
746
+ cash(selector).insertAfter(this);
747
+ return this;
748
+ },
749
+
750
+ append: function (content) {
751
+ insertContent(this, content);
752
+ return this;
753
+ },
754
+
755
+ appendTo: function (parent) {
756
+ insertContent(cash(parent), this);
757
+ return this;
758
+ },
759
+
760
+ before: function (selector) {
761
+ cash(selector).insertBefore(this);
762
+ return this;
763
+ },
764
+
765
+ clone: function () {
766
+ return cash(this.map(function (v) {
767
+ return v.cloneNode(true);
768
+ }));
769
+ },
770
+
771
+ empty: function () {
772
+ this.html("");
773
+ return this;
774
+ },
775
+
776
+ html: function (content) {
777
+ if (content === undefined) {
778
+ return this[0].innerHTML;
779
+ }
780
+ var source = content.nodeType ? content[0].outerHTML : content;
781
+ return this.each(function (v) {
782
+ return v.innerHTML = source;
783
+ });
784
+ },
785
+
786
+ insertAfter: function (selector) {
787
+ var _this = this;
788
+
789
+ cash(selector).each(function (el, i) {
790
+ var parent = el.parentNode,
791
+ sibling = el.nextSibling;
792
+ _this.each(function (v) {
793
+ parent.insertBefore(i === 0 ? v : v.cloneNode(true), sibling);
794
+ });
795
+ });
796
+
797
+ return this;
798
+ },
799
+
800
+ insertBefore: function (selector) {
801
+ var _this2 = this;
802
+ cash(selector).each(function (el, i) {
803
+ var parent = el.parentNode;
804
+ _this2.each(function (v) {
805
+ parent.insertBefore(i === 0 ? v : v.cloneNode(true), el);
806
+ });
807
+ });
808
+ return this;
809
+ },
810
+
811
+ prepend: function (content) {
812
+ insertContent(this, content, true);
813
+ return this;
814
+ },
815
+
816
+ prependTo: function (parent) {
817
+ insertContent(cash(parent), this, true);
818
+ return this;
819
+ },
820
+
821
+ remove: function () {
822
+ return this.each(function (v) {
823
+ if (!!v.parentNode) {
824
+ return v.parentNode.removeChild(v);
825
+ }
826
+ });
827
+ },
828
+
829
+ text: function (content) {
830
+ if (content === undefined) {
831
+ return this[0].textContent;
832
+ }
833
+ return this.each(function (v) {
834
+ return v.textContent = content;
835
+ });
836
+ }
837
+
838
+ });
839
+
840
+ var docEl = doc.documentElement;
841
+
842
+ fn.extend({
843
+ position: function () {
844
+ var el = this[0];
845
+ return {
846
+ left: el.offsetLeft,
847
+ top: el.offsetTop
848
+ };
849
+ },
850
+
851
+ offset: function () {
852
+ var rect = this[0].getBoundingClientRect();
853
+ return {
854
+ top: rect.top + win.pageYOffset - docEl.clientTop,
855
+ left: rect.left + win.pageXOffset - docEl.clientLeft
856
+ };
857
+ },
858
+
859
+ offsetParent: function () {
860
+ return cash(this[0].offsetParent);
861
+ }
862
+
863
+ });
864
+
865
+ fn.extend({
866
+ children: function (selector) {
867
+ var elems = [];
868
+ this.each(function (el) {
869
+ push.apply(elems, el.children);
870
+ });
871
+ elems = unique(elems);
872
+
873
+ return !selector ? elems : elems.filter(function (v) {
874
+ return matches(v, selector);
875
+ });
876
+ },
877
+
878
+ closest: function (selector) {
879
+ if (!selector || this.length < 1) {
880
+ return cash();
881
+ }
882
+ if (this.is(selector)) {
883
+ return this.filter(selector);
884
+ }
885
+ return this.parent().closest(selector);
886
+ },
887
+
888
+ is: function (selector) {
889
+ if (!selector) {
890
+ return false;
891
+ }
892
+
893
+ var match = false,
894
+ comparator = getCompareFunction(selector);
895
+
896
+ this.each(function (el) {
897
+ match = comparator(el, selector);
898
+ return !match;
899
+ });
900
+
901
+ return match;
902
+ },
903
+
904
+ find: function (selector) {
905
+ if (!selector || selector.nodeType) {
906
+ return cash(selector && this.has(selector).length ? selector : null);
907
+ }
908
+
909
+ var elems = [];
910
+ this.each(function (el) {
911
+ push.apply(elems, find(selector, el));
912
+ });
913
+
914
+ return unique(elems);
915
+ },
916
+
917
+ has: function (selector) {
918
+ var comparator = isString(selector) ? function (el) {
919
+ return find(selector, el).length !== 0;
920
+ } : function (el) {
921
+ return el.contains(selector);
922
+ };
923
+
924
+ return this.filter(comparator);
925
+ },
926
+
927
+ next: function () {
928
+ return cash(this[0].nextElementSibling);
929
+ },
930
+
931
+ not: function (selector) {
932
+ if (!selector) {
933
+ return this;
934
+ }
935
+
936
+ var comparator = getCompareFunction(selector);
937
+
938
+ return this.filter(function (el) {
939
+ return !comparator(el, selector);
940
+ });
941
+ },
942
+
943
+ parent: function () {
944
+ var result = [];
945
+
946
+ this.each(function (item) {
947
+ if (item && item.parentNode) {
948
+ result.push(item.parentNode);
949
+ }
950
+ });
951
+
952
+ return unique(result);
953
+ },
954
+
955
+ parents: function (selector) {
956
+ var last,
957
+ result = [];
958
+
959
+ this.each(function (item) {
960
+ last = item;
961
+
962
+ while (last && last.parentNode && last !== doc.body.parentNode) {
963
+ last = last.parentNode;
964
+
965
+ if (!selector || selector && matches(last, selector)) {
966
+ result.push(last);
967
+ }
968
+ }
969
+ });
970
+
971
+ return unique(result);
972
+ },
973
+
974
+ prev: function () {
975
+ return cash(this[0].previousElementSibling);
976
+ },
977
+
978
+ siblings: function (selector) {
979
+ var collection = this.parent().children(selector),
980
+ el = this[0];
981
+
982
+ return collection.filter(function (i) {
983
+ return i !== el;
984
+ });
985
+ }
986
+
987
+ });
988
+
989
+ return cash;
990
+ });