更多操作
小无编辑摘要 |
小无编辑摘要 |
||
第20行: | 第20行: | ||
<script> | <script> | ||
const songName = "Abgrund" | |||
const songName = "Abgrund" | |||
const difficultyColors = { | const difficultyColors = { | ||
第31行: | 第30行: | ||
function cycleDifficulty(element) { | function cycleDifficulty(element) { | ||
const states = JSON.parse(element.getAttribute('data-states')) | const states = JSON.parse(element.getAttribute('data-states')) | ||
const current = parseInt(element.getAttribute('data-current')) | const current = parseInt(element.getAttribute('data-current')) | ||
const next = (current + 1) % states.length | const next = (current + 1) % states.length | ||
element.textContent = states[next] | element.textContent = states[next] | ||
element.setAttribute('data-current', next.toString()) | element.setAttribute('data-current', next.toString()) | ||
const difficultyType = states[next].split(' ')[0] | const difficultyType = states[next].split(' ')[0] // 获取难度 | ||
const color = difficultyColors[difficultyType] || '#FFFFFF' | const color = difficultyColors[difficultyType] || '#FFFFFF' // 更新背景色 | ||
element.style.backgroundColor = color | element.style.backgroundColor = color | ||
element.parentElement.style.backgroundColor = color | element.parentElement.style.backgroundColor = color | ||
updateOutput() | updateOutput() | ||
} | } | ||
function cycleRatio(element) { | function cycleRatio(element) { | ||
const states = JSON.parse(element.getAttribute('data-states')) | const states = JSON.parse(element.getAttribute('data-states')) | ||
const current = parseInt(element.getAttribute('data-current')) | const current = parseInt(element.getAttribute('data-current')) | ||
const next = (current + 1) % states.length | const next = (current + 1) % states.length | ||
element.textContent = states[next] | element.textContent = states[next] | ||
element.setAttribute('data-current', next.toString()) | element.setAttribute('data-current', next.toString()) | ||
updateOutput() | updateOutput() | ||
} | } | ||
function updateOutput() { | function updateOutput() { | ||
const difficultyDiv = document.getElementById('difficulty') | const difficultyDiv = document.getElementById('difficulty') | ||
const ratioDiv = document.getElementById('ratio') | const ratioDiv = document.getElementById('ratio') | ||
const | const difficulty = difficultyDiv.textContent.split(' ')[0] // 获取难度 | ||
const | const ratio = ratioDiv.textContent.replace(':', '-') | ||
const videoUrl = `https://raw.githubusercontent.com/Rizline-Chinese-Wiki/rizline-song-preview/main/${ | const videoUrl = `https://raw.githubusercontent.com/Rizline-Chinese-Wiki/rizline-song-preview/main/${ratio}_${songName}_${difficulty}.mp4` | ||
document.getElementById('output').innerHTML = ` | document.getElementById('output').innerHTML = ` | ||
<video class="html5media-video" src="${videoUrl}" controls preload="metadata" loading="lazy"></video> | <video class="html5media-video" src="${videoUrl}" controls preload="metadata" loading="lazy"></video> | ||
` | ` | ||
} | } | ||
document.addEventListener('DOMContentLoaded', updateOutput) | document.addEventListener('DOMContentLoaded', updateOutput) | ||
</script> | </script> | ||
</html> | </html> |
2025年7月6日 (日) 23:26的版本
EZ 1
|
|
16:9
|