1 |
2
|
Manuela
|
/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
|
2 |
|
|
* Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
|
3 |
|
|
*/
|
4 |
|
|
;
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
window.Modernizr = (function( window, document, undefined ) {
|
9 |
|
|
|
10 |
|
|
var version = '2.8.3',
|
11 |
|
|
|
12 |
|
|
Modernizr = {},
|
13 |
|
|
|
14 |
|
|
enableClasses = true,
|
15 |
|
|
|
16 |
|
|
docElement = document.documentElement,
|
17 |
|
|
|
18 |
|
|
mod = 'modernizr',
|
19 |
|
|
modElem = document.createElement(mod),
|
20 |
|
|
mStyle = modElem.style,
|
21 |
|
|
|
22 |
|
|
inputElem = document.createElement('input') ,
|
23 |
|
|
|
24 |
|
|
smile = ':)',
|
25 |
|
|
|
26 |
|
|
toString = {}.toString,
|
27 |
|
|
|
28 |
|
|
prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
omPrefixes = 'Webkit Moz O ms',
|
33 |
|
|
|
34 |
|
|
cssomPrefixes = omPrefixes.split(' '),
|
35 |
|
|
|
36 |
|
|
domPrefixes = omPrefixes.toLowerCase().split(' '),
|
37 |
|
|
|
38 |
|
|
ns = {'svg': 'http://www.w3.org/2000/svg'},
|
39 |
|
|
|
40 |
|
|
tests = {},
|
41 |
|
|
inputs = {},
|
42 |
|
|
attrs = {},
|
43 |
|
|
|
44 |
|
|
classes = [],
|
45 |
|
|
|
46 |
|
|
slice = classes.slice,
|
47 |
|
|
|
48 |
|
|
featureName,
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
injectElementWithStyles = function( rule, callback, nodes, testnames ) {
|
52 |
|
|
|
53 |
|
|
var style, ret, node, docOverflow,
|
54 |
|
|
div = document.createElement('div'),
|
55 |
|
|
body = document.body,
|
56 |
|
|
fakeBody = body || document.createElement('body');
|
57 |
|
|
|
58 |
|
|
if ( parseInt(nodes, 10) ) {
|
59 |
|
|
while ( nodes-- ) {
|
60 |
|
|
node = document.createElement('div');
|
61 |
|
|
node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
|
62 |
|
|
div.appendChild(node);
|
63 |
|
|
}
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
style = ['­','<style id="s', mod, '">', rule, '</style>'].join('');
|
67 |
|
|
div.id = mod;
|
68 |
|
|
(body ? div : fakeBody).innerHTML += style;
|
69 |
|
|
fakeBody.appendChild(div);
|
70 |
|
|
if ( !body ) {
|
71 |
|
|
fakeBody.style.background = '';
|
72 |
|
|
fakeBody.style.overflow = 'hidden';
|
73 |
|
|
docOverflow = docElement.style.overflow;
|
74 |
|
|
docElement.style.overflow = 'hidden';
|
75 |
|
|
docElement.appendChild(fakeBody);
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
ret = callback(div, rule);
|
79 |
|
|
if ( !body ) {
|
80 |
|
|
fakeBody.parentNode.removeChild(fakeBody);
|
81 |
|
|
docElement.style.overflow = docOverflow;
|
82 |
|
|
} else {
|
83 |
|
|
div.parentNode.removeChild(div);
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
return !!ret;
|
87 |
|
|
|
88 |
|
|
},
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
isEventSupported = (function() {
|
93 |
|
|
|
94 |
|
|
var TAGNAMES = {
|
95 |
|
|
'select': 'input', 'change': 'input',
|
96 |
|
|
'submit': 'form', 'reset': 'form',
|
97 |
|
|
'error': 'img', 'load': 'img', 'abort': 'img'
|
98 |
|
|
};
|
99 |
|
|
|
100 |
|
|
function isEventSupported( eventName, element ) {
|
101 |
|
|
|
102 |
|
|
element = element || document.createElement(TAGNAMES[eventName] || 'div');
|
103 |
|
|
eventName = 'on' + eventName;
|
104 |
|
|
|
105 |
|
|
var isSupported = eventName in element;
|
106 |
|
|
|
107 |
|
|
if ( !isSupported ) {
|
108 |
|
|
if ( !element.setAttribute ) {
|
109 |
|
|
element = document.createElement('div');
|
110 |
|
|
}
|
111 |
|
|
if ( element.setAttribute && element.removeAttribute ) {
|
112 |
|
|
element.setAttribute(eventName, '');
|
113 |
|
|
isSupported = is(element[eventName], 'function');
|
114 |
|
|
|
115 |
|
|
if ( !is(element[eventName], 'undefined') ) {
|
116 |
|
|
element[eventName] = undefined;
|
117 |
|
|
}
|
118 |
|
|
element.removeAttribute(eventName);
|
119 |
|
|
}
|
120 |
|
|
}
|
121 |
|
|
|
122 |
|
|
element = null;
|
123 |
|
|
return isSupported;
|
124 |
|
|
}
|
125 |
|
|
return isEventSupported;
|
126 |
|
|
})(),
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
_hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
|
130 |
|
|
|
131 |
|
|
if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
|
132 |
|
|
hasOwnProp = function (object, property) {
|
133 |
|
|
return _hasOwnProperty.call(object, property);
|
134 |
|
|
};
|
135 |
|
|
}
|
136 |
|
|
else {
|
137 |
|
|
hasOwnProp = function (object, property) {
|
138 |
|
|
return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
|
139 |
|
|
};
|
140 |
|
|
}
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
if (!Function.prototype.bind) {
|
144 |
|
|
Function.prototype.bind = function bind(that) {
|
145 |
|
|
|
146 |
|
|
var target = this;
|
147 |
|
|
|
148 |
|
|
if (typeof target != "function") {
|
149 |
|
|
throw new TypeError();
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
var args = slice.call(arguments, 1),
|
153 |
|
|
bound = function () {
|
154 |
|
|
|
155 |
|
|
if (this instanceof bound) {
|
156 |
|
|
|
157 |
|
|
var F = function(){};
|
158 |
|
|
F.prototype = target.prototype;
|
159 |
|
|
var self = new F();
|
160 |
|
|
|
161 |
|
|
var result = target.apply(
|
162 |
|
|
self,
|
163 |
|
|
args.concat(slice.call(arguments))
|
164 |
|
|
);
|
165 |
|
|
if (Object(result) === result) {
|
166 |
|
|
return result;
|
167 |
|
|
}
|
168 |
|
|
return self;
|
169 |
|
|
|
170 |
|
|
} else {
|
171 |
|
|
|
172 |
|
|
return target.apply(
|
173 |
|
|
that,
|
174 |
|
|
args.concat(slice.call(arguments))
|
175 |
|
|
);
|
176 |
|
|
|
177 |
|
|
}
|
178 |
|
|
|
179 |
|
|
};
|
180 |
|
|
|
181 |
|
|
return bound;
|
182 |
|
|
};
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
function setCss( str ) {
|
186 |
|
|
mStyle.cssText = str;
|
187 |
|
|
}
|
188 |
|
|
|
189 |
|
|
function setCssAll( str1, str2 ) {
|
190 |
|
|
return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
|
191 |
|
|
}
|
192 |
|
|
|
193 |
|
|
function is( obj, type ) {
|
194 |
|
|
return typeof obj === type;
|
195 |
|
|
}
|
196 |
|
|
|
197 |
|
|
function contains( str, substr ) {
|
198 |
|
|
return !!~('' + str).indexOf(substr);
|
199 |
|
|
}
|
200 |
|
|
|
201 |
|
|
function testProps( props, prefixed ) {
|
202 |
|
|
for ( var i in props ) {
|
203 |
|
|
var prop = props[i];
|
204 |
|
|
if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
|
205 |
|
|
return prefixed == 'pfx' ? prop : true;
|
206 |
|
|
}
|
207 |
|
|
}
|
208 |
|
|
return false;
|
209 |
|
|
}
|
210 |
|
|
|
211 |
|
|
function testDOMProps( props, obj, elem ) {
|
212 |
|
|
for ( var i in props ) {
|
213 |
|
|
var item = obj[props[i]];
|
214 |
|
|
if ( item !== undefined) {
|
215 |
|
|
|
216 |
|
|
if (elem === false) return props[i];
|
217 |
|
|
|
218 |
|
|
if (is(item, 'function')){
|
219 |
|
|
return item.bind(elem || obj);
|
220 |
|
|
}
|
221 |
|
|
|
222 |
|
|
return item;
|
223 |
|
|
}
|
224 |
|
|
}
|
225 |
|
|
return false;
|
226 |
|
|
}
|
227 |
|
|
|
228 |
|
|
function testPropsAll( prop, prefixed, elem ) {
|
229 |
|
|
|
230 |
|
|
var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
|
231 |
|
|
props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
|
232 |
|
|
|
233 |
|
|
if(is(prefixed, "string") || is(prefixed, "undefined")) {
|
234 |
|
|
return testProps(props, prefixed);
|
235 |
|
|
|
236 |
|
|
} else {
|
237 |
|
|
props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
|
238 |
|
|
return testDOMProps(props, prefixed, elem);
|
239 |
|
|
}
|
240 |
|
|
} tests['flexbox'] = function() {
|
241 |
|
|
return testPropsAll('flexWrap');
|
242 |
|
|
}; tests['canvas'] = function() {
|
243 |
|
|
var elem = document.createElement('canvas');
|
244 |
|
|
return !!(elem.getContext && elem.getContext('2d'));
|
245 |
|
|
};
|
246 |
|
|
|
247 |
|
|
tests['canvastext'] = function() {
|
248 |
|
|
return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
|
249 |
|
|
};
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
tests['webgl'] = function() {
|
254 |
|
|
return !!window.WebGLRenderingContext;
|
255 |
|
|
};
|
256 |
|
|
|
257 |
|
|
|
258 |
|
|
tests['touch'] = function() {
|
259 |
|
|
var bool;
|
260 |
|
|
|
261 |
|
|
if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
|
262 |
|
|
bool = true;
|
263 |
|
|
} else {
|
264 |
|
|
injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) {
|
265 |
|
|
bool = node.offsetTop === 9;
|
266 |
|
|
});
|
267 |
|
|
}
|
268 |
|
|
|
269 |
|
|
return bool;
|
270 |
|
|
};
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
tests['geolocation'] = function() {
|
275 |
|
|
return 'geolocation' in navigator;
|
276 |
|
|
};
|
277 |
|
|
|
278 |
|
|
|
279 |
|
|
tests['postmessage'] = function() {
|
280 |
|
|
return !!window.postMessage;
|
281 |
|
|
};
|
282 |
|
|
|
283 |
|
|
|
284 |
|
|
tests['websqldatabase'] = function() {
|
285 |
|
|
return !!window.openDatabase;
|
286 |
|
|
};
|
287 |
|
|
|
288 |
|
|
tests['indexedDB'] = function() {
|
289 |
|
|
return !!testPropsAll("indexedDB", window);
|
290 |
|
|
};
|
291 |
|
|
|
292 |
|
|
tests['hashchange'] = function() {
|
293 |
|
|
return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7);
|
294 |
|
|
};
|
295 |
|
|
|
296 |
|
|
tests['history'] = function() {
|
297 |
|
|
return !!(window.history && history.pushState);
|
298 |
|
|
};
|
299 |
|
|
|
300 |
|
|
tests['draganddrop'] = function() {
|
301 |
|
|
var div = document.createElement('div');
|
302 |
|
|
return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
|
303 |
|
|
};
|
304 |
|
|
|
305 |
|
|
tests['websockets'] = function() {
|
306 |
|
|
return 'WebSocket' in window || 'MozWebSocket' in window;
|
307 |
|
|
};
|
308 |
|
|
|
309 |
|
|
|
310 |
|
|
tests['rgba'] = function() {
|
311 |
|
|
setCss('background-color:rgba(150,255,150,.5)');
|
312 |
|
|
|
313 |
|
|
return contains(mStyle.backgroundColor, 'rgba');
|
314 |
|
|
};
|
315 |
|
|
|
316 |
|
|
tests['hsla'] = function() {
|
317 |
|
|
setCss('background-color:hsla(120,40%,100%,.5)');
|
318 |
|
|
|
319 |
|
|
return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla');
|
320 |
|
|
};
|
321 |
|
|
|
322 |
|
|
tests['multiplebgs'] = function() {
|
323 |
|
|
setCss('background:url(https://),url(https://),red url(https://)');
|
324 |
|
|
|
325 |
|
|
return (/(url\s*\(.*?){3}/).test(mStyle.background);
|
326 |
|
|
}; tests['backgroundsize'] = function() {
|
327 |
|
|
return testPropsAll('backgroundSize');
|
328 |
|
|
};
|
329 |
|
|
|
330 |
|
|
tests['borderimage'] = function() {
|
331 |
|
|
return testPropsAll('borderImage');
|
332 |
|
|
};
|
333 |
|
|
|
334 |
|
|
|
335 |
|
|
|
336 |
|
|
tests['borderradius'] = function() {
|
337 |
|
|
return testPropsAll('borderRadius');
|
338 |
|
|
};
|
339 |
|
|
|
340 |
|
|
tests['boxshadow'] = function() {
|
341 |
|
|
return testPropsAll('boxShadow');
|
342 |
|
|
};
|
343 |
|
|
|
344 |
|
|
tests['textshadow'] = function() {
|
345 |
|
|
return document.createElement('div').style.textShadow === '';
|
346 |
|
|
};
|
347 |
|
|
|
348 |
|
|
|
349 |
|
|
tests['opacity'] = function() {
|
350 |
|
|
setCssAll('opacity:.55');
|
351 |
|
|
|
352 |
|
|
return (/^0.55$/).test(mStyle.opacity);
|
353 |
|
|
};
|
354 |
|
|
|
355 |
|
|
|
356 |
|
|
tests['cssanimations'] = function() {
|
357 |
|
|
return testPropsAll('animationName');
|
358 |
|
|
};
|
359 |
|
|
|
360 |
|
|
|
361 |
|
|
tests['csscolumns'] = function() {
|
362 |
|
|
return testPropsAll('columnCount');
|
363 |
|
|
};
|
364 |
|
|
|
365 |
|
|
|
366 |
|
|
tests['cssgradients'] = function() {
|
367 |
|
|
var str1 = 'background-image:',
|
368 |
|
|
str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
|
369 |
|
|
str3 = 'linear-gradient(left top,#9f9, white);';
|
370 |
|
|
|
371 |
|
|
setCss(
|
372 |
|
|
(str1 + '-webkit- '.split(' ').join(str2 + str1) +
|
373 |
|
|
prefixes.join(str3 + str1)).slice(0, -str1.length)
|
374 |
|
|
);
|
375 |
|
|
|
376 |
|
|
return contains(mStyle.backgroundImage, 'gradient');
|
377 |
|
|
};
|
378 |
|
|
|
379 |
|
|
|
380 |
|
|
tests['cssreflections'] = function() {
|
381 |
|
|
return testPropsAll('boxReflect');
|
382 |
|
|
};
|
383 |
|
|
|
384 |
|
|
|
385 |
|
|
tests['csstransforms'] = function() {
|
386 |
|
|
return !!testPropsAll('transform');
|
387 |
|
|
};
|
388 |
|
|
|
389 |
|
|
|
390 |
|
|
tests['csstransforms3d'] = function() {
|
391 |
|
|
|
392 |
|
|
var ret = !!testPropsAll('perspective');
|
393 |
|
|
|
394 |
|
|
if ( ret && 'webkitPerspective' in docElement.style ) {
|
395 |
|
|
|
396 |
|
|
injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {
|
397 |
|
|
ret = node.offsetLeft === 9 && node.offsetHeight === 3;
|
398 |
|
|
});
|
399 |
|
|
}
|
400 |
|
|
return ret;
|
401 |
|
|
};
|
402 |
|
|
|
403 |
|
|
|
404 |
|
|
tests['csstransitions'] = function() {
|
405 |
|
|
return testPropsAll('transition');
|
406 |
|
|
};
|
407 |
|
|
|
408 |
|
|
|
409 |
|
|
|
410 |
|
|
tests['fontface'] = function() {
|
411 |
|
|
var bool;
|
412 |
|
|
|
413 |
|
|
injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) {
|
414 |
|
|
var style = document.getElementById('smodernizr'),
|
415 |
|
|
sheet = style.sheet || style.styleSheet,
|
416 |
|
|
cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '';
|
417 |
|
|
|
418 |
|
|
bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0;
|
419 |
|
|
});
|
420 |
|
|
|
421 |
|
|
return bool;
|
422 |
|
|
};
|
423 |
|
|
|
424 |
|
|
tests['generatedcontent'] = function() {
|
425 |
|
|
var bool;
|
426 |
|
|
|
427 |
|
|
injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) {
|
428 |
|
|
bool = node.offsetHeight >= 3;
|
429 |
|
|
});
|
430 |
|
|
|
431 |
|
|
return bool;
|
432 |
|
|
};
|
433 |
|
|
tests['video'] = function() {
|
434 |
|
|
var elem = document.createElement('video'),
|
435 |
|
|
bool = false;
|
436 |
|
|
|
437 |
|
|
try {
|
438 |
|
|
if ( bool = !!elem.canPlayType ) {
|
439 |
|
|
bool = new Boolean(bool);
|
440 |
|
|
bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
|
441 |
|
|
|
442 |
|
|
bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
|
443 |
|
|
|
444 |
|
|
bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
|
445 |
|
|
}
|
446 |
|
|
|
447 |
|
|
} catch(e) { }
|
448 |
|
|
|
449 |
|
|
return bool;
|
450 |
|
|
};
|
451 |
|
|
|
452 |
|
|
tests['audio'] = function() {
|
453 |
|
|
var elem = document.createElement('audio'),
|
454 |
|
|
bool = false;
|
455 |
|
|
|
456 |
|
|
try {
|
457 |
|
|
if ( bool = !!elem.canPlayType ) {
|
458 |
|
|
bool = new Boolean(bool);
|
459 |
|
|
bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
|
460 |
|
|
bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
|
461 |
|
|
|
462 |
|
|
bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
|
463 |
|
|
bool.m4a = ( elem.canPlayType('audio/x-m4a;') ||
|
464 |
|
|
elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
|
465 |
|
|
}
|
466 |
|
|
} catch(e) { }
|
467 |
|
|
|
468 |
|
|
return bool;
|
469 |
|
|
};
|
470 |
|
|
|
471 |
|
|
|
472 |
|
|
tests['localstorage'] = function() {
|
473 |
|
|
try {
|
474 |
|
|
localStorage.setItem(mod, mod);
|
475 |
|
|
localStorage.removeItem(mod);
|
476 |
|
|
return true;
|
477 |
|
|
} catch(e) {
|
478 |
|
|
return false;
|
479 |
|
|
}
|
480 |
|
|
};
|
481 |
|
|
|
482 |
|
|
tests['sessionstorage'] = function() {
|
483 |
|
|
try {
|
484 |
|
|
sessionStorage.setItem(mod, mod);
|
485 |
|
|
sessionStorage.removeItem(mod);
|
486 |
|
|
return true;
|
487 |
|
|
} catch(e) {
|
488 |
|
|
return false;
|
489 |
|
|
}
|
490 |
|
|
};
|
491 |
|
|
|
492 |
|
|
|
493 |
|
|
tests['webworkers'] = function() {
|
494 |
|
|
return !!window.Worker;
|
495 |
|
|
};
|
496 |
|
|
|
497 |
|
|
|
498 |
|
|
tests['applicationcache'] = function() {
|
499 |
|
|
return !!window.applicationCache;
|
500 |
|
|
};
|
501 |
|
|
|
502 |
|
|
|
503 |
|
|
tests['svg'] = function() {
|
504 |
|
|
return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
|
505 |
|
|
};
|
506 |
|
|
|
507 |
|
|
tests['inlinesvg'] = function() {
|
508 |
|
|
var div = document.createElement('div');
|
509 |
|
|
div.innerHTML = '<svg/>';
|
510 |
|
|
return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
|
511 |
|
|
};
|
512 |
|
|
|
513 |
|
|
tests['smil'] = function() {
|
514 |
|
|
return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
|
515 |
|
|
};
|
516 |
|
|
|
517 |
|
|
|
518 |
|
|
tests['svgclippaths'] = function() {
|
519 |
|
|
return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
|
520 |
|
|
};
|
521 |
|
|
|
522 |
|
|
function webforms() {
|
523 |
|
|
Modernizr['input'] = (function( props ) {
|
524 |
|
|
for ( var i = 0, len = props.length; i < len; i++ ) {
|
525 |
|
|
attrs[ props[i] ] = !!(props[i] in inputElem);
|
526 |
|
|
}
|
527 |
|
|
if (attrs.list){
|
528 |
|
|
attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);
|
529 |
|
|
}
|
530 |
|
|
return attrs;
|
531 |
|
|
})('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
|
532 |
|
|
Modernizr['inputtypes'] = (function(props) {
|
533 |
|
|
|
534 |
|
|
for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
|
535 |
|
|
|
536 |
|
|
inputElem.setAttribute('type', inputElemType = props[i]);
|
537 |
|
|
bool = inputElem.type !== 'text';
|
538 |
|
|
|
539 |
|
|
if ( bool ) {
|
540 |
|
|
|
541 |
|
|
inputElem.value = smile;
|
542 |
|
|
inputElem.style.cssText = 'position:absolute;visibility:hidden;';
|
543 |
|
|
|
544 |
|
|
if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
|
545 |
|
|
|
546 |
|
|
docElement.appendChild(inputElem);
|
547 |
|
|
defaultView = document.defaultView;
|
548 |
|
|
|
549 |
|
|
bool = defaultView.getComputedStyle &&
|
550 |
|
|
defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
|
551 |
|
|
(inputElem.offsetHeight !== 0);
|
552 |
|
|
|
553 |
|
|
docElement.removeChild(inputElem);
|
554 |
|
|
|
555 |
|
|
} else if ( /^(search|tel)$/.test(inputElemType) ){
|
556 |
|
|
} else if ( /^(url|email)$/.test(inputElemType) ) {
|
557 |
|
|
bool = inputElem.checkValidity && inputElem.checkValidity() === false;
|
558 |
|
|
|
559 |
|
|
} else {
|
560 |
|
|
bool = inputElem.value != smile;
|
561 |
|
|
}
|
562 |
|
|
}
|
563 |
|
|
|
564 |
|
|
inputs[ props[i] ] = !!bool;
|
565 |
|
|
}
|
566 |
|
|
return inputs;
|
567 |
|
|
})('search tel url email datetime date month week time datetime-local number range color'.split(' '));
|
568 |
|
|
}
|
569 |
|
|
for ( var feature in tests ) {
|
570 |
|
|
if ( hasOwnProp(tests, feature) ) {
|
571 |
|
|
featureName = feature.toLowerCase();
|
572 |
|
|
Modernizr[featureName] = tests[feature]();
|
573 |
|
|
|
574 |
|
|
classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
|
575 |
|
|
}
|
576 |
|
|
}
|
577 |
|
|
|
578 |
|
|
Modernizr.input || webforms();
|
579 |
|
|
|
580 |
|
|
|
581 |
|
|
Modernizr.addTest = function ( feature, test ) {
|
582 |
|
|
if ( typeof feature == 'object' ) {
|
583 |
|
|
for ( var key in feature ) {
|
584 |
|
|
if ( hasOwnProp( feature, key ) ) {
|
585 |
|
|
Modernizr.addTest( key, feature[ key ] );
|
586 |
|
|
}
|
587 |
|
|
}
|
588 |
|
|
} else {
|
589 |
|
|
|
590 |
|
|
feature = feature.toLowerCase();
|
591 |
|
|
|
592 |
|
|
if ( Modernizr[feature] !== undefined ) {
|
593 |
|
|
return Modernizr;
|
594 |
|
|
}
|
595 |
|
|
|
596 |
|
|
test = typeof test == 'function' ? test() : test;
|
597 |
|
|
|
598 |
|
|
if (typeof enableClasses !== "undefined" && enableClasses) {
|
599 |
|
|
docElement.className += ' ' + (test ? '' : 'no-') + feature;
|
600 |
|
|
}
|
601 |
|
|
Modernizr[feature] = test;
|
602 |
|
|
|
603 |
|
|
}
|
604 |
|
|
|
605 |
|
|
return Modernizr;
|
606 |
|
|
};
|
607 |
|
|
|
608 |
|
|
|
609 |
|
|
setCss('');
|
610 |
|
|
modElem = inputElem = null;
|
611 |
|
|
|
612 |
|
|
;(function(window, document) {
|
613 |
|
|
var version = '3.7.0';
|
614 |
|
|
|
615 |
|
|
var options = window.html5 || {};
|
616 |
|
|
|
617 |
|
|
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
|
618 |
|
|
|
619 |
|
|
var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
|
620 |
|
|
|
621 |
|
|
var supportsHtml5Styles;
|
622 |
|
|
|
623 |
|
|
var expando = '_html5shiv';
|
624 |
|
|
|
625 |
|
|
var expanID = 0;
|
626 |
|
|
|
627 |
|
|
var expandoData = {};
|
628 |
|
|
|
629 |
|
|
var supportsUnknownElements;
|
630 |
|
|
|
631 |
|
|
(function() {
|
632 |
|
|
try {
|
633 |
|
|
var a = document.createElement('a');
|
634 |
|
|
a.innerHTML = '<xyz></xyz>';
|
635 |
|
|
supportsHtml5Styles = ('hidden' in a);
|
636 |
|
|
|
637 |
|
|
supportsUnknownElements = a.childNodes.length == 1 || (function() {
|
638 |
|
|
(document.createElement)('a');
|
639 |
|
|
var frag = document.createDocumentFragment();
|
640 |
|
|
return (
|
641 |
|
|
typeof frag.cloneNode == 'undefined' ||
|
642 |
|
|
typeof frag.createDocumentFragment == 'undefined' ||
|
643 |
|
|
typeof frag.createElement == 'undefined'
|
644 |
|
|
);
|
645 |
|
|
}());
|
646 |
|
|
} catch(e) {
|
647 |
|
|
supportsHtml5Styles = true;
|
648 |
|
|
supportsUnknownElements = true;
|
649 |
|
|
}
|
650 |
|
|
|
651 |
|
|
}());
|
652 |
|
|
|
653 |
|
|
function addStyleSheet(ownerDocument, cssText) {
|
654 |
|
|
var p = ownerDocument.createElement('p'),
|
655 |
|
|
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
|
656 |
|
|
|
657 |
|
|
p.innerHTML = 'x<style>' + cssText + '</style>';
|
658 |
|
|
return parent.insertBefore(p.lastChild, parent.firstChild);
|
659 |
|
|
}
|
660 |
|
|
|
661 |
|
|
function getElements() {
|
662 |
|
|
var elements = html5.elements;
|
663 |
|
|
return typeof elements == 'string' ? elements.split(' ') : elements;
|
664 |
|
|
}
|
665 |
|
|
|
666 |
|
|
function getExpandoData(ownerDocument) {
|
667 |
|
|
var data = expandoData[ownerDocument[expando]];
|
668 |
|
|
if (!data) {
|
669 |
|
|
data = {};
|
670 |
|
|
expanID++;
|
671 |
|
|
ownerDocument[expando] = expanID;
|
672 |
|
|
expandoData[expanID] = data;
|
673 |
|
|
}
|
674 |
|
|
return data;
|
675 |
|
|
}
|
676 |
|
|
|
677 |
|
|
function createElement(nodeName, ownerDocument, data){
|
678 |
|
|
if (!ownerDocument) {
|
679 |
|
|
ownerDocument = document;
|
680 |
|
|
}
|
681 |
|
|
if(supportsUnknownElements){
|
682 |
|
|
return ownerDocument.createElement(nodeName);
|
683 |
|
|
}
|
684 |
|
|
if (!data) {
|
685 |
|
|
data = getExpandoData(ownerDocument);
|
686 |
|
|
}
|
687 |
|
|
var node;
|
688 |
|
|
|
689 |
|
|
if (data.cache[nodeName]) {
|
690 |
|
|
node = data.cache[nodeName].cloneNode();
|
691 |
|
|
} else if (saveClones.test(nodeName)) {
|
692 |
|
|
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
|
693 |
|
|
} else {
|
694 |
|
|
node = data.createElem(nodeName);
|
695 |
|
|
}
|
696 |
|
|
|
697 |
|
|
return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
|
698 |
|
|
}
|
699 |
|
|
|
700 |
|
|
function createDocumentFragment(ownerDocument, data){
|
701 |
|
|
if (!ownerDocument) {
|
702 |
|
|
ownerDocument = document;
|
703 |
|
|
}
|
704 |
|
|
if(supportsUnknownElements){
|
705 |
|
|
return ownerDocument.createDocumentFragment();
|
706 |
|
|
}
|
707 |
|
|
data = data || getExpandoData(ownerDocument);
|
708 |
|
|
var clone = data.frag.cloneNode(),
|
709 |
|
|
i = 0,
|
710 |
|
|
elems = getElements(),
|
711 |
|
|
l = elems.length;
|
712 |
|
|
for(;i<l;i++){
|
713 |
|
|
clone.createElement(elems[i]);
|
714 |
|
|
}
|
715 |
|
|
return clone;
|
716 |
|
|
}
|
717 |
|
|
|
718 |
|
|
function shivMethods(ownerDocument, data) {
|
719 |
|
|
if (!data.cache) {
|
720 |
|
|
data.cache = {};
|
721 |
|
|
data.createElem = ownerDocument.createElement;
|
722 |
|
|
data.createFrag = ownerDocument.createDocumentFragment;
|
723 |
|
|
data.frag = data.createFrag();
|
724 |
|
|
}
|
725 |
|
|
|
726 |
|
|
|
727 |
|
|
ownerDocument.createElement = function(nodeName) {
|
728 |
|
|
if (!html5.shivMethods) {
|
729 |
|
|
return data.createElem(nodeName);
|
730 |
|
|
}
|
731 |
|
|
return createElement(nodeName, ownerDocument, data);
|
732 |
|
|
};
|
733 |
|
|
|
734 |
|
|
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
|
735 |
|
|
'var n=f.cloneNode(),c=n.createElement;' +
|
736 |
|
|
'h.shivMethods&&(' +
|
737 |
|
|
getElements().join().replace(/[\w\-]+/g, function(nodeName) {
|
738 |
|
|
data.createElem(nodeName);
|
739 |
|
|
data.frag.createElement(nodeName);
|
740 |
|
|
return 'c("' + nodeName + '")';
|
741 |
|
|
}) +
|
742 |
|
|
');return n}'
|
743 |
|
|
)(html5, data.frag);
|
744 |
|
|
}
|
745 |
|
|
|
746 |
|
|
function shivDocument(ownerDocument) {
|
747 |
|
|
if (!ownerDocument) {
|
748 |
|
|
ownerDocument = document;
|
749 |
|
|
}
|
750 |
|
|
var data = getExpandoData(ownerDocument);
|
751 |
|
|
|
752 |
|
|
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
|
753 |
|
|
data.hasCSS = !!addStyleSheet(ownerDocument,
|
754 |
|
|
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
|
755 |
|
|
'mark{background:#FF0;color:#000}' +
|
756 |
|
|
'template{display:none}'
|
757 |
|
|
);
|
758 |
|
|
}
|
759 |
|
|
if (!supportsUnknownElements) {
|
760 |
|
|
shivMethods(ownerDocument, data);
|
761 |
|
|
}
|
762 |
|
|
return ownerDocument;
|
763 |
|
|
}
|
764 |
|
|
|
765 |
|
|
var html5 = {
|
766 |
|
|
|
767 |
|
|
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video',
|
768 |
|
|
|
769 |
|
|
'version': version,
|
770 |
|
|
|
771 |
|
|
'shivCSS': (options.shivCSS !== false),
|
772 |
|
|
|
773 |
|
|
'supportsUnknownElements': supportsUnknownElements,
|
774 |
|
|
|
775 |
|
|
'shivMethods': (options.shivMethods !== false),
|
776 |
|
|
|
777 |
|
|
'type': 'default',
|
778 |
|
|
|
779 |
|
|
'shivDocument': shivDocument,
|
780 |
|
|
|
781 |
|
|
createElement: createElement,
|
782 |
|
|
|
783 |
|
|
createDocumentFragment: createDocumentFragment
|
784 |
|
|
};
|
785 |
|
|
|
786 |
|
|
window.html5 = html5;
|
787 |
|
|
|
788 |
|
|
shivDocument(document);
|
789 |
|
|
|
790 |
|
|
}(this, document));
|
791 |
|
|
|
792 |
|
|
Modernizr._version = version;
|
793 |
|
|
|
794 |
|
|
Modernizr._prefixes = prefixes;
|
795 |
|
|
Modernizr._domPrefixes = domPrefixes;
|
796 |
|
|
Modernizr._cssomPrefixes = cssomPrefixes;
|
797 |
|
|
|
798 |
|
|
|
799 |
|
|
Modernizr.hasEvent = isEventSupported;
|
800 |
|
|
|
801 |
|
|
Modernizr.testProp = function(prop){
|
802 |
|
|
return testProps([prop]);
|
803 |
|
|
};
|
804 |
|
|
|
805 |
|
|
Modernizr.testAllProps = testPropsAll;
|
806 |
|
|
|
807 |
|
|
|
808 |
|
|
Modernizr.testStyles = injectElementWithStyles;
|
809 |
|
|
Modernizr.prefixed = function(prop, obj, elem){
|
810 |
|
|
if(!obj) {
|
811 |
|
|
return testPropsAll(prop, 'pfx');
|
812 |
|
|
} else {
|
813 |
|
|
return testPropsAll(prop, obj, elem);
|
814 |
|
|
}
|
815 |
|
|
};
|
816 |
|
|
|
817 |
|
|
|
818 |
|
|
docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
|
819 |
|
|
|
820 |
|
|
(enableClasses ? ' js ' + classes.join(' ') : '');
|
821 |
|
|
|
822 |
|
|
return Modernizr;
|
823 |
|
|
|
824 |
|
|
})(this, this.document);
|
825 |
|
|
/*yepnope1.5.4|WTFPL*/
|
826 |
|
|
(function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}})(this,document);
|
827 |
|
|
Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0));};
|
828 |
|
|
;
|