Add WebGL support test.
This commit is contained in:
+21
-4
@@ -47,13 +47,30 @@ for a in s
|
||||
e = $ "s-#{a[0]}"
|
||||
(f = -> e.innerHTML = a[4]+a[1][a[3]])()
|
||||
e.onclick = -> f(a[3] = (a[3]+1)%a[1].length)
|
||||
$('start').onclick = ->
|
||||
$('step-1').style.display = 'none'
|
||||
$('step-2').style.display = 'block'
|
||||
$('step-2').style.backgroundImage = "url(css/help-#{s[0][3]}.png)"
|
||||
$('step-2').onclick = ->
|
||||
$('step-2').style.display = 'none'
|
||||
$('step-3').style.display = 'block'
|
||||
init s[0][3], s[1][3], s[2][3], s[3][3]
|
||||
$('step-5').onclick = ->
|
||||
window.location.reload()
|
||||
|
||||
hasWebGL = ->
|
||||
gl = null
|
||||
canvas = document.createElement('canvas');
|
||||
try
|
||||
gl = canvas.getContext("webgl")
|
||||
if not gl?
|
||||
try
|
||||
gl = canvas.getContext("experimental-webgl")
|
||||
return gl?
|
||||
|
||||
if not hasWebGL()
|
||||
getWebGL = $('start')
|
||||
getWebGL.innerHTML = 'WebGL is not supported!'
|
||||
getWebGL.onclick = ->
|
||||
window.location.href = 'http://get.webgl.org/'
|
||||
else
|
||||
$('start').onclick = ->
|
||||
$('step-1').style.display = 'none'
|
||||
$('step-2').style.display = 'block'
|
||||
$('step-2').style.backgroundImage = "url(css/help-#{s[0][3]}.png)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Generated by CoffeeScript 1.6.3
|
||||
(function() {
|
||||
var $, a, init, s, u, _fn, _i, _len;
|
||||
var $, a, getWebGL, hasWebGL, init, s, u, _fn, _i, _len;
|
||||
|
||||
$ = function(_) {
|
||||
return document.getElementById(_);
|
||||
@@ -64,12 +64,6 @@
|
||||
_fn(a);
|
||||
}
|
||||
|
||||
$('start').onclick = function() {
|
||||
$('step-1').style.display = 'none';
|
||||
$('step-2').style.display = 'block';
|
||||
return $('step-2').style.backgroundImage = "url(css/help-" + s[0][3] + ".png)";
|
||||
};
|
||||
|
||||
$('step-2').onclick = function() {
|
||||
$('step-2').style.display = 'none';
|
||||
$('step-3').style.display = 'block';
|
||||
@@ -80,4 +74,33 @@
|
||||
return window.location.reload();
|
||||
};
|
||||
|
||||
hasWebGL = function() {
|
||||
var canvas, gl;
|
||||
gl = null;
|
||||
canvas = document.createElement('canvas');
|
||||
try {
|
||||
gl = canvas.getContext("webgl");
|
||||
} catch (_error) {}
|
||||
if (gl == null) {
|
||||
try {
|
||||
gl = canvas.getContext("experimental-webgl");
|
||||
} catch (_error) {}
|
||||
}
|
||||
return gl != null;
|
||||
};
|
||||
|
||||
if (!hasWebGL()) {
|
||||
getWebGL = $('start');
|
||||
getWebGL.innerHTML = 'WebGL is not supported!';
|
||||
getWebGL.onclick = function() {
|
||||
return window.location.href = 'http://get.webgl.org/';
|
||||
};
|
||||
} else {
|
||||
$('start').onclick = function() {
|
||||
$('step-1').style.display = 'none';
|
||||
$('step-2').style.display = 'block';
|
||||
return $('step-2').style.backgroundImage = "url(css/help-" + s[0][3] + ".png)";
|
||||
};
|
||||
}
|
||||
|
||||
}).call(this);
|
||||
|
||||
Reference in New Issue
Block a user