summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-05-18 14:12:27 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-05-18 14:12:27 +0900
commit3454e137b7d2ed928493fa844ebe0b2551455df1 (patch)
tree2957f7fda57620feb2a54c0ebbf0802ac031cc58 /src
parentFix (diff)
downloadmisskey-3454e137b7d2ed928493fa844ebe0b2551455df1.tar.gz
misskey-3454e137b7d2ed928493fa844ebe0b2551455df1.tar.bz2
misskey-3454e137b7d2ed928493fa844ebe0b2551455df1.zip
Refactorung
Diffstat (limited to 'src')
-rw-r--r--src/web/app/boot.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/web/app/boot.js b/src/web/app/boot.js
index 4df44ed793..95f5957d09 100644
--- a/src/web/app/boot.js
+++ b/src/web/app/boot.js
@@ -1,9 +1,19 @@
/**
- * MISSKEY ENTRY POINT
+ * MISSKEY BOOT LOADER
+ * (ENTRY POINT)
*/
+/**
+ * ドメインに基づいて適切なスクリプトを読み込みます。
+ * ユーザーの言語およびモバイル端末か否かも考慮します。
+ */
+
+'use strict';
+
+// Get the current url information
const Url = new URL(location.href);
+// Extarct the (sub) domain part
let app = Url.host.split('.')[0];
// Detect user language
@@ -14,8 +24,10 @@ if (!/^(en|ja)$/.test(lang)) lang = 'en';
const ua = navigator.userAgent.toLowerCase();
const isMobile = /mobile|iphone|ipad|android/.test(ua);
-const head = document.getElementsByTagName('head')[0];
+// Get the <head> element
+const [head] = document.getElementsByTagName('head');
+// If mobile, insert the viewport meta tag
if (isMobile) {
const meta = document.createElement('meta');
meta.setAttribute('name', 'viewport');
@@ -23,6 +35,7 @@ if (isMobile) {
head.appendChild(meta);
}
+// Switch desktop or mobile version
if (app == 'misskey') {
app = isMobile ? 'mobile' : 'desktop';
}