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

用户:Xp00000000/Sandbox:修订间差异

来自Rizline中文维基
Xp00000000留言 | 贡献
无编辑摘要
Xp00000000留言 | 贡献
无编辑摘要
 
(未显示同一用户的18个中间版本)
第1行: 第1行:
<html>
<html>
<style>
<script>
.normal-style {
// 切换难度(EZ 1 / HD 6 / IN 9)
    -webkit-tap-highlight-color: transparent; /* 移除点击高亮 */
function cycleDifficulty(element) {
  const states = JSON.parse(element.dataset.states);
  const currentIndex = parseInt(element.dataset.current);
  const nextIndex = (currentIndex + 1) % states.length;
 
  element.textContent = states[nextIndex];
  element.dataset.current = nextIndex;
 
  updateOutput(); // 更新输出
}
 
// 切换比例(4:3 / 16:9)
function cycleRatio(element) {
  const states = JSON.parse(element.dataset.states);
  const currentIndex = parseInt(element.dataset.current);
  const nextIndex = (currentIndex + 1) % states.length;
 
  element.textContent = states[nextIndex];
  element.dataset.current = nextIndex;
 
  updateOutput(); // 更新输出
}
}
</style>


<script>
// 根据当前难度和比例更新输出
function toggleColor(element) {
function updateOutput() {
    element.classList.toggle("clicked-style");
  const difficulty = document.getElementById("difficulty").textContent;
    // 更新文本内容
  const ratio = document.getElementById("ratio").textContent;
     element.textContent = element.classList.contains("clicked-style")
 
        ? "HD 10"  
  // 定义输出规则
        : "IN 14";
  const outputRules = {
    // 存储状态
     "EZ 1": { "4:3": "111aaa", "16:9": "222aaa" },
    localStorage.setItem('boxState', element.classList.contains("clicked-style"));
    "HD 6": { "4:3": "111bbb", "16:9": "222bbb" },
    "IN 9": { "4:3": "111ccc", "16:9": "222ccc" }
  };
 
  // 获取当前输出
  const output = outputRules[difficulty]?.[ratio] || "Unknown";
  document.getElementById("output").textContent = output;
}
}
// 页面加载时恢复状态和文本
window.onload = function() {
    var box = document.getElementById('myInteractiveBox');
    if(box) {
        var isClicked = localStorage.getItem('boxState') === 'true';
        box.classList.toggle("clicked-style", isClicked);
        box.textContent = isClicked
            ? "HD 10"
            : "IN 14";
    }
};
</script>
</script>
<table width="100%" style="border:none; border-collapse:collapse;">
  <tr>
    <td colspan="2" style="text-align:center; background-color:#A9FBFF;"><div id="difficulty" onclick="cycleDifficulty(this)"
    data-states='["EZ 1", "HD 6", "IN 9"]' data-current="0" style="cursor:pointer;">
  EZ 1
</div></td>
  </tr>
  <tr>
    <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></td>
    <td><span id="output">111aaa</span></td>
  </tr>
</table>
</html>
</html>
<div id="myInteractiveBox" class="normal-style" onclick="toggleColor(this)">IN 14</div>

2025年7月5日 (六) 10:45的最新版本

EZ 1
4:3
111aaa