{"id":195,"date":"2025-04-16T14:08:27","date_gmt":"2025-04-16T12:08:27","guid":{"rendered":"https:\/\/almohajerin.at\/?page_id=195"},"modified":"2025-04-19T03:35:20","modified_gmt":"2025-04-19T01:35:20","slug":"195-2","status":"publish","type":"page","link":"https:\/\/almohajerin.at\/fa\/195-2\/","title":{"rendered":"\u0634\u0646\u0627\u062e\u062a \u067e\u06cc\u0627\u0645\u0628\u0631\u0627\u0646"},"content":{"rendered":"\n<div class=\"quiz-box\">\n  <h2 id=\"question\">Lade Frage&#8230;<\/h2>\n  <div id=\"answers\"><\/div>\n  <p id=\"result\"><\/p>\n  <div id=\"explanation-container\"><\/div> <!-- Platz f\u00fcr die KI-Erkl\u00e4rung -->\n  <button onclick=\"nextQuestion()\">N\u00e4chste Frage<\/button>\n<\/div>\n\n<script>\n  const questions = [\n    {\n      question: \"Ich wurde in einem Korb auf dem Nil ausgesetzt. Wer bin ich?\",\n      answers: [\"Musa (Moses)\", \"Isa (Jesus)\", \"Muhammad\", \"Nuh (Noah)\"],\n      correct: 0\n    },\n    {\n      question: \"Ich bin der letzte Prophet im Islam. Wer bin ich?\",\n      answers: [\"Ibrahim\", \"Isa\", \"Muhammad\", \"Yusuf\"],\n      correct: 2\n    },\n    {\n      question: \"Ich baute ein Schiff, weil eine gro\u00dfe Flut kam. Wer bin ich?\",\n      answers: [\"Nuh\", \"Musa\", \"Isa\", \"Idris\"],\n      correct: 0\n    }\n  ];\n\n  let currentQuestion = 0;\n\n  function showQuestion() {\n    const q = questions[currentQuestion];\n    document.getElementById(\"question\").textContent = q.question;\n    const answersDiv = document.getElementById(\"answers\");\n    answersDiv.innerHTML = \"\";\n    document.getElementById(\"result\").textContent = \"\";\n    document.getElementById(\"explanation-container\").innerHTML = \"\"; \/\/ Leeren des Erkl\u00e4rungsbereichs\n\n    q.answers.forEach((ans, i) => {\n      const btn = document.createElement(\"button\");\n      btn.textContent = ans;\n      btn.onclick = () => checkAnswer(i);\n      answersDiv.appendChild(btn);\n    });\n  }\n\n  async function checkAnswer(index) {\n    const q = questions[currentQuestion];\n    const result = document.getElementById(\"result\");\n    if (index === q.correct) {\n      result.textContent = \"\u2705 Richtig!\";\n    } else {\n      result.textContent = \"\u274c Falsch! Richtige Antwort: \" + q.answers[q.correct];\n    }\n\n    \/\/ KI-Erkl\u00e4rung holen und anzeigen\n    const explanation = await getExplanation(q.question, q.answers[q.correct]);\n    const explanationDiv = document.getElementById(\"explanation-container\");\n    const p = document.createElement(\"p\");\n    p.textContent = \"\ud83d\udcd8 Erkl\u00e4rung: \" + explanation;\n    explanationDiv.appendChild(p);\n  }\n\n  async function getExplanation(question, answer) {\n    const response = await fetch(\"\/wp-content\/themes\/twentyseventeen\/gpt.php\", {\n      method: \"POST\",\n      headers: {\n        \"Content-Type\": \"application\/json\"\n      },\n      body: JSON.stringify({ question, answer })\n    });\n\n    const data = await response.json();\n    return data.choices[0].message.content.trim();\n  }\n\n  function nextQuestion() {\n    currentQuestion = (currentQuestion + 1) % questions.length;\n    showQuestion();\n  }\n\n  showQuestion();\n<\/script>\n\n<style>\n  .quiz-box {\n    background: white;\n    border-radius: 10px;\n    padding: 20px;\n    max-width: 500px;\n    margin: auto;\n    box-shadow: 0 0 10px rgba(0,0,0,0.2);\n  }\n  button {\n    margin-top: 10px;\n    padding: 10px;\n    width: 100%;\n    border: none;\n    border-radius: 5px;\n    background-color: #4CAF50;\n    color: white;\n    font-size: 16px;\n    cursor: pointer;\n  }\n  button:hover {\n    background-color: #45a049;\n  }\n  #explanation-container {\n    margin-top: 20px;\n    font-style: italic;\n    color: #333;\n  }\n<\/style>\n\n","protected":false},"excerpt":{"rendered":"<p>Lade Frage&#8230; N\u00e4chste Frage<\/p>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-195","page","type-page","status-publish","hentry"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/almohajerin.at\/fa\/wp-json\/wp\/v2\/pages\/195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/almohajerin.at\/fa\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/almohajerin.at\/fa\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/almohajerin.at\/fa\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/almohajerin.at\/fa\/wp-json\/wp\/v2\/comments?post=195"}],"version-history":[{"count":10,"href":"https:\/\/almohajerin.at\/fa\/wp-json\/wp\/v2\/pages\/195\/revisions"}],"predecessor-version":[{"id":236,"href":"https:\/\/almohajerin.at\/fa\/wp-json\/wp\/v2\/pages\/195\/revisions\/236"}],"wp:attachment":[{"href":"https:\/\/almohajerin.at\/fa\/wp-json\/wp\/v2\/media?parent=195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}