summaryrefslogtreecommitdiff
path: root/src/web/app/client
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2016-12-29 07:49:51 +0900
committersyuilo <syuilotan@yahoo.co.jp>2016-12-29 07:49:51 +0900
commitb3f42e62af698a67c2250533c437569559f1fdf9 (patch)
treecdf6937576e99cccf85e6fa3aa8860a1173c7cfb /src/web/app/client
downloadsharkey-b3f42e62af698a67c2250533c437569559f1fdf9.tar.gz
sharkey-b3f42e62af698a67c2250533c437569559f1fdf9.tar.bz2
sharkey-b3f42e62af698a67c2250533c437569559f1fdf9.zip
Initial commit :four_leaf_clover:
Diffstat (limited to 'src/web/app/client')
-rw-r--r--src/web/app/client/script.js40
-rw-r--r--src/web/app/client/view.pug5
2 files changed, 45 insertions, 0 deletions
diff --git a/src/web/app/client/script.js b/src/web/app/client/script.js
new file mode 100644
index 0000000000..d8531e9cc8
--- /dev/null
+++ b/src/web/app/client/script.js
@@ -0,0 +1,40 @@
+const head = document.getElementsByTagName('head')[0];
+const ua = navigator.userAgent.toLowerCase();
+const isMobile = /mobile|iphone|ipad|android/.test(ua);
+
+if (isMobile) {
+ mountMobile();
+} else {
+ mountDesktop();
+}
+
+function mountDesktop() {
+ const style = document.createElement('link');
+ style.setAttribute('href', '/_/resources/desktop/style.css');
+ style.setAttribute('rel', 'stylesheet');
+ head.appendChild(style);
+
+ const script = document.createElement('script');
+ script.setAttribute('src', '/_/resources/desktop/script.js');
+ script.setAttribute('async', 'true');
+ script.setAttribute('defer', 'true');
+ head.appendChild(script);
+}
+
+function mountMobile() {
+ 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);
+
+ const style = document.createElement('link');
+ style.setAttribute('href', '/_/resources/mobile/style.css');
+ style.setAttribute('rel', 'stylesheet');
+ head.appendChild(style);
+
+ const script = document.createElement('script');
+ script.setAttribute('src', '/_/resources/mobile/script.js');
+ script.setAttribute('async', 'true');
+ script.setAttribute('defer', 'true');
+ head.appendChild(script);
+}
diff --git a/src/web/app/client/view.pug b/src/web/app/client/view.pug
new file mode 100644
index 0000000000..6f0ff3cd5c
--- /dev/null
+++ b/src/web/app/client/view.pug
@@ -0,0 +1,5 @@
+extends ../base
+
+block head
+ script
+ include ./../../../../built/web/resources/client/script.js