From a5784f53aec302417c54afc8be74101971067507 Mon Sep 17 00:00:00 2001 From: Hiraku Date: Mon, 1 Jun 2020 15:20:23 +0800 Subject: [PATCH] Update function and var names --- public/main.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/public/main.js b/public/main.js index d0f4e7a..4bd1d4f 100644 --- a/public/main.js +++ b/public/main.js @@ -4,22 +4,22 @@ hirakujira: { name: 'Hiraku', avatar: 'bf73e08d8bc1db95b62f02d50f8a03e9' }, Shawn_N: { name: '$踢低吸 舞勺之年', avatar: '34624582cd585ba65e5b5368c84cb1a2' } } - const hiraku = await fetch('public/saying.txt') - const saying = await hiraku.text() - const hirakuSaying = saying.split(';').slice(0, -1).map(x => x.trim()) + const file = await fetch('public/saying.txt') + const text = await file.text() + const saying = text.split(';').slice(0, -1).map(x => x.trim()) new Vue({ // eslint-disable-line no-new el: '#app', data: { - hiraku: hirakuSaying, + saying: saying, uname: '', name: '', avatar: 'https://www.gravatar.com/avatar/00000000000000000000000000000000', message: '' }, methods: { - updateHiraku () { - const idx = Math.floor(Math.random() * this.hiraku.length) - const saying = this.hiraku[idx].split(',') + updateSaying () { + const idx = Math.floor(Math.random() * this.saying.length) + const saying = this.saying[idx].split(',') this.uname = saying[0] this.name = gravatar[this.uname].name this.avatar = `https://www.gravatar.com/avatar/${gravatar[this.uname].avatar}` @@ -28,7 +28,7 @@ }, created () { (function f () { - this.updateHiraku() + this.updateSaying() return setTimeout(f.bind(this), 5000) }).bind(this)() }