From c8de4d6a1173da1f0caab163d3361f1d29724966 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 22 Aug 2021 22:22:53 +0900 Subject: [PATCH] refactoring --- src/client/init.ts | 5 +---- src/server/web/boot.js | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/client/init.ts b/src/client/init.ts index 194ece886..4d2170e03 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -101,15 +101,12 @@ window.addEventListener('resize', () => { }); //#endregion -// Get the element -const head = document.getElementsByTagName('head')[0]; - // If mobile, insert the viewport meta tag if (isMobile || window.innerWidth <= 1024) { const viewport = document.getElementsByName('viewport').item(0); viewport.setAttribute('content', `${viewport.getAttribute('content')},minimum-scale=1,maximum-scale=1,user-scalable=no`); - head.appendChild(viewport); + document.head.appendChild(viewport); } //#region Set lang attr diff --git a/src/server/web/boot.js b/src/server/web/boot.js index e2fd137f9..7a41ae255 100644 --- a/src/server/web/boot.js +++ b/src/server/web/boot.js @@ -60,8 +60,6 @@ ? `?salt=${localStorage.getItem('salt')}` : ''; - const head = document.getElementsByTagName('head')[0]; - const script = document.createElement('script'); script.setAttribute('src', `/assets/app.${v}.js${salt}`); script.setAttribute('async', 'true'); @@ -70,7 +68,7 @@ renderError('APP_FETCH_FAILED'); checkUpdate(); }); - head.appendChild(script); + document.head.appendChild(script); //#endregion //#region Theme