加入 git 地址

This commit is contained in:
satori 2024-09-04 20:15:57 +08:00
parent c3c0a37a41
commit b72be4e004
2 changed files with 38 additions and 8 deletions

View File

@ -97,6 +97,23 @@ const musicList = new MusicList({
}))
}
},
onsetlrc(item) {
const input = document.createElement('input')
input.type = 'file'
input.accept = '.lrc'
input.onchange = function () {
const file = this.files[0]
const reader = new FileReader()
reader.onload = function (e) {
const lrc = e.target.result
console.log(lrc)
console.log(item)
idb.set(item.id, { lrc, ...item }, musicStore)
}
reader.readAsText(file)
}
input.click()
},
onban: item => {
//console.info('禁止音乐', item.name)
},
@ -360,3 +377,16 @@ if (localStorage.getItem('avatar')) {
if (localStorage.getItem('username')) {
document.title = localStorage.getItem('username')
}
// 链接 GIT 仓库
const git = document.createElement('a')
git.href = 'https://git.satori.love/laniakeaSupercluster/webrtc'
git.textContent = 'Git'
git.target = '_blank'
git.style.position = 'absolute'
git.style.bottom = 0
git.style.right = 0
git.style.padding = '.5rem'
git.style.textDecoration = 'none'
git.style.color = '#555'
document.body.appendChild(git)

View File

@ -1,8 +1,8 @@
import { Img, Span, Button, List, ListItem, UploadMusic, createElement } from './weigets.js'
export default class MusicList {
constructor({ list = [], EventListeners = {}, onplay, onstop, onadd, onremove, onlike, onunlike, onban, onload }) {
this.event = { onplay, onstop, onadd, onremove, onlike, onunlike, onban, onload }
constructor({ list = [], EventListeners = {}, onsetlrc, onplay, onstop, onadd, onremove, onlike, onunlike, onban, onload }) {
this.event = { onsetlrc, onplay, onstop, onadd, onremove, onlike, onunlike, onban, onload }
// 添加音乐播放器
this.audio = new Audio()
@ -16,12 +16,6 @@ export default class MusicList {
this.audio.addEventListener('ended', () => {
this.next()
})
//this.audio.addEventListener('timeupdate', () => {
// console.log(this.audio.currentTime)
//})
//this.audio.addEventListener('error', event => {
// console.error('音乐播放器错误:', event)
//})
this.ul = List({
classList: ['music-list'],
style: {
@ -324,6 +318,12 @@ export default class MusicList {
this.like(item)
}
}
}),
Button({
textContent:'lrc',
onclick: () => {
this.event.onsetlrc?.(item)
}
})
]
}))