mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-12 21:58:58 +09:00
Update script.js
This commit is contained in:
parent
d0f11c0a52
commit
580e06360e
@ -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