chen 2021-11-24 16:48:54 +08:00
commit 3172d35877
2 changed files with 13 additions and 10 deletions

View File

@ -25,7 +25,7 @@
</div>
<!--音乐-->
<audio id="music" data-song="顶级 Slow 气派炸街5.0.mp3" controls autoplay loop style="z-index: 999; position: fixed;display: none;">
<source src="http://bili.scdxtc.cn/music/顶级 Slow 气派炸街5.0.mp3" type="audio/mp3">
<source src="https://bili.scdxtc.cn/music/顶级 Slow 气派炸街5.0.mp3" type="audio/mp3">
</audio>
<!--点击播放音乐-->
<script>

View File

@ -48,15 +48,15 @@ function getFirstEventKeyword(name) {
// 设置领舞 name=姓名 time=有效期 单位秒
function setLeader(name, time) {
localStorage.setItem('leader', name)
localStorage.setItem('leader_end_at', (new Date).getTime()/1000 + time)
sessionStorage.setItem('leader', name)
sessionStorage.setItem('leader_end_at', (new Date).getTime()/1000 + time)
}
// 获取领舞人信息
function getLeader() {
let res = []
res['name'] = localStorage.getItem('leader') ? localStorage.getItem('leader') : ''
res['time'] = localStorage.getItem('leader_end_at') ? localStorage.getItem('leader_end_at') : 0
res['name'] = sessionStorage.getItem('leader') ? sessionStorage.getItem('leader') : ''
res['time'] = sessionStorage.getItem('leader_end_at') ? sessionStorage.getItem('leader_end_at') : 0
return res
}
@ -93,7 +93,7 @@ function dancer(val){
// 接受消息处理
function receiveMessage(event)
{
// console.log(event.data, 'event test')
console.log(event.data, '接受信息')
// 我们能信任信息来源吗?
if (event.origin !== "https://live.bilibili.com") {
return false
@ -158,7 +158,7 @@ function receiveMessage(event)
let random2 = Math.floor(Math.random() + 0.5)
// 获取领舞信息
let leaderInfo = localStorage.getItem('leader')
let leaderInfo = sessionStorage.getItem('leader')
let isLeader = data.uname == leaderInfo ? 1 : 0
// 给弹幕加上随机事件
@ -230,9 +230,12 @@ function receiveMessage(event)
}
// 领舞喊一起喊
// leader.text.slice(0,3);
if (leader.text.length >= 4) {
if(leader.text.slice(0,4)=="一起喊:" || leader.text.slice(0,4)=="一起喊:"){
allSay(leader.text.slice(4));
}
}
// 领舞自己喊跳舞
if(peopleHan(dm.text)){
clearInterval(dancerTimer);