mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-08 19:50:10 +02:00
added reconect button
This commit is contained in:
@@ -79,6 +79,80 @@
|
||||
self.connection.send('')
|
||||
}, 1000)
|
||||
}, 2000)
|
||||
},
|
||||
reconnect: function () {
|
||||
this.connection.addEventListener('open', function (event) {
|
||||
this.connection.send('')
|
||||
})
|
||||
|
||||
this.connection.addEventListener('message', function (event) {
|
||||
res = event.data.split('-')
|
||||
console.log(res[1])
|
||||
if (res[0] != this.oldRes) {
|
||||
this.oldRes = res[0]
|
||||
if (res[1] == 'rocket') {
|
||||
document.getElementById('animations').style.width = '50%'
|
||||
document.getElementById('animations').src =
|
||||
'/copilot/static/rocket.gif'
|
||||
setTimeout(function () {
|
||||
document.getElementById('animations').src = ''
|
||||
}, 5000)
|
||||
}
|
||||
if (res[1] == 'face') {
|
||||
document.getElementById('animations').style.width = '50%'
|
||||
document.getElementById('animations').src =
|
||||
'/copilot/static/face.gif'
|
||||
setTimeout(function () {
|
||||
document.getElementById('animations').src = ''
|
||||
}, 5000)
|
||||
}
|
||||
if (res[1] == 'bitcoin') {
|
||||
document.getElementById('animations').style.width = '30%'
|
||||
document.getElementById('animations').src =
|
||||
'/copilot/static/bitcoin.gif'
|
||||
setTimeout(function () {
|
||||
document.getElementById('animations').src = ''
|
||||
}, 5000)
|
||||
}
|
||||
if (res[1] == 'confetti') {
|
||||
document.getElementById('animations').style.width = '100%'
|
||||
document.getElementById('animations').src =
|
||||
'/copilot/static/confetti.gif'
|
||||
setTimeout(function () {
|
||||
document.getElementById('animations').src = ''
|
||||
}, 5000)
|
||||
}
|
||||
if (res[1] == 'martijn') {
|
||||
document.getElementById('animations').style.width = '50%'
|
||||
document.getElementById('animations').src =
|
||||
'/copilot/static/martijn.gif'
|
||||
setTimeout(function () {
|
||||
document.getElementById('animations').src = ''
|
||||
}, 5000)
|
||||
}
|
||||
if (res[1] == 'rick') {
|
||||
document.getElementById('animations').style.width = '50%'
|
||||
document.getElementById('animations').src =
|
||||
'/copilot/static/rick.gif'
|
||||
setTimeout(function () {
|
||||
document.getElementById('animations').src = ''
|
||||
}, 5000)
|
||||
}
|
||||
if (res[1] == 'true') {
|
||||
document.getElementById('videoElement').style.width = '20%'
|
||||
}
|
||||
if (res[1] == 'false') {
|
||||
document.getElementById('videoElement').style.width = '100%'
|
||||
}
|
||||
if (res[1].substring(0, 3) == 'htt') {
|
||||
document.getElementById('iframe_main').src = res[1]
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
this.connection.addEventListener('close', function (event) {
|
||||
console.log('The connection has been closed')
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
Reference in New Issue
Block a user