rails_wink 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README.md +37 -0
- data/Rakefile +25 -0
- data/app/assets/javascripts/rails_wink/application.js +3 -0
- data/app/assets/javascripts/rails_wink/wink_modernizr.js +713 -0
- data/app/assets/stylesheets/rails_wink/application.css +4 -0
- data/app/assets/stylesheets/rails_wink/bootstrap.min.css +202 -0
- data/app/controllers/rails_wink/application_controller.rb +4 -0
- data/app/controllers/rails_wink/wink_controller.rb +28 -0
- data/app/mailers/rails_wink/wink_mailer.rb +19 -0
- data/app/views/layouts/rails_wink/application.html.erb +21 -0
- data/app/views/rails_wink/wink/index.html.erb +67 -0
- data/app/views/rails_wink/wink/submit.html.erb +1 -0
- data/app/views/rails_wink/wink_mailer/report.text.erb +7 -0
- data/config/routes.rb +5 -0
- data/lib/generators/rails_wink/config_generator.rb +13 -0
- data/lib/generators/rails_wink/templates/wink.yml +2 -0
- data/lib/rails_wink/engine.rb +11 -0
- data/lib/rails_wink/version.rb +3 -0
- data/lib/rails_wink.rb +13 -0
- metadata +90 -0
|
@@ -0,0 +1,713 @@
|
|
|
1
|
+
/* Modernizr 2.5.3 (Custom Build) | MIT & BSD
|
|
2
|
+
* Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-flexbox_legacy-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-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-contenteditable-cookies-cors-css_mediaqueries-forms_placeholder-ie8compat-json-requestanimationframe
|
|
3
|
+
*/
|
|
4
|
+
;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
window.winkModernizr = (function( window, document, undefined ) {
|
|
9
|
+
|
|
10
|
+
var version = '2.5.3',
|
|
11
|
+
|
|
12
|
+
winkModernizr = {},
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
docElement = document.documentElement,
|
|
16
|
+
|
|
17
|
+
mod = 'winkModernizr',
|
|
18
|
+
modElem = document.createElement(mod),
|
|
19
|
+
mStyle = modElem.style,
|
|
20
|
+
|
|
21
|
+
inputElem = document.createElement('input') ,
|
|
22
|
+
|
|
23
|
+
smile = ':)',
|
|
24
|
+
|
|
25
|
+
toString = {}.toString,
|
|
26
|
+
|
|
27
|
+
prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
omPrefixes = 'Webkit Moz O ms',
|
|
32
|
+
|
|
33
|
+
cssomPrefixes = omPrefixes.split(' '),
|
|
34
|
+
|
|
35
|
+
domPrefixes = omPrefixes.toLowerCase().split(' '),
|
|
36
|
+
|
|
37
|
+
ns = {'svg': 'http://www.w3.org/2000/svg'},
|
|
38
|
+
|
|
39
|
+
tests = {},
|
|
40
|
+
inputs = {},
|
|
41
|
+
attrs = {},
|
|
42
|
+
|
|
43
|
+
classes = [],
|
|
44
|
+
|
|
45
|
+
slice = classes.slice,
|
|
46
|
+
|
|
47
|
+
featureName,
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
injectElementWithStyles = function( rule, callback, nodes, testnames ) {
|
|
51
|
+
|
|
52
|
+
var style, ret, node,
|
|
53
|
+
div = document.createElement('div'),
|
|
54
|
+
body = document.body,
|
|
55
|
+
fakeBody = body ? body : document.createElement('body');
|
|
56
|
+
|
|
57
|
+
if ( parseInt(nodes, 10) ) {
|
|
58
|
+
while ( nodes-- ) {
|
|
59
|
+
node = document.createElement('div');
|
|
60
|
+
node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
|
|
61
|
+
div.appendChild(node);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
style = ['­','<style>', rule, '</style>'].join('');
|
|
66
|
+
div.id = mod;
|
|
67
|
+
(body ? div : fakeBody).innerHTML += style;
|
|
68
|
+
fakeBody.appendChild(div);
|
|
69
|
+
if(!body){
|
|
70
|
+
fakeBody.style.background = "";
|
|
71
|
+
docElement.appendChild(fakeBody);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
ret = callback(div, rule);
|
|
75
|
+
!body ? fakeBody.parentNode.removeChild(fakeBody) : div.parentNode.removeChild(div);
|
|
76
|
+
|
|
77
|
+
return !!ret;
|
|
78
|
+
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
isEventSupported = (function() {
|
|
84
|
+
|
|
85
|
+
var TAGNAMES = {
|
|
86
|
+
'select': 'input', 'change': 'input',
|
|
87
|
+
'submit': 'form', 'reset': 'form',
|
|
88
|
+
'error': 'img', 'load': 'img', 'abort': 'img'
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
function isEventSupported( eventName, element ) {
|
|
92
|
+
|
|
93
|
+
element = element || document.createElement(TAGNAMES[eventName] || 'div');
|
|
94
|
+
eventName = 'on' + eventName;
|
|
95
|
+
|
|
96
|
+
var isSupported = eventName in element;
|
|
97
|
+
|
|
98
|
+
if ( !isSupported ) {
|
|
99
|
+
if ( !element.setAttribute ) {
|
|
100
|
+
element = document.createElement('div');
|
|
101
|
+
}
|
|
102
|
+
if ( element.setAttribute && element.removeAttribute ) {
|
|
103
|
+
element.setAttribute(eventName, '');
|
|
104
|
+
isSupported = is(element[eventName], 'function');
|
|
105
|
+
|
|
106
|
+
if ( !is(element[eventName], 'undefined') ) {
|
|
107
|
+
element[eventName] = undefined;
|
|
108
|
+
}
|
|
109
|
+
element.removeAttribute(eventName);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
element = null;
|
|
114
|
+
return isSupported;
|
|
115
|
+
}
|
|
116
|
+
return isEventSupported;
|
|
117
|
+
})(),
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
_hasOwnProperty = ({}).hasOwnProperty, hasOwnProperty;
|
|
121
|
+
|
|
122
|
+
if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
|
|
123
|
+
hasOwnProperty = function (object, property) {
|
|
124
|
+
return _hasOwnProperty.call(object, property);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
hasOwnProperty = function (object, property) {
|
|
129
|
+
return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
if (!Function.prototype.bind) {
|
|
135
|
+
Function.prototype.bind = function bind(that) {
|
|
136
|
+
|
|
137
|
+
var target = this;
|
|
138
|
+
|
|
139
|
+
if (typeof target != "function") {
|
|
140
|
+
throw new TypeError();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
var args = slice.call(arguments, 1),
|
|
144
|
+
bound = function () {
|
|
145
|
+
|
|
146
|
+
if (this instanceof bound) {
|
|
147
|
+
|
|
148
|
+
var F = function(){};
|
|
149
|
+
F.prototype = target.prototype;
|
|
150
|
+
var self = new F;
|
|
151
|
+
|
|
152
|
+
var result = target.apply(
|
|
153
|
+
self,
|
|
154
|
+
args.concat(slice.call(arguments))
|
|
155
|
+
);
|
|
156
|
+
if (Object(result) === result) {
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
return self;
|
|
160
|
+
|
|
161
|
+
} else {
|
|
162
|
+
|
|
163
|
+
return target.apply(
|
|
164
|
+
that,
|
|
165
|
+
args.concat(slice.call(arguments))
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
return bound;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function setCss( str ) {
|
|
177
|
+
mStyle.cssText = str;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function setCssAll( str1, str2 ) {
|
|
181
|
+
return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function is( obj, type ) {
|
|
185
|
+
return typeof obj === type;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function contains( str, substr ) {
|
|
189
|
+
return !!~('' + str).indexOf(substr);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function testProps( props, prefixed ) {
|
|
193
|
+
for ( var i in props ) {
|
|
194
|
+
if ( mStyle[ props[i] ] !== undefined ) {
|
|
195
|
+
return prefixed == 'pfx' ? props[i] : true;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function testDOMProps( props, obj, elem ) {
|
|
202
|
+
for ( var i in props ) {
|
|
203
|
+
var item = obj[props[i]];
|
|
204
|
+
if ( item !== undefined) {
|
|
205
|
+
|
|
206
|
+
if (elem === false) return props[i];
|
|
207
|
+
|
|
208
|
+
if (is(item, 'function')){
|
|
209
|
+
return item.bind(elem || obj);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return item;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function testPropsAll( prop, prefixed, elem ) {
|
|
219
|
+
|
|
220
|
+
var ucProp = prop.charAt(0).toUpperCase() + prop.substr(1),
|
|
221
|
+
props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
|
|
222
|
+
|
|
223
|
+
if(is(prefixed, "string") || is(prefixed, "undefined")) {
|
|
224
|
+
return testProps(props, prefixed);
|
|
225
|
+
|
|
226
|
+
} else {
|
|
227
|
+
props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
|
|
228
|
+
return testDOMProps(props, prefixed, elem);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
var testBundle = (function( styles, tests ) {
|
|
233
|
+
var style = styles.join(''),
|
|
234
|
+
len = tests.length;
|
|
235
|
+
|
|
236
|
+
injectElementWithStyles(style, function( node, rule ) {
|
|
237
|
+
var style = document.styleSheets[document.styleSheets.length - 1],
|
|
238
|
+
cssText = style ? (style.cssRules && style.cssRules[0] ? style.cssRules[0].cssText : style.cssText || '') : '',
|
|
239
|
+
children = node.childNodes, hash = {};
|
|
240
|
+
|
|
241
|
+
while ( len-- ) {
|
|
242
|
+
hash[children[len].id] = children[len];
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
winkModernizr['touch'] = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch || (hash['touch'] && hash['touch'].offsetTop) === 9;
|
|
246
|
+
winkModernizr['csstransforms3d'] = (hash['csstransforms3d'] && hash['csstransforms3d'].offsetLeft) === 9 && hash['csstransforms3d'].offsetHeight === 3; winkModernizr['generatedcontent'] = (hash['generatedcontent'] && hash['generatedcontent'].offsetHeight) >= 1; winkModernizr['fontface'] = /src/i.test(cssText) &&
|
|
247
|
+
cssText.indexOf(rule.split(' ')[0]) === 0; }, len, tests);
|
|
248
|
+
|
|
249
|
+
})([
|
|
250
|
+
'@font-face {font-family:"font";src:url("https://")}' ,['@media (',prefixes.join('touch-enabled),('),mod,')',
|
|
251
|
+
'{#touch{top:9px;position:absolute}}'].join('') ,['@media (',prefixes.join('transform-3d),('),mod,')',
|
|
252
|
+
'{#csstransforms3d{left:9px;position:absolute;height:3px;}}'].join('')
|
|
253
|
+
|
|
254
|
+
,['#generatedcontent:after{content:"',smile,'";visibility:hidden}'].join('')
|
|
255
|
+
],
|
|
256
|
+
[
|
|
257
|
+
'fontface' ,'touch' ,'csstransforms3d'
|
|
258
|
+
,'generatedcontent'
|
|
259
|
+
|
|
260
|
+
]); tests['flexbox'] = function() {
|
|
261
|
+
return testPropsAll('flexOrder');
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
tests['flexbox-legacy'] = function() {
|
|
266
|
+
return testPropsAll('boxDirection');
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
tests['canvas'] = function() {
|
|
271
|
+
var elem = document.createElement('canvas');
|
|
272
|
+
return !!(elem.getContext && elem.getContext('2d'));
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
tests['canvastext'] = function() {
|
|
276
|
+
return !!(winkModernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
tests['webgl'] = function() {
|
|
281
|
+
try {
|
|
282
|
+
var canvas = document.createElement('canvas'),
|
|
283
|
+
ret;
|
|
284
|
+
ret = !!(window.WebGLRenderingContext && (canvas.getContext('experimental-webgl') || canvas.getContext('webgl')));
|
|
285
|
+
canvas = undefined;
|
|
286
|
+
} catch (e){
|
|
287
|
+
ret = false;
|
|
288
|
+
}
|
|
289
|
+
return ret;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
tests['touch'] = function() {
|
|
294
|
+
return winkModernizr['touch'];
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
tests['geolocation'] = function() {
|
|
298
|
+
return !!navigator.geolocation;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
tests['postmessage'] = function() {
|
|
302
|
+
return !!window.postMessage;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
tests['websqldatabase'] = function() {
|
|
307
|
+
return !!window.openDatabase;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
tests['indexedDB'] = function() {
|
|
311
|
+
return !!testPropsAll("indexedDB",window);
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
tests['hashchange'] = function() {
|
|
315
|
+
return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7);
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
tests['history'] = function() {
|
|
319
|
+
return !!(window.history && history.pushState);
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
tests['draganddrop'] = function() {
|
|
323
|
+
var div = document.createElement('div');
|
|
324
|
+
return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
tests['websockets'] = function() {
|
|
328
|
+
for ( var i = -1, len = cssomPrefixes.length; ++i < len; ){
|
|
329
|
+
if ( window[cssomPrefixes[i] + 'WebSocket'] ){
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return 'WebSocket' in window;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
tests['rgba'] = function() {
|
|
338
|
+
setCss('background-color:rgba(150,255,150,.5)');
|
|
339
|
+
|
|
340
|
+
return contains(mStyle.backgroundColor, 'rgba');
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
tests['hsla'] = function() {
|
|
344
|
+
setCss('background-color:hsla(120,40%,100%,.5)');
|
|
345
|
+
|
|
346
|
+
return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla');
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
tests['multiplebgs'] = function() {
|
|
350
|
+
setCss('background:url(https://),url(https://),red url(https://)');
|
|
351
|
+
|
|
352
|
+
return /(url\s*\(.*?){3}/.test(mStyle.background);
|
|
353
|
+
};
|
|
354
|
+
tests['backgroundsize'] = function() {
|
|
355
|
+
return testPropsAll('backgroundSize');
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
tests['borderimage'] = function() {
|
|
359
|
+
return testPropsAll('borderImage');
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
tests['borderradius'] = function() {
|
|
365
|
+
return testPropsAll('borderRadius');
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
tests['boxshadow'] = function() {
|
|
369
|
+
return testPropsAll('boxShadow');
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
tests['textshadow'] = function() {
|
|
373
|
+
return document.createElement('div').style.textShadow === '';
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
tests['opacity'] = function() {
|
|
378
|
+
setCssAll('opacity:.55');
|
|
379
|
+
|
|
380
|
+
return /^0.55$/.test(mStyle.opacity);
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
tests['cssanimations'] = function() {
|
|
385
|
+
return testPropsAll('animationName');
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
tests['csscolumns'] = function() {
|
|
390
|
+
return testPropsAll('columnCount');
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
tests['cssgradients'] = function() {
|
|
395
|
+
var str1 = 'background-image:',
|
|
396
|
+
str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
|
|
397
|
+
str3 = 'linear-gradient(left top,#9f9, white);';
|
|
398
|
+
|
|
399
|
+
setCss(
|
|
400
|
+
(str1 + '-webkit- '.split(' ').join(str2 + str1)
|
|
401
|
+
+ prefixes.join(str3 + str1)).slice(0, -str1.length)
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
return contains(mStyle.backgroundImage, 'gradient');
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
tests['cssreflections'] = function() {
|
|
409
|
+
return testPropsAll('boxReflect');
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
tests['csstransforms'] = function() {
|
|
414
|
+
return !!testPropsAll('transform');
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
tests['csstransforms3d'] = function() {
|
|
419
|
+
|
|
420
|
+
var ret = !!testPropsAll('perspective');
|
|
421
|
+
|
|
422
|
+
if ( ret && 'webkitPerspective' in docElement.style ) {
|
|
423
|
+
|
|
424
|
+
ret = winkModernizr['csstransforms3d'];
|
|
425
|
+
}
|
|
426
|
+
return ret;
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
tests['csstransitions'] = function() {
|
|
431
|
+
return testPropsAll('transition');
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
tests['fontface'] = function() {
|
|
437
|
+
return winkModernizr['fontface'];
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
tests['generatedcontent'] = function() {
|
|
441
|
+
return winkModernizr['generatedcontent'];
|
|
442
|
+
};
|
|
443
|
+
tests['video'] = function() {
|
|
444
|
+
var elem = document.createElement('video'),
|
|
445
|
+
bool = false;
|
|
446
|
+
|
|
447
|
+
try {
|
|
448
|
+
if ( bool = !!elem.canPlayType ) {
|
|
449
|
+
bool = new Boolean(bool);
|
|
450
|
+
bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
|
|
451
|
+
|
|
452
|
+
bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
|
|
453
|
+
|
|
454
|
+
bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
} catch(e) { }
|
|
458
|
+
|
|
459
|
+
return bool;
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
tests['audio'] = function() {
|
|
463
|
+
var elem = document.createElement('audio'),
|
|
464
|
+
bool = false;
|
|
465
|
+
|
|
466
|
+
try {
|
|
467
|
+
if ( bool = !!elem.canPlayType ) {
|
|
468
|
+
bool = new Boolean(bool);
|
|
469
|
+
bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
|
|
470
|
+
bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
|
|
471
|
+
|
|
472
|
+
bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
|
|
473
|
+
bool.m4a = ( elem.canPlayType('audio/x-m4a;') ||
|
|
474
|
+
elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
|
|
475
|
+
}
|
|
476
|
+
} catch(e) { }
|
|
477
|
+
|
|
478
|
+
return bool;
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
tests['localstorage'] = function() {
|
|
483
|
+
try {
|
|
484
|
+
localStorage.setItem(mod, mod);
|
|
485
|
+
localStorage.removeItem(mod);
|
|
486
|
+
return true;
|
|
487
|
+
} catch(e) {
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
tests['sessionstorage'] = function() {
|
|
493
|
+
try {
|
|
494
|
+
sessionStorage.setItem(mod, mod);
|
|
495
|
+
sessionStorage.removeItem(mod);
|
|
496
|
+
return true;
|
|
497
|
+
} catch(e) {
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
tests['webworkers'] = function() {
|
|
504
|
+
return !!window.Worker;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
tests['applicationcache'] = function() {
|
|
509
|
+
return !!window.applicationCache;
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
tests['svg'] = function() {
|
|
514
|
+
return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
tests['inlinesvg'] = function() {
|
|
518
|
+
var div = document.createElement('div');
|
|
519
|
+
div.innerHTML = '<svg/>';
|
|
520
|
+
return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
tests['smil'] = function() {
|
|
524
|
+
return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
tests['svgclippaths'] = function() {
|
|
529
|
+
return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
function webforms() {
|
|
533
|
+
winkModernizr['input'] = (function( props ) {
|
|
534
|
+
for ( var i = 0, len = props.length; i < len; i++ ) {
|
|
535
|
+
attrs[ props[i] ] = !!(props[i] in inputElem);
|
|
536
|
+
}
|
|
537
|
+
if (attrs.list){
|
|
538
|
+
attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);
|
|
539
|
+
}
|
|
540
|
+
return attrs;
|
|
541
|
+
})('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
|
|
542
|
+
winkModernizr['inputtypes'] = (function(props) {
|
|
543
|
+
|
|
544
|
+
for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
|
|
545
|
+
|
|
546
|
+
inputElem.setAttribute('type', inputElemType = props[i]);
|
|
547
|
+
bool = inputElem.type !== 'text';
|
|
548
|
+
|
|
549
|
+
if ( bool ) {
|
|
550
|
+
|
|
551
|
+
inputElem.value = smile;
|
|
552
|
+
inputElem.style.cssText = 'position:absolute;visibility:hidden;';
|
|
553
|
+
|
|
554
|
+
if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
|
|
555
|
+
|
|
556
|
+
docElement.appendChild(inputElem);
|
|
557
|
+
defaultView = document.defaultView;
|
|
558
|
+
|
|
559
|
+
bool = defaultView.getComputedStyle &&
|
|
560
|
+
defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
|
|
561
|
+
(inputElem.offsetHeight !== 0);
|
|
562
|
+
|
|
563
|
+
docElement.removeChild(inputElem);
|
|
564
|
+
|
|
565
|
+
} else if ( /^(search|tel)$/.test(inputElemType) ){
|
|
566
|
+
} else if ( /^(url|email)$/.test(inputElemType) ) {
|
|
567
|
+
bool = inputElem.checkValidity && inputElem.checkValidity() === false;
|
|
568
|
+
|
|
569
|
+
} else if ( /^color$/.test(inputElemType) ) {
|
|
570
|
+
docElement.appendChild(inputElem);
|
|
571
|
+
docElement.offsetWidth;
|
|
572
|
+
bool = inputElem.value != smile;
|
|
573
|
+
docElement.removeChild(inputElem);
|
|
574
|
+
|
|
575
|
+
} else {
|
|
576
|
+
bool = inputElem.value != smile;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
inputs[ props[i] ] = !!bool;
|
|
581
|
+
}
|
|
582
|
+
return inputs;
|
|
583
|
+
})('search tel url email datetime date month week time datetime-local number range color'.split(' '));
|
|
584
|
+
}
|
|
585
|
+
for ( var feature in tests ) {
|
|
586
|
+
if ( hasOwnProperty(tests, feature) ) {
|
|
587
|
+
featureName = feature.toLowerCase();
|
|
588
|
+
winkModernizr[featureName] = tests[feature]();
|
|
589
|
+
|
|
590
|
+
classes.push((winkModernizr[featureName] ? '' : 'no-') + featureName);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
winkModernizr.input || webforms();
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
winkModernizr.addTest = function ( feature, test ) {
|
|
598
|
+
if ( typeof feature == 'object' ) {
|
|
599
|
+
for ( var key in feature ) {
|
|
600
|
+
if ( hasOwnProperty( feature, key ) ) {
|
|
601
|
+
winkModernizr.addTest( key, feature[ key ] );
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
} else {
|
|
605
|
+
|
|
606
|
+
feature = feature.toLowerCase();
|
|
607
|
+
|
|
608
|
+
if ( winkModernizr[feature] !== undefined ) {
|
|
609
|
+
return winkModernizr;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
test = typeof test == 'function' ? test() : test;
|
|
613
|
+
|
|
614
|
+
winkModernizr[feature] = test;
|
|
615
|
+
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
return winkModernizr;
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
setCss('');
|
|
623
|
+
modElem = inputElem = null;
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
winkModernizr._version = version;
|
|
627
|
+
|
|
628
|
+
winkModernizr._prefixes = prefixes;
|
|
629
|
+
winkModernizr._domPrefixes = domPrefixes;
|
|
630
|
+
winkModernizr._cssomPrefixes = cssomPrefixes;
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
winkModernizr.hasEvent = isEventSupported;
|
|
634
|
+
|
|
635
|
+
winkModernizr.testProp = function(prop){
|
|
636
|
+
return testProps([prop]);
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
winkModernizr.testAllProps = testPropsAll;
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
winkModernizr.testStyles = injectElementWithStyles;
|
|
643
|
+
winkModernizr.prefixed = function(prop, obj, elem){
|
|
644
|
+
if(!obj) {
|
|
645
|
+
return testPropsAll(prop, 'pfx');
|
|
646
|
+
} else {
|
|
647
|
+
return testPropsAll(prop, obj, elem);
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
return winkModernizr;
|
|
654
|
+
|
|
655
|
+
})(this, this.document);
|
|
656
|
+
// contentEditable
|
|
657
|
+
// http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#contenteditable
|
|
658
|
+
// by Addy Osmani
|
|
659
|
+
winkModernizr.addTest('contenteditable', 'isContentEditable' in document.documentElement);
|
|
660
|
+
|
|
661
|
+
// by tauren
|
|
662
|
+
// https://github.com/Modernizr/Modernizr/issues/191
|
|
663
|
+
|
|
664
|
+
winkModernizr.addTest('cookies', function () {
|
|
665
|
+
// Quick test if browser has cookieEnabled host property
|
|
666
|
+
if (navigator.cookieEnabled) return true;
|
|
667
|
+
// Create cookie
|
|
668
|
+
document.cookie = "cookietest=1";
|
|
669
|
+
var ret = document.cookie.indexOf("cookietest=") != -1;
|
|
670
|
+
// Delete cookie
|
|
671
|
+
document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
|
|
672
|
+
return ret;
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
// cors
|
|
676
|
+
// By Theodoor van Donge
|
|
677
|
+
winkModernizr.addTest('cors', 'withCredentials' in new XMLHttpRequest);
|
|
678
|
+
|
|
679
|
+
// re-using winkModernizr.input if available
|
|
680
|
+
|
|
681
|
+
winkModernizr.addTest('placeholder', function(){
|
|
682
|
+
|
|
683
|
+
return !!( 'placeholder' in ( winkModernizr.input || document.createElement('input') ) &&
|
|
684
|
+
'placeholder' in ( winkModernizr.textarea || document.createElement('textarea') )
|
|
685
|
+
);
|
|
686
|
+
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
// IE8 compat mode aka Fake IE7
|
|
690
|
+
// by Erich Ocean
|
|
691
|
+
|
|
692
|
+
// In this case, IE8 will be acting as IE7. You may choose to remove features in this case.
|
|
693
|
+
|
|
694
|
+
// related:
|
|
695
|
+
// james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/
|
|
696
|
+
|
|
697
|
+
winkModernizr.addTest('ie8compat',function(){
|
|
698
|
+
return (!window.addEventListener && document.documentMode && document.documentMode === 7);
|
|
699
|
+
});
|
|
700
|
+
// native JSON support.
|
|
701
|
+
// developer.mozilla.org/en/JSON
|
|
702
|
+
|
|
703
|
+
// this will also succeed if you've loaded the JSON2.js polyfill ahead of time
|
|
704
|
+
// ... but that should be obvious. :)
|
|
705
|
+
|
|
706
|
+
winkModernizr.addTest('json', !!window.JSON && !!JSON.parse);
|
|
707
|
+
|
|
708
|
+
// requestAnimationFrame
|
|
709
|
+
// Offload animation repainting to browser for optimized performance.
|
|
710
|
+
// http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html
|
|
711
|
+
// By Addy Osmani
|
|
712
|
+
|
|
713
|
+
winkModernizr.addTest('raf', !!winkModernizr.prefixed('requestAnimationFrame', window));;
|