Hawkwind commited on
Commit
4bbba18
·
verified ·
1 Parent(s): 80a3ad7

Add 1 files

Browse files
Files changed (1) hide show
  1. index.html +169 -8
index.html CHANGED
@@ -76,13 +76,8 @@
76
  </div>
77
  <h3 id="question-text" class="text-xl font-medium text-gray-800 mb-6">How would you describe yourself in social situations?</h3>
78
 
79
- <div class="space-y-3">
80
- <button class="option-btn w-full text-left p-4 rounded-lg border border-gray-200">
81
- <span class="font-medium">I enjoy being around people and find social interactions energizing</span>
82
- </button>
83
- <button class="option-btn w-full text-left p-4 rounded-lg border border-gray-200">
84
- <span class="font-medium">I prefer one-on-one interactions or small groups, and need alone time to recharge</span>
85
- </button>
86
  </div>
87
  </div>
88
 
@@ -288,5 +283,171 @@
288
  },
289
  {
290
  dimension: "E/I",
291
- question: "At a party, you're
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  </html>
 
76
  </div>
77
  <h3 id="question-text" class="text-xl font-medium text-gray-800 mb-6">How would you describe yourself in social situations?</h3>
78
 
79
+ <div id="options-container" class="space-y-3">
80
+ <!-- Options will be inserted here by JavaScript -->
 
 
 
 
 
81
  </div>
82
  </div>
83
 
 
283
  },
