Skip to content

Commit

Permalink
Update function and var names
Browse files Browse the repository at this point in the history
  • Loading branch information
hirakujira committed Jun 1, 2020
1 parent 2e11990 commit a5784f5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
Expand All @@ -28,7 +28,7 @@
},
created () {
(function f () {
this.updateHiraku()
this.updateSaying()
return setTimeout(f.bind(this), 5000)
}).bind(this)()
}
Expand Down

0 comments on commit a5784f5

Please sign in to comment.