57 lines
1.5 KiB
JavaScript
57 lines
1.5 KiB
JavaScript
#buildvars
|
|
|
|
(function() {
|
|
var isCompatible = (function() {
|
|
if(navigator.userAgent.indexOf('MSIE') >= 0)
|
|
return false;
|
|
if(navigator.userAgent.indexOf('Trident/') >= 0)
|
|
return false;
|
|
|
|
if(!('Blob' in window) || !('prototype' in window.Blob)
|
|
|| window.Blob.prototype.constructor.name !== 'Blob')
|
|
return false;
|
|
|
|
if(!('AudioContext' in window) && !('webkitAudioContext' in window))
|
|
return false;
|
|
|
|
if(!('URL' in window) || !('createObjectURL' in window.URL)
|
|
|| window.URL.prototype.constructor.name !== 'URL')
|
|
return false;
|
|
|
|
if(!('localStorage' in window))
|
|
return false;
|
|
try {
|
|
var testVar = 'test';
|
|
localStorage.setItem(testVar, testVar);
|
|
if(localStorage.getItem(testVar) !== testVar)
|
|
throw '';
|
|
localStorage.removeItem(testVar);
|
|
} catch(e) {
|
|
return false;
|
|
}
|
|
|
|
try {
|
|
eval('const c = 1; let l = 2;');
|
|
} catch(e) {
|
|
return false;
|
|
}
|
|
|
|
try {
|
|
eval('for(const i of ["a", "b"]);');
|
|
} catch(e) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
})();
|
|
|
|
if(isCompatible) {
|
|
(function(script) {
|
|
script.src = MAMI_JS;
|
|
script.type = 'text/javascript';
|
|
script.charset = 'utf-8';
|
|
document.body.appendChild(script);
|
|
})(document.createElement('script'));
|
|
} else location.assign(window.AMI_URL);
|
|
})();
|