diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-03-23 19:00:04 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-03-23 19:00:04 +0900 |
| commit | 50e65d292c2425dc24aa37c593e401b2114469e6 (patch) | |
| tree | d30e3848b49cd23b3c3c4c4fc9550e91bac14b25 /src/web/app | |
| parent | wip #313 (diff) | |
| download | sharkey-50e65d292c2425dc24aa37c593e401b2114469e6.tar.gz sharkey-50e65d292c2425dc24aa37c593e401b2114469e6.tar.bz2 sharkey-50e65d292c2425dc24aa37c593e401b2114469e6.zip | |
Refactoring
Diffstat (limited to 'src/web/app')
| -rw-r--r-- | src/web/app/auth/view.pug | 2 | ||||
| -rw-r--r-- | src/web/app/client/script.js | 29 | ||||
| -rw-r--r-- | src/web/app/dev/view.pug | 2 |
3 files changed, 10 insertions, 23 deletions
diff --git a/src/web/app/auth/view.pug b/src/web/app/auth/view.pug index ae2a652022..5bc3b20ffc 100644 --- a/src/web/app/auth/view.pug +++ b/src/web/app/auth/view.pug @@ -2,4 +2,4 @@ extends ../base block head meta(name='viewport' content='width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no') - script(src=`/assets/auth/script.${version}.js` async defer) + script(src=`/assets/auth.${version}.js` async defer) diff --git a/src/web/app/client/script.js b/src/web/app/client/script.js index 876d2c1694..d46aa4a181 100644 --- a/src/web/app/client/script.js +++ b/src/web/app/client/script.js @@ -12,32 +12,19 @@ const ua = navigator.userAgent.toLowerCase(); const isMobile = /mobile|iphone|ipad|android/.test(ua); - isMobile ? mountMobile() : mountDesktop(); + const app = isMobile ? 'mobile' : 'desktop'; - /** - * Mount the desktop app - */ - function mountDesktop() { - const script = document.createElement('script'); - script.setAttribute('src', `/assets/desktop/script.${VERSION}.${lang}.js`); - script.setAttribute('async', 'true'); - script.setAttribute('defer', 'true'); - head.appendChild(script); - } + // 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); - /** - * Mount the mobile app - */ - function mountMobile() { + 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); - - const script = document.createElement('script'); - script.setAttribute('src', `/assets/mobile/script.${VERSION}.${lang}.js`); - script.setAttribute('async', 'true'); - script.setAttribute('defer', 'true'); - head.appendChild(script); } })(); diff --git a/src/web/app/dev/view.pug b/src/web/app/dev/view.pug index b8bbddb50c..1a9a0e5bbd 100644 --- a/src/web/app/dev/view.pug +++ b/src/web/app/dev/view.pug @@ -1,4 +1,4 @@ extends ../base block head - script(src=`/assets/dev/script.${version}.js` async defer) + script(src=`/assets/dev.${version}.js` async defer) |