forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDetector.js
62 lines (42 loc) · 1.34 KB
/
Detector.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* @author alteredq / http://alteredqualia.com/
*/
Detector = {
// supported features
canvas : !!window.CanvasRenderingContext2D,
webgl : !!window.WebGLRenderingContext,
workers : !!window.Worker,
// helper methods
addGetWebGLMessage: function( parameters ) {
var parent = document.body,
id = "oldie" ;
if ( parameters ) {
if ( parameters.parent !== undefined ) parent = parameters.parent;
if ( parameters.id !== undefined ) id = parameters.id;
}
var html = [
'Sorry, your browser doesn\'t support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation">WebGL</a><br/>',
'<br/>',
'Please try with',
'<a href="http://www.google.com/chrome">Chrome 9+</a> /',
'<a href="http://www.mozilla.com/en-US/firefox/all-beta.html">Firefox 4+</a> /',
'<a href="http://nightly.webkit.org/">Safari 10.6+</a>'
].join("\n");
var wrap = document.createElement( "center" ),
message = document.createElement( "div" );
message.innerHTML = html;
message.id = id;
var style = message.style;
style.fontFamily = "monospace";
style.fontSize = "13px";
style.textAlign = "center";
style.background = "#eee";
style.color = "#000";
style.padding = "1em";
style.width = "475px";
style.margin = "5em auto 0";
wrap.appendChild( message )
parent.appendChild( wrap );
return message;
}
};