This commit is contained in:
syuilo 2017-02-22 03:13:19 +09:00
parent 82a28f4c05
commit d9703eab67
5 changed files with 40 additions and 42 deletions

View File

@ -174,11 +174,7 @@ gulp.task('build:client:scripts', () => new Promise(async (ok) => {
.pipe(babel({ .pipe(babel({
presets: ['es2015'] presets: ['es2015']
})) }))
.pipe(uglify({ .pipe(uglify());
mangle: {
toplevel: true
}
}));
} }
es.merge( es.merge(

View File

@ -16,8 +16,8 @@ html(lang='ja', dir='ltr')
block head block head
body body
noscript: div: p JavaScriptを有効にしてください noscript: p JavaScriptを有効にしてください
div#init: p div#ini: p
span . span .
span . span .
span . span .

View File

@ -94,7 +94,7 @@ module.exports = callback => {
mixins(me); mixins(me);
const init = document.getElementById('init'); const init = document.getElementById('ini');
init.parentNode.removeChild(init); init.parentNode.removeChild(init);
const app = document.createElement('div'); const app = document.createElement('div');

View File

@ -1,26 +1,28 @@
const head = document.getElementsByTagName('head')[0]; (() => {
const ua = navigator.userAgent.toLowerCase(); const head = document.getElementsByTagName('head')[0];
const isMobile = /mobile|iphone|ipad|android/.test(ua); const ua = navigator.userAgent.toLowerCase();
const isMobile = /mobile|iphone|ipad|android/.test(ua);
isMobile ? mountMobile() : mountDesktop(); isMobile ? mountMobile() : mountDesktop();
function mountDesktop() { function mountDesktop() {
const script = document.createElement('script'); const script = document.createElement('script');
script.setAttribute('src', '/_/resources/desktop/script.js'); script.setAttribute('src', '/_/resources/desktop/script.js');
script.setAttribute('async', 'true'); script.setAttribute('async', 'true');
script.setAttribute('defer', 'true'); script.setAttribute('defer', 'true');
head.appendChild(script); head.appendChild(script);
} }
function mountMobile() { function mountMobile() {
const meta = document.createElement('meta'); const meta = document.createElement('meta');
meta.setAttribute('name', 'viewport'); meta.setAttribute('name', 'viewport');
meta.setAttribute('content', 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no'); meta.setAttribute('content', 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no');
head.appendChild(meta); head.appendChild(meta);
const script = document.createElement('script'); const script = document.createElement('script');
script.setAttribute('src', '/_/resources/mobile/script.js'); script.setAttribute('src', '/_/resources/mobile/script.js');
script.setAttribute('async', 'true'); script.setAttribute('async', 'true');
script.setAttribute('defer', 'true'); script.setAttribute('defer', 'true');
head.appendChild(script); head.appendChild(script);
} }
})();

View File

@ -4,9 +4,9 @@ html {
font-family: sans-serif; font-family: sans-serif;
} }
body > noscript > div { body > noscript {
position: fixed; position: fixed;
z-index: 32768; z-index: 2;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
@ -14,16 +14,16 @@ body > noscript > div {
text-align: center; text-align: center;
background: #fff; background: #fff;
} }
body > noscript > div > p { body > noscript > p {
display: block; display: block;
margin: 32px; margin: 32px;
font-size: 2em; font-size: 2em;
color: #555; color: #555;
} }
#init { #ini {
position: fixed; position: fixed;
z-index: 16384; z-index: 1;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
@ -32,27 +32,27 @@ body > noscript > div {
background: #fff; background: #fff;
cursor: wait; cursor: wait;
} }
#init > p { #ini > p {
display: block; display: block;
user-select: none; user-select: none;
margin: 32px; margin: 32px;
font-size: 4em; font-size: 4em;
color: #555; color: #555;
} }
#init > p > span { #ini > p > span {
animation: init 1.4s infinite ease-in-out both; animation: ini 1.4s infinite ease-in-out both;
} }
#init > p > span:nth-child(1) { #ini > p > span:nth-child(1) {
animation-delay: 0s; animation-delay: 0s;
} }
#init > p > span:nth-child(2) { #ini > p > span:nth-child(2) {
animation-delay: 0.16s; animation-delay: 0.16s;
} }
#init > p > span:nth-child(3) { #ini > p > span:nth-child(3) {
animation-delay: 0.32s; animation-delay: 0.32s;
} }
@keyframes init { @keyframes ini {
0%, 80%, 100% { 0%, 80%, 100% {
opacity: 1; opacity: 1;
} }