From f2aa09ad7cbc27ec59fc5f6a04aa128cc50a9830 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Wed, 26 Aug 2020 19:10:57 +0800 Subject: [PATCH] [hello-dolly] wrap code in a block --- plugins/hello-dolly/assets/hello-dolly.ts | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/plugins/hello-dolly/assets/hello-dolly.ts b/plugins/hello-dolly/assets/hello-dolly.ts index a2b74f20..fb04842a 100644 --- a/plugins/hello-dolly/assets/hello-dolly.ts +++ b/plugins/hello-dolly/assets/hello-dolly.ts @@ -1,4 +1,5 @@ -const lyrics = `Hello, Dolly +{ + const lyrics = `Hello, Dolly Well, hello, Dolly It's so nice to have you back where you belong You're lookin' swell, Dolly @@ -27,20 +28,19 @@ Dolly'll never go away Dolly'll never go away Dolly'll never go away again`.split('\n') -const length = lyrics.length + const length = lyrics.length -const hitokoto = document.createElement('div') -hitokoto.style.marginTop = '3px' -hitokoto.textContent = lyrics[Math.floor(Math.random() * length)] + const hitokoto = document.createElement('div') + hitokoto.style.marginTop = '3px' + hitokoto.textContent = lyrics[Math.floor(Math.random() * length)] -const container = document.querySelector('.breadcrumb') -if (container) { - container.appendChild(hitokoto) -} else { - const container = document.createElement('div') - container.className = 'breadcrumb' - container.appendChild(hitokoto) - document.querySelector('.content-header')?.appendChild(container) + const container = document.querySelector('.breadcrumb') + if (container) { + container.appendChild(hitokoto) + } else { + const container = document.createElement('div') + container.className = 'breadcrumb' + container.appendChild(hitokoto) + document.querySelector('.content-header')?.appendChild(container) + } } - -export default undefined