Add unsupported browser message

ah shit
This commit is contained in:
earth 2022-03-20 20:35:03 -05:00
parent b0d3438c7e
commit 9656074b3c
6 changed files with 33 additions and 5 deletions

View File

@ -3,6 +3,7 @@ import { DC } from "./core/constants.js";
import { SpeedrunMilestones } from "./core/speedrun.js";
import TWEEN from "tween.js";
import { deepmergeAll } from "@/utility/deepmerge";
import { supportedBrowsers } from "./supportedBrowsers";
if (GlobalErrorHandler.handled) {
throw new Error("Initialization failed");
@ -1061,7 +1062,7 @@ export function simulateTime(seconds, real, fast) {
window.onload = function() {
GameUI.initialized = true;
ui.view.initialized = true;
ui.view.initialized = browserCheck();
setTimeout(() => {
if (kong.enabled) {
playFabLogin();
@ -1069,6 +1070,11 @@ window.onload = function() {
document.getElementById("loading").style.display = "none";
document.body.style.overflowY = "auto";
}, 500);
if (!ui.view.initialized) {
GameIntervals.stop();
document.getElementById("loading").style.display = "none";
document.getElementById("browser-warning").style.display = "flex";
}
};
window.onfocus = function() {
@ -1084,7 +1090,11 @@ export function setShiftKey(isDown) {
}
export function setHoldingR(x) {
Replicanti.galaxies.isPlayerHoldingR = x;
Replicanti.galaxies.isPlayerHoldingR = x;qqqqqqq
}
export function browserCheck() {
return supportedBrowsers.test(navigator.userAgent);
}
export function init() {

View File

@ -0,0 +1 @@
export const supportedBrowsers = /((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(14[_.]5|14[_.]([6-9]|\d{2,})|14[_.]8|14[_.](9|\d{2,})|(1[5-9]|[2-9]\d|\d{3,})[_.]\d+|15[_.]0|15[_.]([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[_.]\d+)(?:[_.]\d+)?)|(Opera Mini(?:\/att)?\/?(\d+)?(?:\.\d+)?(?:\.\d+)?)|(Opera\/.+Opera Mobi.+Version\/(64\.0|64\.([1-9]|\d{2,})|(6[5-9]|[7-9]\d|\d{3,})\.\d+))|(Opera\/(64\.0|64\.([1-9]|\d{2,})|(6[5-9]|[7-9]\d|\d{3,})\.\d+).+Opera Mobi)|(Opera Mobi.+Opera(?:\/|\s+)(64\.0|64\.([1-9]|\d{2,})|(6[5-9]|[7-9]\d|\d{3,})\.\d+))|((?:Chrome).*OPR\/(82\.0|82\.([1-9]|\d{2,})|(8[3-9]|9\d|\d{3,})\.\d+)\.\d+)|(SamsungBrowser\/(15\.0|15\.([1-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+))|(Edge\/(98(?:\.0)?|98(?:\.([1-9]|\d{2,}))?|(99|\d{3,})(?:\.\d+)?))|((Chromium|Chrome)\/(97\.0|97\.([1-9]|\d{2,})|(9[8-9]|\d{3,})\.\d+)(?:\.\d+)?)|(Version\/(15\.2|15\.([3-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+)(?:\.\d+)? Safari\/)|(Trident\/7\.0)|(Firefox\/(96\.0|96\.([1-9]|\d{2,})|(9[7-9]|\d{3,})\.\d+)\.\d+)|(Firefox\/(96\.0|96\.([1-9]|\d{2,})|(9[7-9]|\d{3,})\.\d+)(pre|[ab]\d+[a-z]*)?)|(([MS]?IE) (11\.0|11\.([1-9]|\d{2,})|(1[2-9]|[2-9]\d|\d{3,})\.\d+))/

View File

@ -3,7 +3,8 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build && node build/post-build.js",
"lint": "vue-cli-service lint"
"lint": "vue-cli-service lint",
"supportedBrowsers": "(echo export const supportedBrowsers = && browserslist-useragent-regexp --allowHigherVersions) > supportedBrowsers.js"
},
"dependencies": {
"@antimatter-dimensions/notations": "^2.2.0",

View File

@ -25,6 +25,11 @@
</head>
<body>
<div id="browser-warning">
Your browser is not supported.
<br>
Please update to a newer browser.
</div>
<div id="loading"></div>
<div id="ui"></div>
<div id="background-animations">

View File

@ -581,6 +581,17 @@ button:focus {
z-index: 999;
}
#browser-warning {
height: 100%;
width: 100%;
z-index: 999;
align-items: center;
justify-content: center;
background-color: black;
font-size: 7rem;
display: none;
}
.o-save-timer {
color: var(--color-text);
position: fixed;

View File

@ -1,8 +1,8 @@
import "drag-drop-touch";
import "./shims";
import "./merge-globals";
import { init } from "../javascripts/game";
import { init, browserCheck } from "../javascripts/game";
import { watchLatestCommit } from "@/commit-watcher";
init();
if (browserCheck()) init();
watchLatestCommit();