sockscape/client/lib/check.js

61 lines
1.9 KiB
JavaScript
Raw Normal View History

2017-04-19 21:05:28 +00:00
// feature checking trashcode (c) obrado 1989
2017-09-05 04:24:40 +00:00
window.addEventListener("load", function() {
var support = {
2017-04-19 21:05:28 +00:00
anim: true,
canvas: true,
webgl: true,
idb: true
};
if(!document.getElementById("cs").getContext)
support.canvas = false;
// check for webgl support
var canvas = document.getElementById("cs");
2017-05-26 20:28:02 +00:00
Rendering.context = canvas.getContext("webgl");
if(!Rendering.context) {
Rendering.context = canvas.getContext("experimental-webgl");
if(!Rendering.context)
support.webgl = false;
}
// check for animation frame support
window.requestAnimationFrame = window.requestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.oRequestAnimationFrame
|| window.msRequestAnimationFrame;
if(!window.requestAnimationFrame)
support.anim = false;
// check for indexedDB support
2017-05-26 20:28:02 +00:00
window.indexedDB = window.indexedDB
|| window.mozIndexedDB
|| window.webkitIndexedDB
|| window.msIndexedDB;
window.IDBTransaction = window.IDBTransaction
|| window.webkitIDBTransaction
|| window.msIDBransaction;
window.IDBKeyRange = window.IDBKeyRange
|| window.webkitIDBKeyRange
|| window.msIDBKeyRange;
if(!window.indexedDB)
support.idb = false;
2017-05-15 18:19:32 +00:00
var supported = true;
for(var i in support)
supported = supported && support[i];
if(!supported) {
var supportStr = "";
for(var i in support)
supportStr += ""+ (+support[i]);
window.location.href = "error.html?err="+ supportStr;
return;
}
2017-04-18 04:59:38 +00:00
Entrypoint.start();
2017-09-05 04:24:40 +00:00
});