1 |
|
2 | (function(window){
|
3 | if(window.Package){
|
4 | Materialize = {};
|
5 | } else {
|
6 | window.Materialize = {};
|
7 | }
|
8 | })(window);
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | (function(window) {
|
22 | var lastTime = 0,
|
23 | vendors = ['webkit', 'moz'],
|
24 | requestAnimationFrame = window.requestAnimationFrame,
|
25 | cancelAnimationFrame = window.cancelAnimationFrame,
|
26 | i = vendors.length;
|
27 |
|
28 |
|
29 | while (--i >= 0 && !requestAnimationFrame) {
|
30 | requestAnimationFrame = window[vendors[i] + 'RequestAnimationFrame'];
|
31 | cancelAnimationFrame = window[vendors[i] + 'CancelRequestAnimationFrame'];
|
32 | }
|
33 |
|
34 |
|
35 |
|
36 | if (!requestAnimationFrame || !cancelAnimationFrame) {
|
37 | requestAnimationFrame = function(callback) {
|
38 | var now = +Date.now(),
|
39 | nextTime = Math.max(lastTime + 16, now);
|
40 | return setTimeout(function() {
|
41 | callback(lastTime = nextTime);
|
42 | }, nextTime - now);
|
43 | };
|
44 |
|
45 | cancelAnimationFrame = clearTimeout;
|
46 | }
|
47 |
|
48 |
|
49 | window.requestAnimationFrame = requestAnimationFrame;
|
50 | window.cancelAnimationFrame = cancelAnimationFrame;
|
51 | }(window));
|
52 |
|
53 |
|
54 |
|
55 | Materialize.guid = (function() {
|
56 | function s4() {
|
57 | return Math.floor((1 + Math.random()) * 0x10000)
|
58 | .toString(16)
|
59 | .substring(1);
|
60 | }
|
61 | return function() {
|
62 | return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
|
63 | s4() + '-' + s4() + s4() + s4();
|
64 | };
|
65 | })();
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | Materialize.escapeHash = function(hash) {
|
73 | return hash.replace( /(:|\.|\[|\]|,|=)/g, "\\$1" );
|
74 | };
|
75 |
|
76 | Materialize.elementOrParentIsFixed = function(element) {
|
77 | var $element = $(element);
|
78 | var $checkElements = $element.add($element.parents());
|
79 | var isFixed = false;
|
80 | $checkElements.each(function(){
|
81 | if ($(this).css("position") === "fixed") {
|
82 | isFixed = true;
|
83 | return false;
|
84 | }
|
85 | });
|
86 | return isFixed;
|
87 | };
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 | var getTime = (Date.now || function () {
|
97 | return new Date().getTime();
|
98 | });
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 | Materialize.throttle = function(func, wait, options) {
|
114 | var context, args, result;
|
115 | var timeout = null;
|
116 | var previous = 0;
|
117 | options || (options = {});
|
118 | var later = function () {
|
119 | previous = options.leading === false ? 0 : getTime();
|
120 | timeout = null;
|
121 | result = func.apply(context, args);
|
122 | context = args = null;
|
123 | };
|
124 | return function () {
|
125 | var now = getTime();
|
126 | if (!previous && options.leading === false) previous = now;
|
127 | var remaining = wait - (now - previous);
|
128 | context = this;
|
129 | args = arguments;
|
130 | if (remaining <= 0) {
|
131 | clearTimeout(timeout);
|
132 | timeout = null;
|
133 | previous = now;
|
134 | result = func.apply(context, args);
|
135 | context = args = null;
|
136 | } else if (!timeout && options.trailing !== false) {
|
137 | timeout = setTimeout(later, remaining);
|
138 | }
|
139 | return result;
|
140 | };
|
141 | };
|
142 |
|
143 |
|
144 |
|
145 |
|
146 | var Vel;
|
147 | if (jQuery) {
|
148 | Vel = jQuery.Velocity;
|
149 | } else if ($) {
|
150 | Vel = $.Velocity;
|
151 | } else {
|
152 | Vel = Velocity;
|
153 | }
|