284
  {
285
  dimension: "E/I",
286
+ question: "At a party, you're more likely to:",
287
+ options: [
288
+ "Be the one initiating conversations with new people",
289
+ "Wait for others to approach you or stick with people you know"
290
+ ],
291
+ weights: [1, -1] // E vs I
292
+ },
293
+ {
294
+ dimension: "S/N",
295
+ question: "When someone describes a situation, you focus more on:",
296
+ options: [
297
+ "The specific details and facts they mention",
298
+ "The overall patterns and what it might mean"
299
+ ],
300
+ weights: [1, -1] // S vs N
301
+ },
302
+ {
303
+ dimension: "T/F",
304
+ question: "When giving feedback, you prioritize:",
305
+ options: [
306
+ "Being honest and accurate, even if it might hurt feelings",
307
+ "Being tactful and considerate of how the person will receive it"
308
+ ],
309
+ weights: [1, -1] // T vs F
310
+ },
311
+ {
312
+ dimension: "J/P",
313
+ question: "Your workspace is typically:",
314
+ options: [
315
+ "Organized and tidy, with everything in its place",
316
+ "A bit messy, but you know where things are"
317
+ ],
318
+ weights: [1, -1] // J vs P
319
+ },
320
+ {
321
+ dimension: "E/I",
322
+ question: "You consider yourself more:",
323
+ options: [
324
+ "Outgoing and enthusiastic",
325
+ "Reserved and reflective"
326
+ ],
327
+ weights: [1, -1] // E vs I
328
+ },
329
+ {
330
+ dimension: "S/N",
331
+ question: "You're more impressed by:",
332
+ options: [
333
+ "Practical solutions that work in the real world",
334
+ "Innovative ideas that could change how things are done"
335
+ ],
336
+ weights: [1, -1] // S vs N
337
+ },
338
+ {
339
+ dimension: "T/F",
340
+ question: "When making an important choice, you rely more on:",
341
+ options: [
342
+ "Objective analysis and pros/cons lists",
343
+ "Your gut feeling and personal values"
344
+ ],
345
+ weights: [1, -1] // T vs F
346
+ },
347
+ {
348
+ dimension: "J/P",
349
+ question: "You prefer schedules and deadlines to be:",
350
+ options: [
351
+ "Followed closely and respected",
352
+ "Flexible guidelines that can adapt to circumstances"
353
+ ],
354
+ weights: [1, -1] // J vs P
355
+ }
356
+ ];
357
+
358
+ // DOM elements
359
+ const welcomeScreen = document.getElementById('welcome-screen');
360
+ const questionScreen = document.getElementById('question-screen');
361
+ const resultsScreen = document.getElementById('results-screen');
362
+ const startBtn = document.getElementById('start-btn');
363
+ const prevBtn = document.getElementById('prev-btn');
364
+ const nextBtn = document.getElementById('next-btn');
365
+ const retakeBtn = document.getElementById('retake-btn');
366
+ const questionNumber = document.getElementById('question-number');
367
+ const dimension = document.getElementById('dimension');
368
+ const questionText = document.getElementById('question-text');
369
+ const optionsContainer = document.getElementById('options-container');
370
+ const progressBar = document.getElementById('progress-bar');
371
+ const mbtiType = document.getElementById('mbti-type');
372
+ const typeDescription = document.getElementById('type-description');
373
+ const eiBar = document.getElementById('ei-bar');
374
+ const snBar = document.getElementById('sn-bar');
375
+ const tfBar = document.getElementById('tf-bar');
376
+ const jpBar = document.getElementById('jp-bar');
377
+ const eiScore = document.getElementById('ei-score');
378
+ const snScore = document.getElementById('sn-score');
379
+ const tfScore = document.getElementById('tf-score');
380
+ const jpScore = document.getElementById('jp-score');
381
+
382
+ // Test state
383
+ let currentQuestion = 0;
384
+ let answers = [];
385
+ let scores = { E: 0, I: 0, S: 0, N: 0, T: 0, F: 0, J: 0, P: 0 };
386
+
387
+ // Initialize the test
388
+ function initTest() {
389
+ currentQuestion = 0;
390
+ answers = [];
391
+ scores = { E: 0, I: 0, S: 0, N: 0, T: 0, F: 0, J: 0, P: 0 };
392
+ showQuestion();
393
+ }
394
+
395
+ // Show current question
396
+ function showQuestion() {
397
+ const question = questions[currentQuestion];
398
+
399
+ // Update question info
400
+ questionNumber.textContent = `Question ${currentQuestion + 1} of ${questions.length}`;
401
+ dimension.textContent = question.dimension;
402
+ questionText.textContent = question.question;
403
+
404
+ // Update progress bar
405
+ progressBar.style.width = `${(currentQuestion / questions.length) * 100}%`;
406
+
407
+ // Clear previous options
408
+ optionsContainer.innerHTML = '';
409
+
410
+ // Add new options
411
+ question.options.forEach((option, index) => {
412
+ const optionBtn = document.createElement('button');
413
+ optionBtn.className = 'option-btn w-full text-left p-4 rounded-lg border border-gray-200';
414
+ optionBtn.innerHTML = `<span class="font-medium">${option}</span>`;
415
+
416
+ // Check if this option was previously selected
417
+ if (answers[currentQuestion] === index) {
418
+ optionBtn.classList.add('selected');
419
+ }
420
+
421
+ optionBtn.addEventListener('click', () => selectOption(index));
422
+ optionsContainer.appendChild(optionBtn);
423
+ });
424
+
425
+ // Update navigation buttons
426
+ prevBtn.disabled = currentQuestion === 0;
427
+ nextBtn.disabled = answers[currentQuestion] === undefined;
428
+ }
429
+
430
+ // Select an option
431
+ function selectOption(index) {
432
+ // Remove selected class from all options
433
+ document.querySelectorAll('.option-btn').forEach(btn => {
434
+ btn.classList.remove('selected');
435
+ });
436
+
437
+ // Add selected class to clicked option
438
+ event.target.classList.add('selected');
439
+
440
+ // Store answer
441
+ answers[currentQuestion] = index;
442
+
443
+ // Enable next button
444
+ nextBtn.disabled = false;
445
+ }
446
+
447
+ // Calculate results
448
+ function calculateResults() {
449
+ // Reset scores
450
+ scores = { E: 0, I: 0, S: 0, N: 0, T: 0, F: 0, J: 0, P: 0 };
451
+
452
+
453
  </html>