summaryrefslogtreecommitdiff
path: root/src/web/app
diff options
context:
space:
mode:
authorsyuilo⭐️ <Syuilotan@yahoo.co.jp>2017-04-17 15:52:38 +0900
committerGitHub <noreply@github.com>2017-04-17 15:52:38 +0900
commit580e06360ea8b430d4cc1b358bd487598b7267c1 (patch)
treedd823533a1cc7f8eb52245fa40b8b1f0b50fbfc4 /src/web/app
parentv1651 (diff)
downloadsharkey-580e06360ea8b430d4cc1b358bd487598b7267c1.tar.gz
sharkey-580e06360ea8b430d4cc1b358bd487598b7267c1.tar.bz2
sharkey-580e06360ea8b430d4cc1b358bd487598b7267c1.zip
Update script.js
Diffstat (limited to 'src/web/app')
-rw-r--r--src/web/app/client/script.js41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/web/app/client/script.js b/src/web/app/client/script.js
index fd0c20e012..465d3edb38 100644
--- a/src/web/app/client/script.js
+++ b/src/web/app/client/script.js
@@ -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);
}