mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 17:03:49 +01:00
Update script.js
This commit is contained in:
parent
80625f3f18
commit
1403e6124b
@ -1,30 +1,29 @@
|
||||
/**
|
||||
* MISSKEY CLIENT ENTRY POINT
|
||||
*/
|
||||
{
|
||||
const head = document.getElementsByTagName('head')[0];
|
||||
|
||||
// Detect user language
|
||||
let lang = navigator.language.split('-')[0];
|
||||
if (!/^(en|ja)$/.test(lang)) lang = 'en';
|
||||
const head = document.getElementsByTagName('head')[0];
|
||||
|
||||
// Detect user agent
|
||||
const ua = navigator.userAgent.toLowerCase();
|
||||
const isMobile = /mobile|iphone|ipad|android/.test(ua);
|
||||
// Detect user language
|
||||
let lang = navigator.language.split('-')[0];
|
||||
if (!/^(en|ja)$/.test(lang)) lang = 'en';
|
||||
|
||||
const app = isMobile ? 'mobile' : 'desktop';
|
||||
// Detect user agent
|
||||
const ua = navigator.userAgent.toLowerCase();
|
||||
const isMobile = /mobile|iphone|ipad|android/.test(ua);
|
||||
|
||||
// Load app script
|
||||
const script = document.createElement('script');
|
||||
script.setAttribute('src', `/assets/${app}.${VERSION}.${lang}.js`);
|
||||
script.setAttribute('async', 'true');
|
||||
script.setAttribute('defer', 'true');
|
||||
head.appendChild(script);
|
||||
const app = isMobile ? 'mobile' : 'desktop';
|
||||
|
||||
if (isMobile) {
|
||||
const meta = document.createElement('meta');
|
||||
meta.setAttribute('name', 'viewport');
|
||||
meta.setAttribute('content', 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no');
|
||||
head.appendChild(meta);
|
||||
}
|
||||
// Load app script
|
||||
const script = document.createElement('script');
|
||||
script.setAttribute('src', `/assets/${app}.${VERSION}.${lang}.js`);
|
||||
script.setAttribute('async', 'true');
|
||||
script.setAttribute('defer', 'true');
|
||||
head.appendChild(script);
|
||||
|
||||
if (isMobile) {
|
||||
const meta = document.createElement('meta');
|
||||
meta.setAttribute('name', 'viewport');
|
||||
meta.setAttribute('content', 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no');
|
||||
head.appendChild(meta);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user