{"id":31,"date":"2025-08-03T20:55:52","date_gmt":"2025-08-03T11:55:52","guid":{"rendered":"https:\/\/tetsudozyoho.com\/station-list\/?page_id=31"},"modified":"2025-08-03T21:19:27","modified_gmt":"2025-08-03T12:19:27","slug":"aa","status":"publish","type":"page","link":"https:\/\/tetsudozyoho.com\/station-list\/?page_id=31","title":{"rendered":"aa"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"ja\">\n<head>\n  <meta charset=\"UTF-8\">\n  <title>Advanced Spreadsheet<\/title>\n  <style>\n    body { font-family: sans-serif; }\n    table {\n      border-collapse: collapse;\n      table-layout: fixed;\n      width: 100%;\n    }\n    th, td {\n      border: 1px solid #ccc;\n      min-width: 80px;\n      height: 30px;\n      text-align: left;\n      padding: 2px;\n    }\n    input {\n      width: 100%;\n      height: 100%;\n      border: none;\n      padding: 4px;\n      box-sizing: border-box;\n      font-family: monospace;\n    }\n    input:focus {\n      background: #f0f8ff;\n      outline: none;\n    }\n    .toolbar {\n      margin-bottom: 10px;\n    }\n    .toolbar button {\n      margin-right: 5px;\n    }\n  <\/style>\n<\/head>\n<body>\n  <h2>\ud83d\udcca Advanced Spreadsheet<\/h2>\n\n  <div class=\"toolbar\">\n    <button onclick=\"saveData()\">\ud83d\udcbe \u4fdd\u5b58<\/button>\n    <button onclick=\"loadData()\">\ud83d\udcc2 \u5fa9\u5143<\/button>\n    <button onclick=\"clearData()\">\ud83d\uddd1\ufe0f \u521d\u671f\u5316<\/button>\n  <\/div>\n\n  <table id=\"sheet\"><\/table>\n\n  <script>\n    const rows = 20;\n    const cols = 10;\n    const data = {}; \/\/ \u30bb\u30eb\u5185\u5bb9\n    const values = {}; \/\/ \u8a08\u7b97\u5f8c\u306e\u5024\n\n    const sheet = document.getElementById(\"sheet\");\n\n    \/\/ \u30d8\u30c3\u30c0\u30fc\u884c\u4f5c\u6210\n    const headerRow = document.createElement(\"tr\");\n    headerRow.appendChild(document.createElement(\"th\"));\n    for (let c = 0; c < cols; c++) {\n      const th = document.createElement(\"th\");\n      th.textContent = String.fromCharCode(65 + c);\n      headerRow.appendChild(th);\n    }\n    sheet.appendChild(headerRow);\n\n    \/\/ \u884c\u3068\u30bb\u30eb\u4f5c\u6210\n    for (let r = 1; r <= rows; r++) {\n      const tr = document.createElement(\"tr\");\n      const th = document.createElement(\"th\");\n      th.textContent = r;\n      tr.appendChild(th);\n\n      for (let c = 0; c < cols; c++) {\n        const td = document.createElement(\"td\");\n        const input = document.createElement(\"input\");\n\n        const cellId = `${String.fromCharCode(65 + c)}${r}`;\n        input.dataset.cell = cellId;\n\n        input.addEventListener(\"input\", (e) => {\n          data[cellId] = input.value;\n          updateAll(); \/\/ \u5168\u30bb\u30eb\u518d\u8a08\u7b97\n        });\n\n        td.appendChild(input);\n        tr.appendChild(td);\n      }\n\n      sheet.appendChild(tr);\n    }\n\n    \/\/ \u6570\u5f0f\u8a55\u4fa1\u95a2\u6570\n    function evaluate(cellId, visited = new Set()) {\n      if (visited.has(cellId)) return \"#CIRC\";\n      visited.add(cellId);\n\n      const content = data[cellId] || \"\";\n      if (!content.startsWith(\"=\")) return content;\n\n      try {\n        const expr = content.slice(1).replace(\/[A-Z][0-9]+\/g, (ref) => {\n          return evaluate(ref, visited) || \"0\";\n        });\n        const result = eval(expr);\n        return result;\n      } catch (e) {\n        return \"#ERR\";\n      }\n    }\n\n    function updateAll() {\n      for (let r = 1; r <= rows; r++) {\n        for (let c = 0; c < cols; c++) {\n          const cellId = `${String.fromCharCode(65 + c)}${r}`;\n          const input = getInput(cellId);\n          const content = data[cellId] || \"\";\n          const result = evaluate(cellId);\n\n          values[cellId] = result;\n          if (content.startsWith(\"=\")) {\n            input.value = result;\n          } else {\n            input.value = content;\n          }\n        }\n      }\n    }\n\n    function getInput(cellId) {\n      return document.querySelector(`input[data-cell='${cellId}']`);\n    }\n\n    \/\/ \u4fdd\u5b58\u6a5f\u80fd\uff08\u30ed\u30fc\u30ab\u30eb\u30b9\u30c8\u30ec\u30fc\u30b8\uff09\n    function saveData() {\n      localStorage.setItem(\"spreadsheet-data\", JSON.stringify(data));\n      alert(\"\u4fdd\u5b58\u3057\u307e\u3057\u305f\uff01\");\n    }\n\n    function loadData() {\n      const saved = localStorage.getItem(\"spreadsheet-data\");\n      if (saved) {\n        const parsed = JSON.parse(saved);\n        Object.assign(data, parsed);\n        updateAll();\n        alert(\"\u5fa9\u5143\u3057\u307e\u3057\u305f\uff01\");\n      } else {\n        alert(\"\u4fdd\u5b58\u3055\u308c\u305f\u30c7\u30fc\u30bf\u304c\u3042\u308a\u307e\u305b\u3093\u3002\");\n      }\n    }\n\n    function clearData() {\n      if (confirm(\"\u3059\u3079\u3066\u521d\u671f\u5316\u3057\u307e\u3059\u304b\uff1f\")) {\n        for (const key in data) delete data[key];\n        updateAll();\n      }\n    }\n\n    \/\/ \u521d\u671f\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\n    updateAll();\n  <\/script>\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Advanced Spreadsheet \ud83d\udcca Advanced Spreadsheet \ud83d\udcbe \u4fdd\u5b58 \ud83d\udcc2 \u5fa9\u5143 \ud83d\uddd1\ufe0f \u521d\u671f\u5316<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-31","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/tetsudozyoho.com\/station-list\/index.php?rest_route=\/wp\/v2\/pages\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tetsudozyoho.com\/station-list\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tetsudozyoho.com\/station-list\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tetsudozyoho.com\/station-list\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tetsudozyoho.com\/station-list\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=31"}],"version-history":[{"count":2,"href":"https:\/\/tetsudozyoho.com\/station-list\/index.php?rest_route=\/wp\/v2\/pages\/31\/revisions"}],"predecessor-version":[{"id":33,"href":"https:\/\/tetsudozyoho.com\/station-list\/index.php?rest_route=\/wp\/v2\/pages\/31\/revisions\/33"}],"wp:attachment":[{"href":"https:\/\/tetsudozyoho.com\/station-list\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}