Improved old Safari browser handling (Safari still needs a lots of improvements)

canary
WolverinDEV 2018-09-25 20:44:57 +02:00
parent 1d0d4f2f37
commit 46e5bb4121
2 changed files with 37 additions and 2 deletions

View File

@ -75,6 +75,7 @@
gtag('js', new Date());
gtag('config', 'UA-113151733-4');
</script>
<script src="vendor/jquery/jquery.min.js"></script>
<div id="scripts">
<script type="application/javascript" src="js/load.js" defer></script>
</div>
@ -149,7 +150,7 @@
</div>
</div>
<div class="dropdown">
<div class="btn_away_toggle"><div class="icon client-away"></div><a>Toggle away status</a></div>
<div class="btn_away_toggle"><div class="icon client-away"></div><a>Toggle away status</a></div>vendor/jquery/jquery.min.js
<div class="btn_away_message"><div class="icon client-away"></div><a>Set away message</a></div>
</div>
</div>

View File

@ -263,15 +263,49 @@ function loadTemplates() {
});
}
interface Navigator {
browserSpecs: {
name: string,
version: string
}
}
navigator.browserSpecs = (function(){
let ua = navigator.userAgent, tem, M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return {name:'IE',version:(tem[1] || '')};
}
if(M[1]=== 'Chrome'){
tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
if(tem != null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};
}
M = M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem = ua.match(/version\/(\d+)/i))!= null)
M.splice(1, 1, tem[1]);
return {name:M[0], version:M[1]};
})();
console.log(navigator.browserSpecs); //Object { name: "Firefox", version: "42" }
//TODO release config!
function loadSide() {
if(typeof (WebAssembly) === "undefined" || typeof (WebAssembly.compile) === "undefined") {
console.log(navigator.browserSpecs);
if (navigator.browserSpecs.name == 'Safari') {
if (parseInt(navigator.browserSpecs.version) < 11) {
displayCriticalError("You require Safari 11 or higher to use the web client!<br>Safari " + navigator.browserSpecs.version + " does not support WebAssambly!");
return;
}
}
else {
// Do something for all other browsers.
}
displayCriticalError("You require WebAssembly for TeaSpeak-Web!");
return;
}
//Load the general scripts and required scripts
awaitLoad(loadScripts([
["vendor/jquery/jquery.min.js", /*"https://code.jquery.com/jquery-latest.min.js"*/],
//["vendor/jquery/jquery.min.js", /*"https://code.jquery.com/jquery-latest.min.js"*/],
["vendor/bbcode/xbbcode.js"],
["https://webrtc.github.io/adapter/adapter-latest.js"]
])).then(() => awaitLoad(loadScripts([