This commit is contained in:
syuilo
2017-02-19 12:31:23 +09:00
parent 05d8078a18
commit 4193b990c7
10 changed files with 121 additions and 94 deletions

View File

@@ -2,18 +2,9 @@ const head = document.getElementsByTagName('head')[0];
const ua = navigator.userAgent.toLowerCase();
const isMobile = /mobile|iphone|ipad|android/.test(ua);
if (isMobile) {
mountMobile();
} else {
mountDesktop();
}
isMobile ? mountMobile() : 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');
@@ -27,11 +18,6 @@ function mountMobile() {
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');