Spaces:
Running
Running
File size: 24,674 Bytes
95b66c8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Personality Insights | Discover Your True Self</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.question-card {
transition: all 0.3s ease;
transform-style: preserve-3d;
}
.flipped {
transform: rotateY(180deg);
}
.card-face {
backface-visibility: hidden;
position: absolute;
width: 100%;
height: 100%;
}
.card-back {
transform: rotateY(180deg);
}
.progress-bar {
transition: width 0.5s ease;
}
.option-btn:hover {
transform: translateY(-2px);
}
.fade-in {
animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
</style>
</head>
<body class="bg-gradient-to-br from-indigo-50 to-purple-50 min-h-screen font-sans">
<div class="container mx-auto px-4 py-8 max-w-4xl">
<!-- Header -->
<header class="text-center mb-12">
<h1 class="text-4xl font-bold text-indigo-800 mb-2">Personality Insights</h1>
<p class="text-lg text-gray-600">Discover your unique personality traits through our scientifically-backed assessment</p>
</header>
<!-- Main App Container -->
<div id="app" class="bg-white rounded-xl shadow-xl overflow-hidden">
<!-- Welcome Screen -->
<div id="welcome-screen" class="p-8 text-center fade-in">
<div class="w-32 h-32 mx-auto mb-6 bg-indigo-100 rounded-full flex items-center justify-center">
<i class="fas fa-user-astronaut text-6xl text-indigo-500"></i>
</div>
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Ready to Discover Your Personality?</h2>
<p class="text-gray-600 mb-8 max-w-md mx-auto">
This assessment will ask you 15 questions about your preferences and behaviors.
Answer honestly to get the most accurate results.
</p>
<button id="start-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-3 px-8 rounded-full transition-all transform hover:scale-105 shadow-md">
Start Assessment
</button>
<div class="mt-6 text-sm text-gray-500">
<i class="fas fa-lock mr-1"></i> Your responses are completely anonymous
</div>
</div>
<!-- Assessment Screen -->
<div id="assessment-screen" class="hidden">
<!-- Progress Bar -->
<div class="bg-gray-100 h-2">
<div id="progress-bar" class="progress-bar bg-gradient-to-r from-indigo-400 to-purple-500 h-full" style="width: 0%"></div>
</div>
<!-- Question Container -->
<div class="p-8">
<div class="relative h-64 mb-8">
<!-- Question Card -->
<div id="question-card" class="question-card w-full h-full bg-white rounded-lg shadow-md p-6 relative">
<!-- Front of Card (Question) -->
<div class="card-face flex flex-col">
<div class="flex justify-between items-start mb-6">
<span id="question-number" class="text-sm font-medium text-indigo-600 bg-indigo-50 px-3 py-1 rounded-full">Question 1 of 15</span>
<button id="flip-btn" class="text-gray-400 hover:text-indigo-500">
<i class="fas fa-info-circle"></i>
</button>
</div>
<h3 id="question-text" class="text-xl font-medium text-gray-800 mb-6 flex-grow">Loading question...</h3>
<div class="grid grid-cols-2 gap-4">
<button class="option-btn bg-indigo-50 hover:bg-indigo-100 text-indigo-700 font-medium py-3 px-4 rounded-lg transition-all" data-value="1">
Strongly Disagree
</button>
<button class="option-btn bg-indigo-50 hover:bg-indigo-100 text-indigo-700 font-medium py-3 px-4 rounded-lg transition-all" data-value="2">
Disagree
</button>
<button class="option-btn bg-indigo-50 hover:bg-indigo-100 text-indigo-700 font-medium py-3 px-4 rounded-lg transition-all" data-value="3">
Neutral
</button>
<button class="option-btn bg-indigo-50 hover:bg-indigo-100 text-indigo-700 font-medium py-3 px-4 rounded-lg transition-all" data-value="4">
Agree
</button>
<button class="option-btn bg-indigo-50 hover:bg-indigo-100 text-indigo-700 font-medium py-3 px-4 rounded-lg transition-all" data-value="5">
Strongly Agree
</button>
</div>
</div>
<!-- Back of Card (Explanation) -->
<div class="card-face card-back bg-indigo-50 p-6">
<div class="flex justify-between items-start mb-4">
<span class="text-sm font-medium text-indigo-600 bg-white px-3 py-1 rounded-full">Why we ask this</span>
<button id="flip-back-btn" class="text-gray-400 hover:text-indigo-500">
<i class="fas fa-times"></i>
</button>
</div>
<p id="question-explanation" class="text-gray-700">
This question helps us understand your behavioral tendencies in social situations.
There are no right or wrong answers - we're just trying to understand your natural inclinations.
</p>
</div>
</div>
</div>
<!-- Navigation -->
<div class="flex justify-between items-center">
<button id="prev-btn" class="text-gray-500 hover:text-indigo-600 font-medium py-2 px-4 rounded-lg disabled:opacity-50" disabled>
<i class="fas fa-arrow-left mr-2"></i> Previous
</button>
<button id="next-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-2 px-6 rounded-lg disabled:opacity-50" disabled>
Next <i class="fas fa-arrow-right ml-2"></i>
</button>
</div>
</div>
</div>
<!-- Results Screen -->
<div id="results-screen" class="hidden p-8 text-center">
<div class="w-32 h-32 mx-auto mb-6 bg-green-100 rounded-full flex items-center justify-center">
<i class="fas fa-chart-pie text-6xl text-green-500"></i>
</div>
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Your Personality Results</h2>
<div id="results-container" class="mt-8 grid md:grid-cols-2 gap-6 text-left">
<!-- Results will be inserted here by JavaScript -->
</div>
<div class="mt-10">
<button id="restart-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-3 px-8 rounded-full transition-all transform hover:scale-105 shadow-md mr-4">
Take Again
</button>
<button id="share-btn" class="bg-white border border-indigo-200 hover:bg-indigo-50 text-indigo-600 font-medium py-3 px-8 rounded-full transition-all transform hover:scale-105 shadow-md">
<i class="fas fa-share-alt mr-2"></i> Share Results
</button>
</div>
</div>
</div>
<!-- Footer -->
<footer class="mt-12 text-center text-sm text-gray-500">
<p>© 2023 Personality Insights. All rights reserved.</p>
<p class="mt-1">This assessment is based on the Big Five personality traits model.</p>
</footer>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// DOM Elements
const welcomeScreen = document.getElementById('welcome-screen');
const assessmentScreen = document.getElementById('assessment-screen');
const resultsScreen = document.getElementById('results-screen');
const startBtn = document.getElementById('start-btn');
const prevBtn = document.getElementById('prev-btn');
const nextBtn = document.getElementById('next-btn');
const flipBtn = document.getElementById('flip-btn');
const flipBackBtn = document.getElementById('flip-back-btn');
const questionCard = document.getElementById('question-card');
const questionText = document.getElementById('question-text');
const questionExplanation = document.getElementById('question-explanation');
const questionNumber = document.getElementById('question-number');
const progressBar = document.getElementById('progress-bar');
const resultsContainer = document.getElementById('results-container');
const restartBtn = document.getElementById('restart-btn');
const shareBtn = document.getElementById('share-btn');
const optionBtns = document.querySelectorAll('.option-btn');
// Assessment Data
const questions = [
{
text: "I am the life of the party.",
explanation: "This question measures your level of extraversion. People who enjoy being the center of attention tend to score higher on extraversion.",
trait: "extraversion"
},
{
text: "I sympathize with others' feelings.",
explanation: "This helps assess your level of agreeableness, which relates to how compassionate and cooperative you are with others.",
trait: "agreeableness"
},
{
text: "I get chores done right away.",
explanation: "This evaluates your conscientiousness, indicating how disciplined and organized you tend to be.",
trait: "conscientiousness"
},
{
text: "I have frequent mood swings.",
explanation: "This question measures emotional stability (neuroticism), showing how easily you experience negative emotions.",
trait: "neuroticism"
},
{
text: "I have a vivid imagination.",
explanation: "This assesses openness to experience, which relates to your creativity and appreciation for new ideas.",
trait: "openness"
},
{
text: "I don't talk a lot.",
explanation: "Another measure of extraversion, with quiet people typically scoring lower on this trait.",
trait: "extraversion"
},
{
text: "I am interested in people.",
explanation: "This helps determine your level of agreeableness and social interest.",
trait: "agreeableness"
},
{
text: "I pay attention to details.",
explanation: "A measure of conscientiousness, showing how careful and precise you are.",
trait: "conscientiousness"
},
{
text: "I get stressed out easily.",
explanation: "This indicates emotional stability (neuroticism), with higher scores meaning more stress sensitivity.",
trait: "neuroticism"
},
{
text: "I have excellent ideas.",
explanation: "Another measure of openness to experience and creative thinking.",
trait: "openness"
},
{
text: "I feel comfortable around people.",
explanation: "This evaluates your comfort level in social situations, relating to extraversion.",
trait: "extraversion"
},
{
text: "I insult people.",
explanation: "A reverse-coded question for agreeableness, with disagreeing indicating higher agreeableness.",
trait: "agreeableness"
},
{
text: "I like order.",
explanation: "This measures your preference for structure and organization (conscientiousness).",
trait: "conscientiousness"
},
{
text: "I worry about things.",
explanation: "An indicator of emotional stability (neuroticism), with agreement suggesting higher neuroticism.",
trait: "neuroticism"
},
{
text: "I am full of ideas.",
explanation: "This final question assesses your openness to experience and creativity.",
trait: "openness"
}
];
// App State
let currentQuestion = 0;
let answers = Array(questions.length).fill(null);
let traitScores = {
extraversion: 0,
agreeableness: 0,
conscientiousness: 0,
neuroticism: 0,
openness: 0
};
let questionsPerTrait = {
extraversion: 0,
agreeableness: 0,
conscientiousness: 0,
neuroticism: 0,
openness: 0
};
// Count questions per trait
questions.forEach(q => {
questionsPerTrait[q.trait]++;
});
// Event Listeners
startBtn.addEventListener('click', startAssessment);
prevBtn.addEventListener('click', showPreviousQuestion);
nextBtn.addEventListener('click', showNextQuestion);
flipBtn.addEventListener('click', flipCard);
flipBackBtn.addEventListener('click', flipCard);
restartBtn.addEventListener('click', restartAssessment);
shareBtn.addEventListener('click', shareResults);
optionBtns.forEach(btn => {
btn.addEventListener('click', function() {
selectOption(this);
});
});
// Functions
function startAssessment() {
welcomeScreen.classList.add('hidden');
assessmentScreen.classList.remove('hidden');
updateQuestion();
}
function updateQuestion() {
const question = questions[currentQuestion];
questionText.textContent = question.text;
questionExplanation.textContent = question.explanation;
questionNumber.textContent = `Question ${currentQuestion + 1} of ${questions.length}`;
// Update progress bar
const progress = ((currentQuestion + 1) / questions.length) * 100;
progressBar.style.width = `${progress}%`;
// Update navigation buttons
prevBtn.disabled = currentQuestion === 0;
nextBtn.disabled = answers[currentQuestion] === null;
// Update selected option
optionBtns.forEach(btn => {
if (parseInt(btn.dataset.value) === answers[currentQuestion]) {
btn.classList.add('bg-indigo-200', 'text-indigo-800');
btn.classList.remove('bg-indigo-50');
} else {
btn.classList.remove('bg-indigo-200', 'text-indigo-800');
btn.classList.add('bg-indigo-50');
}
});
}
function showPreviousQuestion() {
if (currentQuestion > 0) {
currentQuestion--;
updateQuestion();
}
}
function showNextQuestion() {
if (answers[currentQuestion] !== null) {
if (currentQuestion < questions.length - 1) {
currentQuestion++;
updateQuestion();
} else {
calculateResults();
showResults();
}
}
}
function selectOption(selectedBtn) {
const selectedValue = parseInt(selectedBtn.dataset.value);
answers[currentQuestion] = selectedValue;
// Update UI for selected option
optionBtns.forEach(btn => {
if (parseInt(btn.dataset.value) === selectedValue) {
btn.classList.add('bg-indigo-200', 'text-indigo-800');
btn.classList.remove('bg-indigo-50');
} else {
btn.classList.remove('bg-indigo-200', 'text-indigo-800');
btn.classList.add('bg-indigo-50');
}
});
nextBtn.disabled = false;
}
function flipCard() {
questionCard.classList.toggle('flipped');
}
function calculateResults() {
// Reset scores
Object.keys(traitScores).forEach(trait => {
traitScores[trait] = 0;
});
// Calculate scores for each trait
questions.forEach((q, index) => {
// For reverse-coded questions (like "I insult people")
const isReverseCoded = q.text.includes("insult") || q.text.includes("don't talk");
const answerValue = isReverseCoded ? (6 - answers[index]) : answers[index];
traitScores[q.trait] += answerValue;
});
// Calculate average scores per trait
Object.keys(traitScores).forEach(trait => {
traitScores[trait] = Math.round((traitScores[trait] / questionsPerTrait[trait]) * 10) / 10;
});
}
function showResults() {
assessmentScreen.classList.add('hidden');
resultsScreen.classList.remove('hidden');
// Clear previous results
resultsContainer.innerHTML = '';
// Display results for each trait
const traitNames = {
extraversion: "Extraversion",
agreeableness: "Agreeableness",
conscientiousness: "Conscientiousness",
neuroticism: "Neuroticism",
openness: "Openness"
};
const traitDescriptions = {
extraversion: "How outgoing, energetic and talkative you are. High scorers enjoy socializing, while low scorers prefer solitude.",
agreeableness: "How compassionate, cooperative and trusting you are. High scorers are more altruistic, while low scorers are more competitive.",
conscientiousness: "How organized, disciplined and dependable you are. High scorers are careful and detail-oriented, while low scorers are more spontaneous.",
neuroticism: "How sensitive you are to stress and negative emotions. High scorers experience more anxiety, while low scorers are more emotionally stable.",
openness: "How curious, creative and open to new experiences you are. High scorers enjoy novelty, while low scorers prefer routine."
};
const traitIcons = {
extraversion: "fa-users",
agreeableness: "fa-handshake",
conscientiousness: "fa-clipboard-check",
neuroticism: "fa-cloud-rain",
openness: "fa-lightbulb"
};
const traitColors = {
extraversion: "bg-blue-100 text-blue-800",
agreeableness: "bg-green-100 text-green-800",
conscientiousness: "bg-yellow-100 text-yellow-800",
neuroticism: "bg-red-100 text-red-800",
openness: "bg-purple-100 text-purple-800"
};
for (const [trait, score] of Object.entries(traitScores)) {
const resultCard = document.createElement('div');
resultCard.className = 'bg-white rounded-lg shadow-md p-6 border-l-4 border-indigo-200';
const scorePercentage = Math.min(Math.max((score - 1) / 4 * 100, 0), 100);
const colorClass = score >= 3.5 ? 'bg-green-500' : score >= 2.5 ? 'bg-yellow-500' : 'bg-red-500';
resultCard.innerHTML = `
<div class="flex items-center mb-4">
<div class="w-12 h-12 rounded-full ${traitColors[trait]} flex items-center justify-center mr-4">
<i class="fas ${traitIcons[trait]} text-xl"></i>
</div>
<div>
<h3 class="font-semibold text-lg text-gray-800">${traitNames[trait]}</h3>
<p class="text-sm text-gray-500">Score: ${score}/5</p>
</div>
</div>
<p class="text-gray-600 text-sm mb-4">${traitDescriptions[trait]}</p>
<div class="w-full bg-gray-200 rounded-full h-2.5 mb-2">
<div class="h-2.5 rounded-full ${colorClass}" style="width: ${scorePercentage}%"></div>
</div>
<div class="flex justify-between text-xs text-gray-500">
<span>Low</span>
<span>Moderate</span>
<span>High</span>
</div>
`;
resultsContainer.appendChild(resultCard);
}
}
function restartAssessment() {
currentQuestion = 0;
answers = Array(questions.length).fill(null);
resultsScreen.classList.add('hidden');
welcomeScreen.classList.remove('hidden');
}
function shareResults() {
// In a real app, this would share to social media or copy to clipboard
alert("Results sharing feature would be implemented here. In a real app, this would allow sharing to social media or copying to clipboard.");
}
});
</script>
</html> |