Back to scripts

game

2024-03-21v1.0.0Community

Usage

Steps

  1. 進入答題界面
  2. 運行腳本
  3. 正確答案會被高亮顯示

Notes

  • 僅在答題模式下有效
  • 高亮效果可能因遊戲更新而失效
  • 建議謹慎使用此功能

Requirements

  • 必須在答題界面使用
  • 需要最新版本的瀏覽器

Code

function highlightAnswers() {
  const gameFrame = document.querySelector('#gameFrame');
  if (!gameFrame) {
    alert('Game frame not found!');
    return;
  }

  const style = document.createElement('style');
  style.textContent = `
    .correct-answer {
      border: 3px solid #4CAF50 !important;
      animation: pulse 2s infinite;
    }
    @keyframes pulse {
      0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
      70% { box-shadow: 0 0 0 10px rgba(76, 175, 80, 0); }
      100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
    }
  `;
  document.head.appendChild(style);

  setInterval(() => {
    const answers = gameFrame.contentWindow.document.querySelectorAll('.styles__answerContainer___3WuiW-camelCase');
    answers.forEach(answer => {
      if (answer.getAttribute('data-correct') === 'true') {
        answer.classList.add('correct-answer');
      }
    });
  }, 100);
}

highlightAnswers();

Changelog

Version 1.0.0

2024-03-21
  • 初始版本發布
  • 實現答案高亮功能
  • 添加視覺提示效果