{"id":68,"date":"2025-11-04T15:29:26","date_gmt":"2025-11-04T07:29:26","guid":{"rendered":"https:\/\/aexdi.top\/?p=68"},"modified":"2025-11-04T15:34:39","modified_gmt":"2025-11-04T07:34:39","slug":"%e6%b5%8b%e8%af%95","status":"publish","type":"post","link":"https:\/\/aexdi.top\/index.php\/2025\/11\/04\/%e6%b5%8b%e8%af%95\/","title":{"rendered":"\u6d4b\u8bd5"},"content":{"rendered":"\n\n<div class=\"mole-game-wrapper\" style=\"max-width: 800px; margin: 2rem auto; padding: 20px; background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); text-align: center;\">\n  <h3 style=\"color: #333;\">\ud83c\udfae \u6765\u6311\u6218\u5427\uff01\u80fd\u70b9\u5230\u6211\u7b97\u4f60\u8d62 \ud83d\udc47<\/h3>\n\n  <!-- \u6e38\u620f\u533a\u57df -->\n  <div id=\"game-area\" style=\"width: 100%; height: 400px; border: 3px solid #FFD700; border-radius: 10px; position: relative; background: #f0f8ff; overflow: hidden; margin: 20px 0;\">\n    <!-- \u5c0f\u602a\u517d\u5c06\u5728\u8fd9\u91cc\u751f\u6210 -->\n  <\/div>\n\n  <!-- \u8ba1\u5206\u677f -->\n  <p style=\"font-size: 18px; color: #333;\">\n    \u5f97\u5206: <strong><span id=\"score\">0<\/span><\/strong> | \n    \u5012\u8ba1\u65f6: <strong><span id=\"timer\">30<\/span><\/strong> \u79d2\n  <\/p>\n<\/div>\n\n<!-- \u6e38\u620f\u903b\u8f91\u811a\u672c -->\n<script type=\"text\/javascript\">\n  console.log(\"\u3010\u6e38\u620f\u811a\u672c\u5df2\u52a0\u8f7d\u3011\");\n\n  \/\/ \u7b49\u5f85 DOM \u52a0\u8f7d\u5b8c\u6210\n  document.addEventListener('DOMContentLoaded', function () {\n    const gameArea = document.getElementById('game-area');\n    const scoreElement = document.getElementById('score');\n    const timerElement = document.getElementById('timer');\n\n    if (!gameArea || !scoreElement || !timerElement) {\n      console.error(\"\u3010\u6e38\u620f\u5143\u7d20\u672a\u627e\u5230\u3011\u8bf7\u68c0\u67e5 ID \u662f\u5426\u6b63\u786e\");\n      return;\n    }\n\n    let score = 0;\n    let timeLeft = 30;\n    let gameActive = true;\n\n    \/\/ \u521b\u5efa\u5c0f\u602a\u517d\n    const mole = document.createElement('div');\n    mole.textContent = '\ud83d\udc7e';\n    mole.style.position = 'absolute';\n    mole.style.width = '60px';\n    mole.style.height = '60px';\n    mole.style.fontSize = '60px';\n    mole.style.cursor = 'pointer';\n    mole.style.userSelect = 'none';\n    mole.style.zIndex = '10';\n    mole.style.transition = 'left 0.2s ease-out, top 0.2s ease-out';\n\n    \/\/ \u6dfb\u52a0\u5230\u6e38\u620f\u533a\u57df\n    gameArea.appendChild(mole);\n\n    \/\/ \u968f\u673a\u4f4d\u7f6e\u51fd\u6570\n    function randomPosition() {\n      const maxX = gameArea.clientWidth - 60;\n      const maxY = gameArea.clientHeight - 60;\n      const x = Math.max(10, Math.floor(Math.random() * (maxX - 20)));\n      const y = Math.max(10, Math.floor(Math.random() * (maxY - 20)));\n\n      mole.style.left = x + 'px';\n      mole.style.top = y + 'px';\n    }\n\n    \/\/ \u521d\u59cb\u4f4d\u7f6e\n    randomPosition();\n\n    \/\/ \u9f20\u6807\u79fb\u52a8\u68c0\u6d4b\u8ddd\u79bb\n    function distanceToMole(mouseX, mouseY) {\n      const rect = mole.getBoundingClientRect();\n      const cx = rect.left + 30;\n      const cy = rect.top + 30;\n      return Math.hypot(cx - mouseX, cy - mouseY);\n    }\n\n    \/\/ \u76d1\u542c\u9f20\u6807\u79fb\u52a8\uff08\u9003\u8dd1\u673a\u5236\uff09\n    gameArea.addEventListener('mousemove', (e) => {\n      if (!gameActive) return;\n      if (distanceToMole(e.clientX, e.clientY) < 90) {\n        randomPosition(); \/\/ \u76f4\u63a5\u95ea\u73b0\n        mole.textContent = ['\ud83d\ude0e','\ud83e\udd2a','\ud83d\ude02'][Math.floor(Math.random()*3)];\n        setTimeout(() => mole.textContent = '\ud83d\udc7e', 300);\n      }\n    });\n\n    \/\/ \u70b9\u51fb\u52a0\u5206\n    mole.addEventListener('click', (e) => {\n      e.stopPropagation();\n      if (!gameActive) return;\n      score++;\n      scoreElement.textContent = score;\n      randomPosition();\n    });\n\n    \/\/ \u5012\u8ba1\u65f6\n    const interval = setInterval(() => {\n      timeLeft--;\n      timerElement.textContent = timeLeft;\n      if (timeLeft <= 0) {\n        gameActive = false;\n        clearInterval(interval);\n        alert(`\ud83c\udf89 \u6e38\u620f\u7ed3\u675f\uff01\u4f60\u7684\u5f97\u5206\u662f\uff1a${score} \u5206\uff01`);\n      }\n    }, 1000);\n  });\n<\/script>\n\n\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83c\udfae \u6765\u6311\u6218\u5427\uff01\u80fd\u70b9\u5230\u6211\u7b97\u4f60\u8d62 \ud83d\udc47 \u5f97\u5206: 0 | \u5012\u8ba1\u65f6: 30 \u79d2<\/p>\n","protected":false},"author":1,"featured_media":49,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-68","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"jetpack_featured_media_url":"https:\/\/aexdi.top\/wp-content\/uploads\/2025\/10\/cropped-\u751f\u6210\u7f51\u7ad9ico\u56fe\u6807.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/aexdi.top\/index.php\/wp-json\/wp\/v2\/posts\/68","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aexdi.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aexdi.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aexdi.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aexdi.top\/index.php\/wp-json\/wp\/v2\/comments?post=68"}],"version-history":[{"count":3,"href":"https:\/\/aexdi.top\/index.php\/wp-json\/wp\/v2\/posts\/68\/revisions"}],"predecessor-version":[{"id":72,"href":"https:\/\/aexdi.top\/index.php\/wp-json\/wp\/v2\/posts\/68\/revisions\/72"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aexdi.top\/index.php\/wp-json\/wp\/v2\/media\/49"}],"wp:attachment":[{"href":"https:\/\/aexdi.top\/index.php\/wp-json\/wp\/v2\/media?parent=68"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aexdi.top\/index.php\/wp-json\/wp\/v2\/categories?post=68"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aexdi.top\/index.php\/wp-json\/wp\/v2\/tags?post=68"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}