打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

用户:RedDragon/Test:修订间差异

来自Rizline中文维基
RedDragon留言 | 贡献
已移除至用户:RedDragon/Test1的重定向
标签移除重定向
RedDragon留言 | 贡献
无编辑摘要
 
(未显示同一用户的5个中间版本)
第3行: 第3行:
<table width="100%" style="border:none; border-collapse:collapse;">
<table width="100%" style="border:none; border-collapse:collapse;">
   <tr>
   <tr>
     <td colspan="2" style="text-align:center; background-color:#A9FBFF;">
     <td colspan="2" style="text-align:center; background-color:#57E4C4;">
       <div id="difficulty" onclick="cycleDifficulty(this)" data-states='["EZ 1", "HD 6", "IN 9"]' data-current="0" style="cursor:pointer;">EZ 1</div>
       <div id="difficulty" onclick="cycleDifficulty(this)" data-states='["EZ 2", "HD 7", "IN 10"]' data-current="0"
        style="cursor:pointer;">EZ 1</div>
     </td>
     </td>
   </tr>
   </tr>
   <tr>
   <tr>
     <td width="15%" height="300px" style="text-align:center; background-color:#ABCDEF;">
     <td width="15%" height="300px" style="text-align:center; background-color:#ABCDEF;">
       <div id="ratio" onclick="cycleRatio(this)" data-states='["4:3", "16:9"]' data-current="0" style="cursor:pointer;">4:3</div>
       <div id="ratio" onclick="cycleRatio(this)" data-states='["16:9", "4:3"]' data-current="0" style="cursor:pointer;">16:9</div>
     </td>
     </td>
     <td>
     <td>
第18行: 第19行:


<script>
<script>
    //自定义部分
   const songName = "Abgrund"
  const difficultyList = ["EZ 1", "HD 6", "IN 9"];
   const songName = "Abgrund";


   const difficultyColors = {
   const difficultyColors = {
第30行: 第29行:


   function cycleDifficulty(element) {
   function cycleDifficulty(element) {
     const states = difficultyList
     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
第38行: 第37行:


     const difficultyType = states[next].split(' ')[0]  // 获取难度
     const difficultyType = states[next].split(' ')[0]  // 获取难度
     const color = difficultyColors[difficultyType] || '#A9FBFF'  // 更新背景色
     const color = difficultyColors[difficultyType] || '#FFFFFF'  // 更新背景色
     element.style.backgroundColor = color
     element.style.backgroundColor = color
     element.parentElement.style.backgroundColor = color
     element.parentElement.style.backgroundColor = color
第46行: 第45行:


   function cycleRatio(element) {
   function cycleRatio(element) {
     const states = ["16:9", "4:3"]
     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
第60行: 第59行:
     const ratioDiv = document.getElementById('ratio')
     const ratioDiv = document.getElementById('ratio')


     const currentDifficulty = difficultyDiv.textContent.split(' ')[0]  // 获取难度
     const difficulty = difficultyDiv.textContent.split(' ')[0]  // 获取难度
     const currentRatio = ratioDiv.textContent === "16:9" ? "16-9" : "4-3"
     const ratio = ratioDiv.textContent.replace(':', '-')


     const videoUrl = `https://github.com/Rizline-Chinese-Wiki/rizline-song-preview/blob/main/${currentRatio}/${songName}_${currentDifficulty}.mp4`
     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', function () {
      const diffDiv = document.getElementById('difficulty')
      const firstDiff = JSON.parse(diffDiv.getAttribute('data-states'))[0];
      const diffType = firstDiff.split(' ')[0]
     
      diffDiv.textContent = firstDiff
      diffDiv.style.backgroundColor = difficultyColors[diffType]
      diffDiv.parentElement.style.backgroundColor = difficultyColors[diffType]
     
      updateOutput();
  });
</script>
</script>


</html>
</html>

2025年7月6日 (日) 23:34的最新版本

EZ 1
16:9