materialize-sass 0.100.2.1 → 1.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +18 -42
  3. data/Rakefile +17 -17
  4. data/{app/assets → assets}/javascripts/materialize-sprockets.js +8 -12
  5. data/assets/javascripts/materialize.js +11877 -0
  6. data/assets/javascripts/materialize/autocomplete.js +420 -0
  7. data/assets/javascripts/materialize/buttons.js +388 -0
  8. data/assets/javascripts/materialize/cards.js +28 -0
  9. data/assets/javascripts/materialize/carousel.js +791 -0
  10. data/assets/javascripts/materialize/cash.js +992 -0
  11. data/assets/javascripts/materialize/characterCounter.js +180 -0
  12. data/assets/javascripts/materialize/chips.js +555 -0
  13. data/assets/javascripts/materialize/collapsible.js +275 -0
  14. data/assets/javascripts/materialize/datepicker.js +898 -0
  15. data/assets/javascripts/materialize/dropdown.js +530 -0
  16. data/{app/assets → assets}/javascripts/materialize/extras/nouislider.js +1 -1
  17. data/{app/assets → assets}/javascripts/materialize/extras/nouislider.min.js +1 -1
  18. data/assets/javascripts/materialize/forms.js +223 -0
  19. data/assets/javascripts/materialize/global.js +353 -0
  20. data/assets/javascripts/materialize/materialbox.js +432 -0
  21. data/{app/assets → assets}/javascripts/materialize/modal.js +82 -113
  22. data/assets/javascripts/materialize/parallax.js +135 -0
  23. data/assets/javascripts/materialize/pushpin.js +158 -0
  24. data/assets/javascripts/materialize/range.js +305 -0
  25. data/assets/javascripts/materialize/scrollspy.js +322 -0
  26. data/assets/javascripts/materialize/select.js +426 -0
  27. data/assets/javascripts/materialize/sidenav.js +584 -0
  28. data/assets/javascripts/materialize/slider.js +383 -0
  29. data/assets/javascripts/materialize/tabs.js +460 -0
  30. data/assets/javascripts/materialize/tapTarget.js +347 -0
  31. data/assets/javascripts/materialize/timepicker.js +616 -0
  32. data/{app/assets → assets}/javascripts/materialize/toasts.js +42 -46
  33. data/assets/javascripts/materialize/tooltip.js +325 -0
  34. data/assets/javascripts/materialize/velocity.min.js +782 -0
  35. data/{app/assets → assets}/javascripts/materialize/waves.js +0 -0
  36. data/{app/assets → assets}/stylesheets/materialize.scss +5 -6
  37. data/{app/assets → assets}/stylesheets/materialize/components/_badges.scss +1 -1
  38. data/{app/assets → assets}/stylesheets/materialize/components/_buttons.scss +34 -2
  39. data/{app/assets → assets}/stylesheets/materialize/components/_cards.scss +0 -0
  40. data/{app/assets → assets}/stylesheets/materialize/components/_carousel.scss +1 -1
  41. data/{app/assets → assets}/stylesheets/materialize/components/_chips.scss +6 -5
  42. data/{app/assets → assets}/stylesheets/materialize/components/_collapsible.scss +3 -3
  43. data/{app/assets → assets}/stylesheets/materialize/components/_color.scss +0 -0
  44. data/assets/stylesheets/materialize/components/_datepicker.scss +180 -0
  45. data/{app/assets → assets}/stylesheets/materialize/components/_dropdown.scss +16 -15
  46. data/{app/assets → assets}/stylesheets/materialize/components/_global.scss +49 -14
  47. data/{app/assets → assets}/stylesheets/materialize/components/_grid.scss +1 -1
  48. data/{app/assets → assets}/stylesheets/materialize/components/_icons-material-design.scss +0 -0
  49. data/{app/assets → assets}/stylesheets/materialize/components/_materialbox.scss +0 -0
  50. data/assets/stylesheets/materialize/components/_mixins.scss +5 -0
  51. data/{app/assets → assets}/stylesheets/materialize/components/_modal.scss +1 -1
  52. data/{app/assets → assets}/stylesheets/materialize/components/_navbar.scss +0 -0
  53. data/assets/stylesheets/materialize/components/_normalize.scss +447 -0
  54. data/{app/assets → assets}/stylesheets/materialize/components/_preloader.scss +0 -0
  55. data/{app/assets → assets}/stylesheets/materialize/components/_pulse.scss +0 -0
  56. data/{app/assets/stylesheets/materialize/components/_sideNav.scss → assets/stylesheets/materialize/components/_sidenav.scss} +23 -21
  57. data/{app/assets → assets}/stylesheets/materialize/components/_slider.scss +0 -0
  58. data/{app/assets → assets}/stylesheets/materialize/components/_table_of_contents.scss +3 -3
  59. data/{app/assets → assets}/stylesheets/materialize/components/_tabs.scss +2 -2
  60. data/{app/assets → assets}/stylesheets/materialize/components/_tapTarget.scss +0 -0
  61. data/assets/stylesheets/materialize/components/_timepicker.scss +182 -0
  62. data/{app/assets → assets}/stylesheets/materialize/components/_toast.scss +0 -0
  63. data/{app/assets → assets}/stylesheets/materialize/components/_tooltip.scss +1 -0
  64. data/{app/assets → assets}/stylesheets/materialize/components/_transitions.scss +0 -0
  65. data/{app/assets → assets}/stylesheets/materialize/components/_typography.scss +8 -8
  66. data/{app/assets → assets}/stylesheets/materialize/components/_variables.scss +42 -44
  67. data/{app/assets → assets}/stylesheets/materialize/components/_waves.scss +0 -0
  68. data/{app/assets → assets}/stylesheets/materialize/components/forms/_checkboxes.scss +24 -24
  69. data/{app/assets → assets}/stylesheets/materialize/components/forms/_file-input.scss +0 -0
  70. data/{app/assets → assets}/stylesheets/materialize/components/forms/_forms.scss +0 -0
  71. data/{app/assets → assets}/stylesheets/materialize/components/forms/_input-fields.scss +49 -35
  72. data/{app/assets → assets}/stylesheets/materialize/components/forms/_radio-buttons.scss +29 -29
  73. data/{app/assets → assets}/stylesheets/materialize/components/forms/_range.scss +32 -31
  74. data/{app/assets → assets}/stylesheets/materialize/components/forms/_select.scss +20 -11
  75. data/{app/assets → assets}/stylesheets/materialize/components/forms/_switches.scss +0 -0
  76. data/{app/assets → assets}/stylesheets/materialize/extras/nouislider.css +1 -1
  77. data/lib/materialize-sass.rb +13 -23
  78. data/lib/materialize-sass/engine.rb +6 -9
  79. data/lib/materialize-sass/version.rb +1 -1
  80. data/materialize-sass.gemspec +2 -1
  81. metadata +97 -97
  82. data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
  83. data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
  84. data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
  85. data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
  86. data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
  87. data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
  88. data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
  89. data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
  90. data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
  91. data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
  92. data/app/assets/javascripts/materialize.js +0 -10021
  93. data/app/assets/javascripts/materialize/animation.js +0 -7
  94. data/app/assets/javascripts/materialize/buttons.js +0 -253
  95. data/app/assets/javascripts/materialize/cards.js +0 -28
  96. data/app/assets/javascripts/materialize/carousel.js +0 -543
  97. data/app/assets/javascripts/materialize/character_counter.js +0 -64
  98. data/app/assets/javascripts/materialize/chips.js +0 -315
  99. data/app/assets/javascripts/materialize/collapsible.js +0 -178
  100. data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -1399
  101. data/app/assets/javascripts/materialize/date_picker/picker.js +0 -1196
  102. data/app/assets/javascripts/materialize/date_picker/picker.time.js +0 -646
  103. data/app/assets/javascripts/materialize/dropdown.js +0 -257
  104. data/app/assets/javascripts/materialize/forms.js +0 -806
  105. data/app/assets/javascripts/materialize/global.js +0 -170
  106. data/app/assets/javascripts/materialize/hammer.min.js +0 -424
  107. data/app/assets/javascripts/materialize/initial.js +0 -10
  108. data/app/assets/javascripts/materialize/jquery.easing.1.4.js +0 -144
  109. data/app/assets/javascripts/materialize/jquery.hammer.js +0 -33
  110. data/app/assets/javascripts/materialize/materialbox.js +0 -263
  111. data/app/assets/javascripts/materialize/parallax.js +0 -54
  112. data/app/assets/javascripts/materialize/pushpin.js +0 -68
  113. data/app/assets/javascripts/materialize/scrollFire.js +0 -49
  114. data/app/assets/javascripts/materialize/scrollspy.js +0 -230
  115. data/app/assets/javascripts/materialize/sideNav.js +0 -395
  116. data/app/assets/javascripts/materialize/slider.js +0 -295
  117. data/app/assets/javascripts/materialize/tabs.js +0 -244
  118. data/app/assets/javascripts/materialize/tapTarget.js +0 -184
  119. data/app/assets/javascripts/materialize/tooltip.js +0 -227
  120. data/app/assets/javascripts/materialize/transitions.js +0 -163
  121. data/app/assets/javascripts/materialize/velocity.min.js +0 -626
  122. data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -424
  123. data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -39
  124. data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +0 -469
  125. data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +0 -216
  126. data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +0 -267
