|
<!DOCTYPE html> |
|
<html lang="ko"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|
<title>μ±μμ° μ±κ²© μ ν ν
μ€νΈ</title> |
|
<link rel="stylesheet" href="style.css"> |
|
</head> |
|
<body> |
|
<div class="container"> |
|
|
|
<div id="quiz-section"> |
|
<h1>μ±μμ° μ±κ²© μ ν ν
μ€νΈ</h1> |
|
<p>λ€μ μ§λ¬Έλ€μ λ΅ν΄μ£ΌμΈμ.</p> |
|
<div id="question-container"></div> |
|
<button id="next-button">λ€μ</button> |
|
</div> |
|
|
|
|
|
<div id="result-section" class="hidden"> |
|
<h1>MBTI κ²°κ³Ό</h1> |
|
<pre id="result-text"></pre> |
|
<img id="result-image" src="" alt="μ ν μ΄λ―Έμ§"> |
|
<button id="restart-button">λ€μ ν
μ€νΈνκΈ°</button> |
|
</div> |
|
</div> |
|
|
|
<script> |
|
|
|
const questions = [ |
|
"μμ°μ μ΄μνκ°μ??", |
|
"μμ°μ κ°μκΈ° μ¬νμ κ°λμ?", |
|
"μμ°μ μμ λ€μ λμκ°κ³ μΆλμ?", |
|
"λΉμ μ κ°μ 보λ€λ λ
Όλ¦¬μ λ μμ‘΄νλμ?", |
|
"λΉμ μ λ€λ₯Έ μ¬λμ λλ κ²μ μ’μνλμ?", |
|
"λΉμ μ μ¬κ΅μ μΈ μ±κ²©μ κ°μ§κ³ μλμ?", |
|
"λΉμ μ μΌμ λλ΄κΈ° μ μ κ³νμ μΈμ°λ νΈμΈκ°μ?", |
|
"λΉμ μ μ¬μ€κ³Ό λ°μ΄ν°λ₯Ό μ€μνλμ?", |
|
"λΉμ μ κ°μ ννμ μ νλμ?", |
|
"λΉμ μ λ¬Έμ λ₯Ό ν΄κ²°ν λ μ°½μμ μΈ λ°©λ²μ μ¬μ©νλμ?", |
|
"λΉμ μ λ€λ₯Έ μ¬λλ€κ³Όμ νμ
μ μ νΈνλμ?", |
|
"λΉμ μ κ²°μ μ λ΄λ¦΄ λ μ§κ°μ μ λ’°νλμ?", |
|
"λΉμ μ κ·μΉκ³Ό μ μ°¨λ₯Ό λ°λ₯΄λ κ²μ μ’μνλμ?", |
|
"λΉμ μ μ£Όλ³ νκ²½μ λ―Όκ°νκ² λ°μνλμ?", |
|
"λΉμ μ μΌμ μ²λ¦¬ν λ ν¨μ¨μ±μ μ€μνλμ?", |
|
"λΉμ μ λ¨λ€μ΄ μκ°νλ κ²μ λν΄ λ§μ΄ μ κ²½ μ°λμ?", |
|
"λΉμ μ μμ°μ€λ½κ² 리λ μν μ λ§‘κ² λλμ?", |
|
"λΉμ μ μλ‘μ΄ μμ΄λμ΄λ₯Ό μ μνλ κ²μ μ’μνλμ?", |
|
"λΉμ μ λμΈ κ΄κ³μμ κ°λ±μ νΌνλ € νλμ?", |
|
"λΉμ μ λͺ©νλ₯Ό μ€μ νκ³ μ΄λ₯Ό λ¬μ±νκΈ° μν΄ λ
Έλ ₯νλμ?" |
|
]; |
|
|
|
const mbti_types = { |
|
"INTJ": { |
|
"μ±κ²©": "λ
μ°½μ μ΄κ³ μ λ΅μ μΈ μ¬κ³ λ₯Ό κ°μ§ μ‘°μ©ν 리λ", |
|
"μ§μ
": "κ³Όνμ, μμ§λμ΄, λ°μ΄ν° λΆμκ°", |
|
"κΆν©": ["ENFP", "ENTP"], |
|
"λμ κΆν©": ["ESFP", "ESTP"], |
|
"κΆν© μ€λͺ
": { |
|
"ENFP": "ENFPλ INTJμ μ΄μμ£Όμλ₯Ό μκ·Ήνκ³ , μλ‘μ κ°μ κ³Ό μ½μ μ 보μν©λλ€.", |
|
"ENTP": "ENTPλ INTJμ μ°½μμ±κ³Ό μ λ΅μ μ¬κ³ λ₯Ό μκ·Ήνμ¬ μμ°μ μΈ ννΈλμμ νμ±ν©λλ€." |
|
}, |
|
"λμ κΆν© μ€λͺ
": { |
|
"ESFP": "ESFPλ INTJμ μ λ°λμ μ±ν₯μ κ°μ§κ³ μμ΄ κ°λ±μ΄ μ¦μ μ μμ΅λλ€.", |
|
"ESTP": "ESTPλ μ€μ©μ μΈ μ κ·Όμ μ νΈνλ λ°λ©΄, INTJλ μ₯κΈ°μ μΈ κ³νμ μ€μν©λλ€." |
|
} |
|
}, |
|
|
|
}; |
|
|
|
|
|
let responses = []; |
|
let currentQuestionIndex = 0; |
|
const questionsPerPage = 5; |
|
|
|
const questionContainer = document.getElementById('question-container'); |
|
const nextButton = document.getElementById('next-button'); |
|
const resultSection = document.getElementById('result-section'); |
|
const quizSection = document.getElementById('quiz-section'); |
|
const resultText = document.getElementById('result-text'); |
|
const resultImage = document.getElementById('result-image'); |
|
const restartButton = document.getElementById('restart-button'); |
|
|
|
|
|
const options = ["λ§€μ° κ·Έλ λ€", "κ·Έλ λ€", "보ν΅μ΄λ€", "μλλ€", "λ§€μ° μλλ€"]; |
|
|
|
function loadQuestions() { |
|
questionContainer.innerHTML = ''; |
|
const end = Math.min(currentQuestionIndex + questionsPerPage, questions.length); |
|
for(let i = currentQuestionIndex; i < end; i++) { |
|
const qDiv = document.createElement('div'); |
|
qDiv.className = 'question-block'; |
|
const qText = document.createElement('p'); |
|
qText.textContent = questions[i]; |
|
qDiv.appendChild(qText); |
|
|
|
options.forEach(option => { |
|
const label = document.createElement('label'); |
|
const radio = document.createElement('input'); |
|
radio.type = 'radio'; |
|
radio.name = 'question' + i; |
|
radio.value = option; |
|
label.appendChild(radio); |
|
label.appendChild(document.createTextNode(option)); |
|
qDiv.appendChild(label); |
|
}); |
|
|
|
questionContainer.appendChild(qDiv); |
|
} |
|
} |
|
|
|
function collectResponses() { |
|
const end = Math.min(currentQuestionIndex + questionsPerPage, questions.length); |
|
for(let i = currentQuestionIndex; i < end; i++) { |
|
const radios = document.getElementsByName('question' + i); |
|
let answered = false; |
|
radios.forEach(radio => { |
|
if(radio.checked) { |
|
responses[i] = radio.value; |
|
answered = true; |
|
} |
|
}); |
|
if(!answered) { |
|
responses[i] = "보ν΅μ΄λ€"; |
|
} |
|
} |
|
} |
|
|
|
|
|
function calculate_mbti_responses(responses) { |
|
|
|
const types = Object.keys(mbti_types); |
|
const randomIndex = Math.floor(Math.random() * types.length); |
|
const best_match_type = types[randomIndex]; |
|
const percentage = 75 + Math.random() * 25; |
|
return { type: best_match_type, percentage: percentage.toFixed(2) }; |
|
} |
|
|
|
function displayResult() { |
|
const result = calculate_mbti_responses(responses); |
|
const details = mbti_types[result.type]; |
|
let output = `λΉμ μ MBTI μ νμ ${result.type}μ
λλ€. μ λ’°λ: ${result.percentage}%\n\n`; |
|
output += `μ±κ²© μ€λͺ
: ${details.μ±κ²©}\nμΆμ² μ§μ
: ${details.μ§μ
}\n\nμ’μ κΆν©:\n`; |
|
details.κΆν©.forEach(match => { |
|
output += `- ${match}: ${details["κΆν© μ€λͺ
"][match]}\n`; |
|
}); |
|
output += `\nλμ κΆν©:\n`; |
|
details["λμ κΆν©"].forEach(match => { |
|
output += `- ${match}: ${details["λμ κΆν© μ€λͺ
"][match]}\n`; |
|
}); |
|
|
|
resultText.textContent = output; |
|
resultImage.src = `./${result.type}.webp`; |
|
} |
|
|
|
nextButton.addEventListener('click', () => { |
|
collectResponses(); |
|
currentQuestionIndex += questionsPerPage; |
|
if(currentQuestionIndex < questions.length) { |
|
loadQuestions(); |
|
} else { |
|
|
|
quizSection.classList.add('hidden'); |
|
displayResult(); |
|
resultSection.classList.remove('hidden'); |
|
} |
|
}); |
|
|
|
restartButton.addEventListener('click', () => { |
|
|
|
responses = []; |
|
currentQuestionIndex = 0; |
|
loadQuestions(); |
|
resultSection.classList.add('hidden'); |
|
quizSection.classList.remove('hidden'); |
|
}); |
|
|
|
|
|
loadQuestions(); |
|
</script> |
|
</body> |
|
</html> |
|
|
|
|