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
|
* MISSKEY CLIENT ENTRY POINT
|
||||||
*/
|
*/
|
||||||
{
|
|
||||||
const head = document.getElementsByTagName('head')[0];
|
|
||||||
|
|
||||||
// Detect user language
|
const head = document.getElementsByTagName('head')[0];
|
||||||
let lang = navigator.language.split('-')[0];
|
|
||||||
if (!/^(en|ja)$/.test(lang)) lang = 'en';
|
|
||||||
|
|
||||||
// Detect user agent
|
// Detect user language
|
||||||
const ua = navigator.userAgent.toLowerCase();
|
let lang = navigator.language.split('-')[0];
|
||||||
const isMobile = /mobile|iphone|ipad|android/.test(ua);
|
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 app = isMobile ? 'mobile' : 'desktop';
|
||||||
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) {
|
// 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');
|
const meta = document.createElement('meta');
|
||||||
meta.setAttribute('name', 'viewport');
|
meta.setAttribute('name', 'viewport');
|
||||||
meta.setAttribute('content', 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no');
|
meta.setAttribute('content', 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no');
|
||||||
head.appendChild(meta);
|
head.appendChild(meta);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user