@@ -0,0 +1,992 @@
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();
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
+
562
+ var originalCallback;
563
+
564
+ if (!isString(eventName)) {
565
+ for (var key in eventName) {
566
+ this.on(key, delegate, eventName[key]);
567
+ }
568
+ return this;
569
+ }
570
+
571
+ if (isFunction(delegate)) {
572
+ callback = delegate;
573
+ delegate = null;
574
+ }
575
+
576
+ if (eventName === "ready") {
577
+ onReady(callback);
578
+ return this;
579
+ }
580
+
581
+ if (delegate) {
582
+ originalCallback = callback;
583
+ callback = function (e) {
584
+ var t = e.target;
585
+
586
+ while (!matches(t, delegate)) {
587
+ if (t === this) {
588
+ return t = false;
589
+ }
590
+ t = t.parentNode;
591
+ }
592
+
593
+ if (t) {
594
+ originalCallback.call(t, e);
595
+ }
596
+ };
597
+ }
598
+
599
+ return this.each(function (v) {
600
+ var finalCallback = callback;
601
+ if (runOnce) {
602
+ finalCallback = function () {
603
+ callback.apply(this, arguments);
604
+ removeEvent(v, eventName, finalCallback);
605
+ };
606
+ }
607
+ registerEvent(v, eventName, finalCallback);
608
+ });
609
+ },
610
+
611
+ one: function (eventName, delegate, callback) {
612
+ return this.on(eventName, delegate, callback, true);
613
+ },
614
+
615
+ ready: onReady,
616
+
617
+ /**
618
+ * Modified
619
+ * Triggers browser event
620
+ * @param String eventName
621
+ * @param Object data - Add properties to event object
622
+ */
623
+ trigger: function (eventName, data) {
624
+ if (document.createEvent) {
625
+ var evt = document.createEvent('HTMLEvents');
626
+ evt.initEvent(eventName, true, false);
627
+ evt = this.extend(evt, data);
628
+ return this.each(function (v) {
629
+ return v.dispatchEvent(evt);
630
+ });
631
+ }
632
+ }
633
+
634
+ });
635
+
636
+ function encode(name, value) {
637
+ return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+");
638
+ }
639
+
640
+ function getSelectMultiple_(el) {
641
+ var values = [];
642
+ each(el.options, function (o) {
643
+ if (o.selected) {
644
+ values.push(o.value);
645
+ }
646
+ });
647
+ return values.length ? values : null;
648
+ }
649
+
650
+ function getSelectSingle_(el) {
651
+ var selectedIndex = el.selectedIndex;
652
+ return selectedIndex >= 0 ? el.options[selectedIndex].value : null;
653
+ }
654
+
655
+ function getValue(el) {
656
+ var type = el.type;
657
+ if (!type) {
658
+ return null;
659
+ }
660
+ switch (type.toLowerCase()) {
661
+ case "select-one":
662
+ return getSelectSingle_(el);
663
+ case "select-multiple":
664
+ return getSelectMultiple_(el);
665
+ case "radio":
666
+ return el.checked ? el.value : null;
667
+ case "checkbox":
668
+ return el.checked ? el.value : null;
669
+ default:
670
+ return el.value ? el.value : null;
671
+ }
672
+ }
673
+
674
+ fn.extend({
675
+ serialize: function () {
676
+ var query = "";
677
+
678
+ each(this[0].elements || this, function (el) {
679
+ if (el.disabled || el.tagName === "FIELDSET") {
680
+ return;
681
+ }
682
+ var name = el.name;
683
+ switch (el.type.toLowerCase()) {
684
+ case "file":
685
+ case "reset":
686
+ case "submit":
687
+ case "button":
688
+ break;
689
+ case "select-multiple":
690
+ var values = getValue(el);
691
+ if (values !== null) {
692
+ each(values, function (value) {
693
+ query += encode(name, value);
694
+ });
695
+ }
696
+ break;
697
+ default:
698
+ var value = getValue(el);
699
+ if (value !== null) {
700
+ query += encode(name, value);
701
+ }
702
+ }
703
+ });
704
+
705
+ return query.substr(1);
706
+ },
707
+
708
+ val: function (value) {
709
+ if (value === undefined) {
710
+ return getValue(this[0]);
711
+ } else {
712
+ return this.each(function (v) {
713
+ return v.value = value;
714
+ });
715
+ }
716
+ }
717
+
718
+ });
719
+
720
+ function insertElement(el, child, prepend) {
721
+ if (prepend) {
722
+ var first = el.childNodes[0];
723
+ el.insertBefore(child, first);
724
+ } else {
725
+ el.appendChild(child);
726
+ }
727
+ }
728
+
729
+ function insertContent(parent, child, prepend) {
730
+ var str = isString(child);
731
+
732
+ if (!str && child.length) {
733
+ each(child, function (v) {
734
+ return insertContent(parent, v, prepend);
735
+ });
736
+ return;
737
+ }
738
+
739
+ each(parent, str ? function (v) {
740
+ return v.insertAdjacentHTML(prepend ? "afterbegin" : "beforeend", child);
741
+ } : function (v, i) {
742
+ return insertElement(v, i === 0 ? child : child.cloneNode(true), prepend);
743
+ });
744
+ }
745
+
746
+ fn.extend({
747
+ after: function (selector) {
748
+ cash(selector).insertAfter(this);
749
+ return this;
750
+ },
751
+
752
+ append: function (content) {
753
+ insertContent(this, content);
754
+ return this;
755
+ },
756
+
757
+ appendTo: function (parent) {
758
+ insertContent(cash(parent), this);
759
+ return this;
760
+ },
761
+
762
+ before: function (selector) {
763
+ cash(selector).insertBefore(this);
764
+ return this;
765
+ },
766
+
767
+ clone: function () {
768
+ return cash(this.map(function (v) {
769
+ return v.cloneNode(true);
770
+ }));
771
+ },
772
+
773
+ empty: function () {
774
+ this.html("");
775
+ return this;
776
+ },
777
+
778
+ html: function (content) {
779
+ if (content === undefined) {
780
+ return this[0].innerHTML;
781
+ }
782
+ var source = content.nodeType ? content[0].outerHTML : content;
783
+ return this.each(function (v) {
784
+ return v.innerHTML = source;
785
+ });
786
+ },
787
+
788
+ insertAfter: function (selector) {
789
+ var _this = this;
790
+
791
+ cash(selector).each(function (el, i) {
792
+ var parent = el.parentNode,
793
+ sibling = el.nextSibling;
794
+ _this.each(function (v) {
795
+ parent.insertBefore(i === 0 ? v : v.cloneNode(true), sibling);
796
+ });
797
+ });
798
+
799
+ return this;
800
+ },
801
+
802
+ insertBefore: function (selector) {
803
+ var _this2 = this;
804
+ cash(selector).each(function (el, i) {
805
+ var parent = el.parentNode;
806
+ _this2.each(function (v) {
807
+ parent.insertBefore(i === 0 ? v : v.cloneNode(true), el);
808
+ });
809
+ });
810
+ return this;
811
+ },
812
+
813
+ prepend: function (content) {
814
+ insertContent(this, content, true);
815
+ return this;
816
+ },
817
+
818
+ prependTo: function (parent) {
819
+ insertContent(cash(parent), this, true);
820
+ return this;
821
+ },
822
+
823
+ remove: function () {
824
+ return this.each(function (v) {
825
+ if (!!v.parentNode) {
826
+ return v.parentNode.removeChild(v);
827
+ }
828
+ });
829
+ },
830
+
831
+ text: function (content) {
832
+ if (content === undefined) {
833
+ return this[0].textContent;
834
+ }
835
+ return this.each(function (v) {
836
+ return v.textContent = content;
837
+ });
838
+ }
839
+
840
+ });
841
+
842
+ var docEl = doc.documentElement;
843
+
844
+ fn.extend({
845
+ position: function () {
846
+ var el = this[0];
847
+ return {
848
+ left: el.offsetLeft,
849
+ top: el.offsetTop
850
+ };
851
+ },
852
+
853
+ offset: function () {
854
+ var rect = this[0].getBoundingClientRect();
855
+ return {
856
+ top: rect.top + win.pageYOffset - docEl.clientTop,
857
+ left: rect.left + win.pageXOffset - docEl.clientLeft
858
+ };
859
+ },
860
+
861
+ offsetParent: function () {
862
+ return cash(this[0].offsetParent);
863
+ }
864
+
865
+ });
866
+
867
+ fn.extend({
868
+ children: function (selector) {
869
+ var elems = [];
870
+ this.each(function (el) {
871
+ push.apply(elems, el.children);
872
+ });
873
+ elems = unique(elems);
874
+
875
+ return !selector ? elems : elems.filter(function (v) {
876
+ return matches(v, selector);
877
+ });
878
+ },
879
+
880
+ closest: function (selector) {
881
+ if (!selector || this.length < 1) {
882
+ return cash();
883
+ }
884
+ if (this.is(selector)) {
885
+ return this.filter(selector);
886
+ }
887
+ return this.parent().closest(selector);
888
+ },
889
+
890
+ is: function (selector) {
891
+ if (!selector) {
892
+ return false;
893
+ }
894
+
895
+ var match = false,
896
+ comparator = getCompareFunction(selector);
897
+
898
+ this.each(function (el) {
899
+ match = comparator(el, selector);
900
+ return !match;
901
+ });
902
+
903
+ return match;
904
+ },
905
+
906
+ find: function (selector) {
907
+ if (!selector || selector.nodeType) {
908
+ return cash(selector && this.has(selector).length ? selector : null);
909
+ }
910
+
911
+ var elems = [];
912
+ this.each(function (el) {
913
+ push.apply(elems, find(selector, el));
914
+ });
915
+
916
+ return unique(elems);
917
+ },
918
+
919
+ has: function (selector) {
920
+ var comparator = isString(selector) ? function (el) {
921
+ return find(selector, el).length !== 0;
922
+ } : function (el) {
923
+ return el.contains(selector);
924
+ };
925
+
926
+ return this.filter(comparator);
927
+ },
928
+
929
+ next: function () {
930
+ return cash(this[0].nextElementSibling);
931
+ },
932
+
933
+ not: function (selector) {
934
+ if (!selector) {
935
+ return this;
936
+ }
937
+
938
+ var comparator = getCompareFunction(selector);
939
+
940
+ return this.filter(function (el) {
941
+ return !comparator(el, selector);
942
+ });
943
+ },
944
+
945
+ parent: function () {
946
+ var result = [];
947
+
948
+ this.each(function (item) {
949
+ if (item && item.parentNode) {
950
+ result.push(item.parentNode);
951
+ }
952
+ });
953
+
954
+ return unique(result);
955
+ },
956
+
957
+ parents: function (selector) {
958
+ var last,
959
+ result = [];
960
+
961
+ this.each(function (item) {
962
+ last = item;
963
+
964
+ while (last && last.parentNode && last !== doc.body.parentNode) {
965
+ last = last.parentNode;
966
+
967
+ if (!selector || selector && matches(last, selector)) {
968
+ result.push(last);
969
+ }
970
+ }
971
+ });
972
+
973
+ return unique(result);
974
+ },
975
+
976
+ prev: function () {
977
+ return cash(this[0].previousElementSibling);
978
+ },
979
+
980
+ siblings: function (selector) {
981
+ var collection = this.parent().children(selector),
982
+ el = this[0];
983
+
984
+ return collection.filter(function (i) {
985
+ return i !== el;
986
+ });
987
+ }
988
+
989
+ });
990
+
991
+ return cash;
992
+ });