<!--
Current Progress:
-embedded at www.hcatoolkit.com
- coding into wix site:www.h-catoolkit.com infrastructure. embed will be removed when backend is finished.
-Added reset button doesn't reset internal selections yet.
- Optimized checkboxes and ratings
- Focusing on the Enneagram section as the initial step. Once this is fully developed and functional, subsequent sections and features will be addressed. The Enneagram foundation will pave the way for the integrated functionality of the entire toolkit and website.
H.CAT (Holistic Character Assessment Toolkit) Overview:
Sections: All sections are combined with Jungian functions to tie them all together.
1. Enneagram: Uncovers core fears, desires, and motivations.
2. HEXACO: Analyzes general personality traits and behaviors.
3. CCC: Delves into character's negative dimensions for depth.
4. Jungian Scenarios: Assesses cognitive processes and ethics in situations.
Interactions:
- Various combinations of the above sections allow users to understand character depth, decisions, and interactions.
Features:
1. Character Creation: Interface for detailed profile creation and customization.
2. Scenario Sections: Problem-solving styles and ethical choices.
3. Test Results: Detailed feedback on character traits and decisions.
4. Stat Generation: Separate mental and physical stat determination. Mental uses Jungian function scores. Physical uses character background and experiences.
5. Profile Management: User account functionalities for profile handling.
6. Comparison and Interaction: Evaluate and compare multiple character profiles.
7. Crowdfunding Integration: Support for site development.
8. Artistic Mock-ups: Visual demonstrations of site and features.
Objective: Offer a complete toolkit for users to craft, assess, and refine well-rounded and dynamic characters for stories. -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Enneagram Test</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>Welcome to my Holistic Character Assessment Toolkit: Enneagram!</h1>
<h2>Introduction:</h2>
<p>The enneagram test helps you understand your character’s core motivations, fears, desires, weaknesses, and strengths. By choosing 3-4 resonating choices for each category and rating their alignment on a scale of 1-5, you gain insights into what drives your character’s behavior. It’s a starting point for exploring their personality and creating more authentic and multi-dimensional characters.</p>
<form id="enneagram-form">
<!-- Add questions and options here for this category -->
</form>
<!-- Add more question containers for other categories -->
<div id="rating-pop-up" class="rating-scale">
<!-- This will be filled by JavaScript with the rating scale and submit button -->
</div>
<button id="calculate-button">Calculate</button>
<div id="resultsContainer">
<!-- results will be shown here -->
</div>
<!-- Only one result div -->
<div id="result" class="hidden">
<!-- Results will be displayed here -->
<div>
<button class="collapsible-toggle">Motivations *tap to open details below</button>
<div class="collapsible-content">
<button class="collapsible-toggle">Dominant: ... *tap for more details</button>
<div class="collapsible-content">
Dominant: ...
<br>
Type: ...
<br>
...
</div>
<!-- ... same for Auxiliary, Tertiary, and Inferior -->
</div>
</div>
</div>
<button id="reset-button">Reset</button>
</div>
<script src="script.js"></script>
</body>
</html>
/* Reset default margin and padding */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
font-size: 16px;
line-height: 1.6;
background-color: #f0f0f0;
}
.container {
max-width: 900px;
margin: 20px auto;
padding: 20px;
background-color: white;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
}
form {
margin-top: 20px;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
.question-container {
margin-bottom: 20px;
padding: 10px;
background-color: #f9f9f9;
border: 1px solid #ddd;
border-radius: 5px;
}
.question {
font-weight: bold;
margin-bottom: 20px;
}
/* Style for question text */
#enneagram-form p {
font-weight: bold;
margin-bottom: 10px;
}
/* Style for checkboxes */
input[type="checkbox"] {
margin-right: 5px;
width: 20px; /* Set a fixed width for consistent checkbox sizes */
height: 20px; /* Set a fixed height to match the width */
vertical-align: middle; /* Align checkboxes vertically */
}
input[type="checkbox"]:focus,
button:focus {
outline: none; /* Remove default focus outline */
border-color: #007bff; /* Add a focus border color */
box-shadow: 0 0 4px rgba(0, 123, 255, 0.5); /* Add a subtle box shadow */
}
/* Add this CSS to your stylesheet or within a <style> tag in the HTML file */
.pop-up {
display: none; /* Initially hide the pop-up */
position: fixed;
top: 50%; /* Position the pop-up at the vertical center of the screen */
left: 50%; /* Position the pop-up at the horizontal center of the screen */
transform: translate(-50%, -50%); /* Center the pop-up precisely */
background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent background */
padding: 20px;
border-radius: 10px;
color: white;
z-index: 1000; /* Ensure the pop-up appears above other content */
}
/* Style for the rating scale */
.rating-scale {
display: flex;
justify-content: space-between;
margin-top: 10px;
}
/* Style for the submit button */
#submit-rating {
display: block;
margin-top: 10px;
padding: 5px 10px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
#submit-rating:hover {
background-color: #0056b3;
}
label {
display: block; /* Display options on separate lines */
margin-bottom: 10px; /* Add some spacing between options */
/*color: blue; /* Change the color of the option text to blue */
}
button {
display: block;
margin: 20px auto;
padding: 10px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #0056b3; /* Darker background color on hover */
}
input[type="checkbox"]:hover {
border-color: #007bff; /* Darker border color on hover */
}
#result {
margin-top: 20px;
padding: 10px;
background-color: #d4edda;
border-radius: 5px;
}
.hidden {
display: none;
}
#resultsContainer {
width: 80%;
margin: auto;
font-family: Arial, sans-serif;
}
.category h2 {
cursor: pointer;
background-color: #f2f2f2;
padding: 10px;
border: 1px solid #e0e0e0;
}
.details {
padding: 10px;
border: 1px solid #e0e0e0;
border-top: none;
}
details > summary {
font-weight: normal;
}
.collapsible {
cursor: pointer;
border: none;
outline: none;
text-align: left;
margin-top: 10px;
padding: 10px;
width: 100%;
background-color: #f1f1f1;
}
.collapsible-content {
display: none;
maxHeight: 0;
overflow: hidden;
transition: maxHeight 0.3s ease;
}
.collapsible.active, .collapsible:hover {
background-color: #ddd;
}
.content {
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
padding: 0 10px;
}
.content p {
margin: 10px 0;
}
.hidden {
display: none;
}
class QuestionsAndCores {
constructor() {
this.data = {
"Q1": {
"question": "Does your character relate to any of these core motivations? Choose only 3 unless you can't narrow it down.",
"core": "Motivations"
},
"Q2": {
"question": "Does your character relate to any of these core fears? Choose only 3 unless you can't narrow it down.",
"core": "Fears"
},
"Q3": {
"question": "Does your character relate to any of these core desires? Choose only 3 unless you can’t narrow it down.",
"core": "Desires"
},
"Q4": {
"question": "Does your character relate to any of these core weaknesses? Choose only 3 unless you can’t narrow it down.",
"core": "Weaknesses"
},
"Q5": {
"question": "Does your character relate to any of these core strengths? Choose only 3 unless you can’t narrow it down.",
"core": "Strengths"
}
};
}
}
class Motivations {
constructor() {
this.options = {
M1: {
description: 'Motivated to do what is right and just',
enneagramType: '1',
enneagramTypeName: 'The Reformer',
jungianFunction: 'Te',
jungianFunctionName: 'Thinking Extraverted'
},
M2: {
description: 'Motivated to be loved and needed',
enneagramType: '2',
enneagramTypeName: 'The Helper',
jungianFunction: 'Fe',
jungianFunctionName: 'Feeling Extraverted'
},
M3: {
description: 'Motivated to be successful and admired',
enneagramType: '3',
enneagramTypeName: 'The Achiever',
jungianFunction: 'Se',
jungianFunctionName: 'Sensing Extraverted'
},
M4: {
description: 'Motivated to find their unique identity and significance',
enneagramType: '4',
enneagramTypeName: 'The Individualist',
jungianFunction: 'Fi',
jungianFunctionName: 'Feeling Introverted'
},
M5: {
description: 'Motivated to understand and gain knowledge',
enneagramType: '5',
enneagramTypeName: 'The Investigator',
jungianFunction: 'Ti',
jungianFunctionName: 'Thinking Introverted'
},
M6: {
description: 'Motivated to feel secure and supported',
enneagramType: '6',
enneagramTypeName: 'The Loyalist',
jungianFunction: 'Si',
jungianFunctionName: 'Sensing Introverted'
},
M7: {
description: 'Motivated to experience pleasure and avoid pain',
enneagramType: '7',
enneagramTypeName: 'The Enthusiast',
jungianFunction: 'Se',
jungianFunctionName: 'Sensing Extraverted'
},
M8: {
description: 'Motivated to be in control and avoid vulnerability',
enneagramType: '8',
enneagramTypeName: 'The Challenger',
jungianFunction: 'Te',
jungianFunctionName: 'Thinking Extraverted'
},
M9: {
description: 'Motivated to maintain inner peace and harmony',
enneagramType: '9',
enneagramTypeName: 'The Peacemaker',
jungianFunction: 'Fi',
jungianFunctionName: 'Feeling Introverted'
}
};
}
getMotivationDetailByEnneagramType(enType) {
for (let key in this.options) {
if (this.options[key].enneagramType == enType) {
return this.options[key];
}
}
return null;
}
getMotivationDescription(key) {
const motivation = this.getMotivation(key);
return motivation ? motivation.description : null;
}
getMotivation(key) {
return this.options[key];
}
getEnneagramType(key) {
const motivation = this.getMotivation(key);
return motivation ? motivation.enneagramType : null;
}
getJungianFunction(key) {
const motivation = this.getMotivation(key);
return motivation ? motivation.jungianFunction : null;
}
getEnneagramTypeName(key) {
const motivation = this.getMotivation(key);
return motivation ? motivation.enneagramTypeName : null;
}
getJungianFunctionName(key) {
const motivation = this.getMotivation(key);
return motivation ? motivation.jungianFunctionName : null;
}
}
class Fears {
constructor() {
this.options = {
F1: {
description: 'Fears being wrong or bad',
enneagramType: '1',
enneagramTypeName: 'The Reformer',
jungianFunction: 'Ti',
jungianFunctionName: 'Thinking Introverted'
},
F2: {
description: 'Fears being unwanted or unloved',
enneagramType: '2',
enneagramTypeName: 'The Helper',
jungianFunction: 'Fi',
jungianFunctionName: 'Feeling Introverted'
},
F3: {
description: 'Fears being worthless or unsuccessful',
enneagramType: '3',
enneagramTypeName: 'The Achiever',
jungianFunction: 'Si',
jungianFunctionName: 'Sensing Introverted'
},
F4: {
description: 'Fears being ordinary or mundane',
enneagramType: '4',
enneagramTypeName: 'The Individualist',
jungianFunction: 'Ne',
jungianFunctionName: 'Intuition Extraverted'
},
F5: {
description: 'Fears being incompetent or ignorant',
enneagramType: '5',
enneagramTypeName: 'The Investigator',
jungianFunction: 'Te',
jungianFunctionName: 'Thinking Extraverted'
},
F6: {
description: 'Fears being without guidance or support',
enneagramType: '6',
enneagramTypeName: 'The Loyalist',
jungianFunction: 'Se',
jungianFunctionName: 'Sensing Extraverted'
},
F7: {
description: 'Fears being trapped or limited',
enneagramType: '7',
enneagramTypeName: 'The Enthusiast',
jungianFunction: 'Ni',
jungianFunctionName: 'Intuition Introverted'
},
F8: {
description: 'Fears being weak or powerless',
enneagramType: '8',
enneagramTypeName: 'The Challenger',
jungianFunction: 'Fi',
jungianFunctionName: 'Feeling Introverted'
},
F9: {
description: 'Fears conflict and disharmony',
enneagramType: '9',
enneagramTypeName: 'The Peacemaker',
jungianFunction: 'Ne',
jungianFunctionName: 'Intuition Extraverted'
}
};
}
getFearDescription(key) {
const fear = this.getFear(key);
return fear ? fear.description : null;
}
getFear(key) {
return this.options[key];
}
getEnneagramType(key) {
const fear = this.getFear(key);
return fear ? fear.enneagramType : null;
}
getJungianFunction(key) {
const fear = this.getFear(key);
return fear ? fear.jungianFunction : null;
}
getEnneagramTypeName(key) {
const fear = this.getFear(key);
return fear ? fear.enneagramTypeName : null;
}
getJungianFunctionName(key) {
const fear = this.getFear(key);
return fear ? fear.jungianFunctionName : null;
}
}
class Desires {
constructor() {
this.options = {
D1: {
description: 'Desires to improve themselves and the world',
enneagramType: '1',
enneagramTypeName: 'The Reformer',
jungianFunction: 'Te',
jungianFunctionName: 'Thinking Extraverted'
},
D2: {
description: 'Desires to help and care for others',
enneagramType: '2',
enneagramTypeName: 'The Helper',
jungianFunction: 'Fe',
jungianFunctionName: 'Feeling Extraverted'
},
D3: {
description: 'Desires to achieve and excel in their endeavors',
enneagramType: '3',
enneagramTypeName: 'The Achiever',
jungianFunction: 'Se',
jungianFunctionName: 'Sensing Extraverted'
},
D4: {
description: 'Desires to express themselves creatively and authentically',
enneagramType: '4',
enneagramTypeName: 'The Individualist',
jungianFunction: 'Fi',
jungianFunctionName: 'Feeling Introverted'
},
D5: {
description: 'Desires to analyze and comprehend the world around them',
enneagramType: '5',
enneagramTypeName: 'The Investigator',
jungianFunction: 'Ti',
jungianFunctionName: 'Thinking Introverted'
},
D6: {
description: 'Desires to find trustworthy people and systems to rely on',
enneagramType: '6',
enneagramTypeName: 'The Loyalist',
jungianFunction: 'Si',
jungianFunctionName: 'Sensing Introverted'
},
D7: {
description: 'Desires to explore and enjoy new experiences',
enneagramType: '7',
enneagramTypeName: 'The Enthusiast',
jungianFunction: 'Se',
jungianFunctionName: 'Sensing Extraverted'
},
D8: {
description: 'Desires to assert their strength and authority',
enneagramType: '8',
enneagramTypeName: 'The Challenger',
jungianFunction: 'Te',
jungianFunctionName: 'Thinking Extraverted'
},
D9: {
description: 'Desires to find common ground and avoid confrontation',
enneagramType: '9',
enneagramTypeName: 'The Peacemaker',
jungianFunction: 'Fi',
jungianFunctionName: 'Feeling Introverted'
}
};
}
getDesireDescription(key) {
const desire = this.getDesire(key);
return desire ? desire.description : null;
}
getDesire(key) {
return this.options[key];
}
getEnneagramType(key) {
const desire = this.getDesire(key);
return desire ? desire.enneagramType : null;
}
getJungianFunction(key) {
const desire = this.getDesire(key);
return desire ? desire.jungianFunction : null;
}
getEnneagramTypeName(key) {
const desire = this.getDesire(key);
return desire ? desire.enneagramTypeName : null;
}
getJungianFunctionName(key) {
const desire = this.getDesire(key);
return desire ? desire.jungianFunctionName : null;
}
}
class Weaknesses {
constructor() {
this.options = {
W1: {
description: 'Excessive self-criticism and tendency to judge oneself and others harshly.',
enneagramType: '1',
enneagramTypeName: 'The Reformer',
jungianFunction: 'Ti',
jungianFunctionName: 'Thinking Introverted'
},
W2: {
description: 'Putting excessive emphasis on the needs and emotions of others, sometimes at the expense of one\'s own well-being.',
enneagramType: '2',
enneagramTypeName: 'The Helper',
jungianFunction: 'Fi',
jungianFunctionName: 'Feeling Introverted'
},
W3: {
description: 'Becoming overly invested in maintaining a specific image or persona to gain validation and recognition.',
enneagramType: '3',
enneagramTypeName: 'The Achiever',
jungianFunction: 'Si',
jungianFunctionName: 'Sensing Introverted'
},
W4: {
description: 'Becoming overly absorbed in and defined by one\'s emotions and inner world.',
enneagramType: '4',
enneagramTypeName: 'The Individualist',
jungianFunction: 'Ne',
jungianFunctionName: 'Intuition Extraverted'
},
W5: {
description: 'Tendency to withdraw from social interactions and seek solitude for extended periods.',
enneagramType: '5',
enneagramTypeName: 'The Investigator',
jungianFunction: 'Te',
jungianFunctionName: 'Thinking Extraverted'
},
W6: {
description: 'Frequent feelings of anxiety and doubt about oneself and others, leading to hesitation and mistrust.',
enneagramType: '6',
enneagramTypeName: 'The Loyalist',
jungianFunction: 'Se',
jungianFunctionName: 'Sensing Extraverted'
},
W7: {
description: 'A strong aversion to experiencing negative emotions and discomfort, often seeking distractions or positive experiences.',
enneagramType: '7',
enneagramTypeName: 'The Enthusiast',
jungianFunction: 'Ni',
jungianFunctionName: 'Intuition Introverted'
},
W8: {
description: 'A tendency to rely on aggression and intimidation as a means of asserting control or protecting oneself.',
enneagramType: '8',
enneagramTypeName: 'The Challenger',
jungianFunction: 'Fi',
jungianFunctionName: 'Feeling Introverted'
},
W9: {
description: 'A strong desire to avoid conflict and difficulty making decisions when faced with differing opinions or choices.',
enneagramType: '9',
enneagramTypeName: 'The Peacemaker',
jungianFunction: 'Ne',
jungianFunctionName: 'Intuition Extraverted'
}
};
}
getWeaknessDescription(key) {
const weakness = this.getWeakness(key);
return weakness ? weakness.description : null;
}
getWeakness(key) {
return this.options[key];
}
getEnneagramType(key) {
const weakness = this.getWeakness(key);
return weakness ? weakness.enneagramType : null;
}
getJungianFunction(key) {
const weakness = this.getWeakness(key);
return weakness ? weakness.jungianFunction : null;
}
getEnneagramTypeName(key) {
const weakness = this.getWeakness(key);
return weakness ? weakness.enneagramTypeName : null;
}
getJungianFunctionName(key) {
const weakness = this.getWeakness(key);
return weakness ? weakness.jungianFunctionName : null;
}
}
class Strengths {
constructor() {
this.options = {
S1: {
description: 'High standards and a strong sense of morality.',
enneagramType: '1',
enneagramTypeName: 'The Reformer',
jungianFunction: 'Te',
jungianFunctionName: 'Thinking Extraverted'
},
S2: {
description: 'Empathy and compassion for others.',
enneagramType: '2',
enneagramTypeName: 'The Helper',
jungianFunction: 'Fe',
jungianFunctionName: 'Feeling Extraverted'
},
S3: {
description: 'Ambition and drive to succeed.',
enneagramType: '3',
enneagramTypeName: 'The Achiever',
jungianFunction: 'Se',
jungianFunctionName: 'Sensing Extraverted'
},
S4: {
description: 'Creativity and a deep sense of individuality.',
enneagramType: '4',
enneagramTypeName: 'The Individualist',
jungianFunction: 'Fi',
jungianFunctionName: 'Feeling Introverted'
},
S5: {
description: 'Intellectual curiosity and a thirst for knowledge.',
enneagramType: '5',
enneagramTypeName: 'The Investigator',
jungianFunction: 'Ti',
jungianFunctionName: 'Thinking Introverted'
},
S6: {
description: 'Loyalty and commitment to their values and relationships.',
enneagramType: '6',
enneagramTypeName: 'The Loyalist',
jungianFunction: 'Si',
jungianFunctionName: 'Sensing Introverted'
},
S7: {
description: 'Optimism and a sense of adventure.',
enneagramType: '7',
enneagramTypeName: 'The Enthusiast',
jungianFunction: 'Se',
jungianFunctionName: 'Sensing Extraverted'
},
S8: {
description: 'Courage and a strong sense of justice.',
enneagramType: '8',
enneagramTypeName: 'The Challenger',
jungianFunction: 'Te',
jungianFunctionName: 'Thinking Extraverted'
},
S9: {
description: 'Ability to see multiple perspectives and find compromise.',
enneagramType: '9',
enneagramTypeName: 'The Peacemaker',
jungianFunction: 'Fi',
jungianFunctionName: 'Feeling Introverted'
}
};
}
getStrengthDescription(key) {
const strength = this.getStrength(key);
return strength ? strength.description : null;
}
getStrength(key) {
return this.options[key];
}
getEnneagramType(key) {
const strength = this.getStrength(key);
return strength ? strength.enneagramType : null;
}
getJungianFunction(key) {
const strength = this.getStrength(key);
return strength ? strength.jungianFunction : null;
}
getEnneagramTypeName(key) {
const strength = this.getStrength(key);
return strength ? strength.enneagramTypeName : null;
}
getJungianFunctionName(key) {
const strength = this.getStrength(key);
return strength ? strength.jungianFunctionName : null;
}
}
class EnneagramTypes {
constructor() {
this.types = {
'1': {
name: 'The Perfectionist',
description: 'Perfectionists are driven by a strong desire to do what is right and just. They fear being wrong or bad and seek to improve themselves and the world around them. Their weakness lies in self-criticism and judgment of both themselves and others, but their strength lies in their high standards and strong sense of morality.',
jungianFunctions: ['Te', 'Ti'],
Motivations: ['Desire to do what is right and just.'],
Fears: ['Being wrong or bad.'],
Desire: ['To improve themselves and the world around them.'],
Weaknesses: ['Self-criticism and judgment of both themselves and others.'],
Strengths: ['High standards and strong sense of morality.']
},
'2': {
name: 'The Helper',
description: 'Helpers are motivated by a need to be loved and needed. They fear being unwanted or unloved, and their desire is to care for and assist others. While their weakness involves over-identifying with others needs, their strength lies in their empathy and compassion for those around them.',
jungianFunctions: ['Fe', 'Fi'],
Motivations: ['Need to be loved and needed.'],
Fears: ['Being unwanted or unloved.'],
Desire: ['To care for and assist others.'],
Weaknesses: ['Over-identifying with others needs.'],
Strengths: ['Empathy and compassion for those around them.']
},
'3': {
name: 'The Achiever',
description: 'Achievers are motivated by the desire to be successful and admired. They fear being worthless or unsuccessful and strive to excel in their pursuits. Their weakness is becoming overly focused on their image, but their strength lies in their ambition and drive to achieve their goals.',
jungianFunctions: ['Se', 'Si'],
Motivations: ['Desire to be successful and admired.'],
Fears: ['Being worthless or unsuccessful.'],
Desire: ['To excel in their pursuits.'],
Weaknesses: ['Becoming overly focused on their image.'],
Strengths: ['Ambition and drive to achieve their goals.']
},
'4': {
name: 'The Individualist',
description: 'Individualists are motivated to find their unique identity and significance. They fear being ordinary and yearn to express themselves authentically. Their weakness involves getting lost in their emotions, but their strength lies in their creativity and strong sense of individuality.',
jungianFunctions: ['Fi', 'Ne'],
Motivations: ['Finding their unique identity and significance.'],
Fears: ['Being ordinary.'],
Desire: ['To express themselves authentically.'],
Weaknesses: ['Getting lost in their emotions.'],
Strengths: ['Creativity and strong sense of individuality.']
},
'5': {
name: 'The Investigator',
description: 'Investigators are motivated by a thirst for knowledge and understanding. They fear incompetence and ignorance and seek to analyze and comprehend the world around them. Their weakness is withdrawing from others, but their strength lies in their intellectual curiosity and pursuit of knowledge.',
jungianFunctions: ['Ti', 'Te'],
Motivations: ['Thirst for knowledge and understanding.'],
Fears: ['Incompetence and ignorance.'],
Desire: ['To analyze and comprehend the world.'],
Weaknesses: ['Withdrawing from others.'],
Strengths: ['Intellectual curiosity and pursuit of knowledge.']
},
'6': {
name: 'The Loyalist',
description: 'Loyalists are motivated by a desire for security and support. They fear being without guidance and rely on trustworthy people and systems. Their weakness is anxiety and doubt, but their strength lies in their loyalty and commitment to their values and relationships.',
jungianFunctions: ['Si', 'Se'],
Motivations: ['Desire for security and support.'],
Fears: ['Being without guidance.'],
Desire: ['To rely on trustworthy people and systems.'],
Weaknesses: ['Anxiety and doubt.'],
Strengths: ['Loyalty and commitment to values and relationships.']
},
'7': {
name: 'The Enthusiast',
description: 'Enthusiasts are motivated by the pursuit of pleasure and avoidance of pain. They fear feeling trapped and love exploring new experiences. Their weakness involves avoiding negative emotions, but their strength lies in their optimism and sense of adventure.',
jungianFunctions: ['Se', 'Ni'],
Motivations: ['Pursuit of pleasure and avoidance of pain.'],
Fears: ['Feeling trapped.'],
Desire: ['To explore new experiences.'],
Weaknesses: ['Avoiding negative emotions.'],
Strengths: ['Optimism and sense of adventure.']
},
'8': {
name: 'The Challenger',
description: 'Challengers are motivated by the need for control and to avoid vulnerability. They fear weakness and assert their strength and authority. Their weakness can be an overuse of aggression, but their strength lies in their courage and strong sense of justice.',
jungianFunctions: ['Te', 'Fi'],
Motivations: ['Need for control and to avoid vulnerability.'],
Fears: ['Weakness.'],
Desire: ['To assert their strength and authority.'],
Weaknesses: ['Overuse of aggression.'],
Strengths: ['Courage and strong sense of justice.']
},
'9': {
name: 'The Peacemaker',
description: 'Peacemakers are motivated to maintain inner peace and harmony. They fear conflict and seek to find common ground. Their weakness is avoiding conflict and being indecisive, but their strength lies in their ability to understand multiple perspectives and find compromise.',
jungianFunctions: ['Fi', 'Ne'],
Motivations: ['To maintain inner peace and harmony.'],
Fears: ['Conflict.'],
Desire: ['To find common ground.'],
Weaknesses: ['Avoiding conflict and being indecisive.'],
Strengths: ['Understanding multiple perspectives and finding compromise.']
}
};
}
getType(number) {
return this.types[number];
}
getTypeName(number) {
const type = this.getType(number);
return type ? type.name : null;
}
getTypeDescription(number) {
const type = this.getType(number);
return type ? type.description : null;
}
getTypeJungianFunctions(number) {
const type = this.getType(number);
return type ? type.jungianFunctions : null;
}
getTypeMotivations(number) {
const type = this.getType(number);
return type ? type.Motivations : null;
}
getTypeFears(number) {
const type = this.getType(number);
return type ? type.Fears : null;
}
getTypeDesires(number) {
const type = this.getType(number);
return type ? type.Desire : null;
}
getTypeWeaknesses(number) {
const type = this.getType(number);
return type ? type.Weaknesses : null;
}
getTypeStrengths(number) {
const type = this.getType(number);
return type ? type.Strengths : null;
}
getAllTypes() {
return Object.values(this.types);
}
getAllNumbers() {
return Object.keys(this.types);
}
}
class JungianFunctions {
constructor() {
this.functions = {
'Te': {
key: 'Te',
name: 'Thinking Extroverted',
description: 'Te is oriented towards organizing the external world, prioritizing efficiency, productivity, and structured logic.'
},
'Ti': {
key: 'Ti',
name: 'Thinking Introverted',
description: 'Ti seeks precision, such as the exact word to express an idea. It notices the minute distinctions that define the essence of things, then analyzes and classifies them.'
},
'Fe': {
key: 'Fe',
name: 'Feeling Extroverted',
description: 'Fe prioritizes the emotional needs of others and seeks harmony in interpersonal relationships. It values societal norms and tends to prioritize group harmony over individual needs.'
},
'Fi': {
key: 'Fi',
name: 'Feeling Introverted',
description: 'Fi is focused on internal values and how one feels about them. It evaluates things based on how well they align with personal beliefs and values.'
},
'Se': {
key: 'Se',
name: 'Sensing Extroverted',
description: 'Se focuses on the immediate context, experiencing and noticing the external environment in vivid detail. It is highly attuned to sensory experience and is often spontaneous.'
},
'Si': {
key: 'Si',
name: 'Sensing Introverted',
description: 'Si draws upon past experiences and stored data to form perceptions. It values tradition, stability, and the lessons of history.'
},
'Ne': {
key: 'Ne',
name: 'iNtuition Extroverted',
description: 'Ne sees possibilities of what could be, often leading to bursts of inspiration. It enjoys brainstorming and thinking outside the box.'
},
'Ni': {
key: 'Ni',
name: 'iNtuition Introverted',
description: 'Ni has a vision of how things could evolve over time. It synthesizes seemingly disparate ideas into a unified vision, often resulting in an "aha!" moment.'
}
};
}
getFunction(key) {
return this.functions[key];
}
getName(key) {
const func = this.getFunction(key);
return func ? func.name : null;
}
getDescription(key) {
const func = this.getFunction(key);
return func ? func.description : null;
}
getAllFunctions() {
return Object.values(this.functions);
}
getAllKeys() {
return Object.keys(this.functions);
}
}
class EnneagramTest {
constructor() {
this.questionsAndCores = new QuestionsAndCores();
this.motivations = new Motivations();
this.fears = new Fears();
this.desires = new Desires();
this.weaknesses = new Weaknesses();
this.strengths = new Strengths();
this.enneagramTypes = new EnneagramTypes();
this.jungianFunctions = new JungianFunctions();
this.selectedCount = {}; // Add this line
this.userAnswers = {
motivations: [],
fears: [],
desires: [],
weaknesses: [],
strengths: []
};
}
// Method to display Enneagram test result
displayTestResult() {
// Get the calculated Enneagram type and associated data
// Display the result to the user
}
// Other methods for interactions with user interface
}
const enneagramTestInstance = new EnneagramTest();
// Display the Enneagram test result to the user
enneagramTestInstance.displayTestResult();
class EnneagramTestRenderer {
constructor(testInstance, config = {}) {
if (!testInstance) throw new Error("Test instance is required!");
this.testInstance = testInstance;
this.config = {
maxSelections: 4,
...config
};
this.blueWords = new Set([
'right', 'just', 'loved', 'needed', 'successful', 'admired', 'unique identity',
'significance', 'understand', 'knowledge', 'secure', 'supported', 'pleasure',
'pain', 'control', 'vulnerability', 'inner peace', 'harmony', 'wrong', 'bad',
'unwanted', 'unloved', 'worthless', 'unsuccessful', 'ordinary', 'mundane',
'incompetent', 'ignorant', 'guidance', 'support', 'trapped', 'limited', 'weak',
'powerless', 'conflict', 'disharmony', 'improve', 'world', 'help', 'care',
'achieve', 'excel', 'express', 'creatively', 'authentically', 'analyze',
'comprehend', 'trustworthy', 'explore', 'experiences', 'assert', 'strength',
'authority', 'common ground', 'confrontation', 'self-criticism', 'judge', 'emotions',
'needs', 'image', 'validation', 'recognition', 'inner world', 'social interactions',
'solitude', 'anxiety', 'doubt', 'hesitation', 'mistrust', 'negative emotions',
'discomfort', 'aggression', 'intimidation', 'conflict', 'decisions', 'opinions',
'choices', 'standards', 'morality', 'empathy', 'compassion', 'ambition', 'drive',
'creativity', 'individuality', 'curiosity', 'loyalty', 'values', 'relationships',
'optimism', 'adventure', 'courage', 'justice', 'perspectives', 'compromise'
]);
}
logEvent(event, optionKey, groupName, value = null) {
if(event === 'select') {
console.log(`Rating for option ${optionKey} from ${groupName} set to: ${value}`);
} else if(event === 'check' && value) {
console.log(`Option ${optionKey} from ${groupName} is selected.`);
} else if(event === 'uncheck' && !value) {
console.log(`Option ${optionKey} from ${groupName} is deselected.`);
}
}
createInput(optionKey, groupName, data) {
const input = document.createElement('input');
input.type = 'checkbox';
input.name = groupName.toLowerCase();
input.value = JSON.stringify({
key: optionKey,
...data[optionKey]
});
return input;
}
createSelect() {
const select = document.createElement('select');
for (let i = 1; i <= 5; i++) {
const option = document.createElement('option');
option.value = i;
option.textContent = i;
select.appendChild(option);
}
return select;
}
render() {
const form = document.getElementById('enneagram-form');
this.selectedCount = {};
const optionGroups = [
{ groupName: 'Motivations', data: this.testInstance.motivations.options },
{ groupName: 'Fears', data: this.testInstance.fears.options },
{ groupName: 'Desires', data: this.testInstance.desires.options },
{ groupName: 'Weaknesses', data: this.testInstance.weaknesses.options },
{ groupName: 'Strengths', data: this.testInstance.strengths.options },
];
const fragment = document.createDocumentFragment();
optionGroups.forEach((optionGroup, index) => {
const groupContainer = document.createElement('div');
groupContainer.classList.add('question-container', optionGroup.groupName.toLowerCase());
const questionElement = document.createElement('p');
questionElement.className = 'question';
questionElement.textContent = this.testInstance.questionsAndCores.data[`Q${index + 1}`].question;
groupContainer.appendChild(questionElement);
for (const optionKey in optionGroup.data) {
const option = optionGroup.data[optionKey];
const labelContainer = document.createElement('label');
labelContainer.className = 'label-container';
const input = this.createInput(optionKey, optionGroup.groupName, optionGroup.data);
labelContainer.appendChild(input);
input.addEventListener('change', () => {
if(input.checked) {
this.selectedCount[optionGroup.groupName] = (this.selectedCount[optionGroup.groupName] || 0) + 1;
select.value = '1'; // Set the rating to 1 by default when option is selected
console.log("Before change:", this.selectedCount[optionGroup.groupName]);
this.logEvent('check', optionKey, optionGroup.groupName);
} else {
this.selectedCount[optionGroup.groupName]--;
this.logEvent('uncheck', optionKey, optionGroup.groupName);
}
// ... your existing code
console.log("After change:", this.selectedCount[optionGroup.groupName]);
if (this.selectedCount[optionGroup.groupName] > this.config.maxSelections) {
alert(`You can select only ${this.config.maxSelections} options in this group.`);
input.checked = false;
this.selectedCount[optionGroup.groupName]--;
}
});
const select = this.createSelect();
select.addEventListener('change', () => {
if(input.checked) { // Only consider the rating if the checkbox is selected
this.logEvent('select', optionKey, optionGroup.groupName, select.value);
}
});
labelContainer.appendChild(select);
const label = document.createElement('span');
const optionWords = option.description.split(' ');
optionWords.forEach(word => {
const span = document.createElement('span');
span.textContent = word + ' ';
if (this.blueWords.has(word.toLowerCase())) {
span.style.color = 'blue';
}
label.appendChild(span);
});
labelContainer.appendChild(label);
groupContainer.appendChild(labelContainer);
}
fragment.appendChild(groupContainer);
});
form.appendChild(fragment);
}
}
document.addEventListener('DOMContentLoaded', function() {
const renderer = new EnneagramTestRenderer(enneagramTestInstance);
renderer.render();
const calculateButton = document.getElementById('calculate-button');
calculateButton.addEventListener('click', calculateAndDisplayResult);
// New Collapsible Code
document.addEventListener('click', function(event) {
if (event.target.classList.contains('collapsible-toggle')) {
const content = event.target.nextElementSibling;
if (content.style.display === 'block') {
content.style.display = 'none';
} else {
content.style.display = 'block';
}
}
});
});
const wingTypeAssociations = [
{ type: 1, wing: "2" },
{ type: 2, wing: "3" },
{ type: 3, wing: "4" },
{ type: 4, wing: "5" },
{ type: 5, wing: "6" },
{ type: 6, wing: "7" },
{ type: 7, wing: "8" },
{ type: 8, wing: "9" },
{ type: 9, wing: "8" },
{ type: 8, wing: "7" },
{ type: 7, wing: "6" },
{ type: 6, wing: "5" },
{ type: 5, wing: "4" },
{ type: 4, wing: "3" },
{ type: 3, wing: "2" },
{ type: 2, wing: "1" },
{ type: 1, wing: "9" }
];
function isDirectWing(typeA, typeB) {
const wingOrder = ["1w2", "2w3", "3w4", "4w5", "5w6", "6w7", "7w8", "8w9", "9w8", "8w7", "7w6", "6w5", "5w4", "4w3", "3w2", "2w1", "1w9"];
const typeAWing = wingOrder.find(w => w.startsWith(typeA) || w.endsWith(typeA));
const typeBWing = wingOrder.find(w => w.startsWith(typeB) || w.endsWith(typeB));
const indexA = wingOrder.indexOf(typeAWing);
const indexB = wingOrder.indexOf(typeBWing);
return Math.abs(indexA - indexB) === 1;
}
function areDirectWings(types) {
let hasDirectWing = true;
for (let type of types) {
if (!types.some(t => t !== type && isDirectWing(type, t))) {
hasDirectWing = false;
break;
}
}
return hasDirectWing;
}
console.log(areDirectWings(["3", "4", "5", "2"])); // Should return true or false based on the set
console.log(isDirectWing("3", "4")); // true
console.log(isDirectWing("4", "3")); // true
console.log(isDirectWing("3", "5")); // false
function calculateDistance(a, b) {
return Math.abs(parseInt(a) - parseInt(b));
}
// Sort the Motivations, Fears, Desires, Weaknesses, and Strengths
const categories = ['M', 'F', 'D', 'W', 'S'];
const categoryNames = {
M: 'Motivations',
F: 'Fears',
D: 'Desires',
W: 'Weaknesses',
S: 'Strengths'
};
function calculateAndDisplayResult() {
const ratings = {};
// Loop through each checkbox input
// Loop through each checkbox input
document.querySelectorAll('input[type="checkbox"]').forEach(checkbox => {
if (checkbox.checked) {
const optionData = JSON.parse(checkbox.value);
const ratingValue = parseInt(checkbox.nextElementSibling.value); // Assumes the select is right after the checkbox
// Store both the rating and the Enneagram type for the option
ratings[optionData.key] = {
rating: ratingValue,
enneagramType: optionData.enneagramType
};
// Log the selected option and its rating
console.log(`Option ${optionData.key} from ${checkbox.name.charAt(0).toUpperCase() + checkbox.name.slice(1)} is selected.`);
console.log(`Rating for option ${optionData.key} from ${checkbox.name.charAt(0).toUpperCase() + checkbox.name.slice(1)} set to: ${ratingValue}`);
// Now, also assign the rating to the enneagramType and jungianFunction
// Check if the type and function already exist, if so, add to the existing value, otherwise, set it
ratings['enneagramType(' + optionData.enneagramType + ')'] = (ratings['enneagramType(' + optionData.enneagramType + ')'] || 0) + ratingValue;
ratings['jungianFunction(' + optionData.jungianFunction + ')'] = (ratings['jungianFunction(' + optionData.jungianFunction + ')'] || 0) + ratingValue;
}
});
console.log('Collected Ratings:', ratings);
const motivationsInstance = new Motivations();
const fearsInstance = new Fears();
const desiresInstance = new Desires();
const weaknessesInstance = new Weaknesses();
const strengthsInstance = new Strengths();
const categoryInstances = {
M: motivationsInstance,
F: fearsInstance,
D: desiresInstance,
W: weaknessesInstance,
S: strengthsInstance
};
categories.forEach(category => {
const sortedCategoryRatings = Object.entries(ratings)
.filter(([key, data]) => key.startsWith(category))
.sort(([, aData], [, bData]) => {
if (aData.rating !== bData.rating) {
return bData.rating - aData.rating;
}
if (isDirectWing(aData.enneagramType, bData.enneagramType)) {
return -1;
}
return calculateDistance(aData.enneagramType, bData.enneagramType) - calculateDistance(bData.enneagramType, aData.enneagramType);
})
.map(([key, data]) => {
// Adjust how you're calling the methods
let description;
switch(category) {
case 'M':
description = motivationsInstance.getMotivationDescription(key);
break;
case 'F':
description = fearsInstance.getFearDescription(key);
break;
case 'D':
description = desiresInstance.getDesireDescription(key);
break;
case 'W':
description = weaknessesInstance.getWeaknessDescription(key);
break;
case 'S':
description = strengthsInstance.getStrengthDescription(key);
break;
// ... handle other categories similarly
}
return {
option: description,
rating: data.rating,
enneagramType: data.enneagramType
};
});
if (sortedCategoryRatings.length > 0) {
console.log(`Sorted ratings for category ${categoryNames[category]}: `, sortedCategoryRatings);
}
});
const enneagramTypeRatings = Object.entries(ratings)
.filter(([key]) => key.startsWith('enneagramType('))
.map(([key, value]) => ({
type: key.match(/\d+/)[0],
rating: value
}));
// Let's assume wingType is the variable storing your wing. For instance, if it's Type 2 wing 1, then wingType = 1.
enneagramTypeRatings.sort((a, b) => {
// Check if ratings are different first
if (b.rating !== a.rating) {
return b.rating - a.rating; // Sort based on ratings
} else {
// If ratings are the same, sort based on proximity to wing
const diffA = Math.abs(wingTypeAssociations - a.enneagramType);
const diffB = Math.abs(wingTypeAssociations - b.enneagramType);
return diffA - diffB; // Sort based on proximity to wing
}
});
console.log('Sorted Enneagram Types based on rating, wing, and proximity:', enneagramTypeRatings.map(item => `Type ${item.type}: ${item.rating}`).join('\n'));
// Sort the Jungian functions
const sortedJungianFunctions = Object.entries(ratings)
.filter(([key]) => key.startsWith('jungianFunction('))
.sort(([,a], [,b]) => b - a)
.map(([key, rating]) => ({
function: key.match(/\(([^)]+)\)/)[1],
rating: rating
}));
console.log('Sorted Jungian Functions based on rating:', sortedJungianFunctions);
function prepareResultString() {
let result = `Your top Enneagram type is: ${enneagramTypeRatings[0].type} with a score of ${enneagramTypeRatings[0].rating}\n\n`;
//..
// Add sorted ratings for each category
categories.forEach(category => {
const sortedCategoryRatings = getSortedCategoryRatings(category);
if (sortedCategoryRatings.length > 0) {
result += formatCategoryResults(category, sortedCategoryRatings);
}
});
// Add Jungian Functions
result += formatJungianFunctionResults(sortedJungianFunctions);
return result;
}
function getSortedCategoryRatings(category) {
return Object.entries(ratings)
.filter(([key]) => key.startsWith(category))
.sort(compareRatings)
.map(formatRatingsData);
}
function compareRatings([, aData], [, bData]) {
if (aData.rating !== bData.rating) return bData.rating - aData.rating;
if (isDirectWing(aData.enneagramType, bData.enneagramType)) return -1;
return calculateDistance(aData.enneagramType, bData.enneagramType) - calculateDistance(bData.enneagramType, aData.enneagramType);
}
function formatRatingsData([key, data]) {
return {
option: key,
rating: data.rating,
enneagramType: data.enneagramType
};
}
function formatCategoryResults(category, sortedCategoryRatings) {
return `**${categoryNames[category]}**\n` + sortedCategoryRatings.map(item => `Type ${item.enneagramType}: ${item.rating}`).join('\n') + '\n\n';
}
function formatJungianFunctionResults(sortedJungianFunctions) {
return '**Jungian Functions**\n' + sortedJungianFunctions.map(func => `${func.function}: ${func.rating}`).join('\n');
}
const enneagramTypesInstance = new EnneagramTypes();
const jungianFunctionsInstance = new JungianFunctions();
const terms = ['Dominant', 'Auxiliary', 'Tertiary', 'Inferior'];
function getCategoryResult(category) {
let result = `<details><summary>${categoryNames[category]}</summary>`;
const sortedCategoryRatings = getSortedCategoryRatings(category);
console.log("Sorted Category Ratings:", sortedCategoryRatings);
sortedCategoryRatings.slice(0, 4).forEach((item, index) => {
let description = '';
let enneagramDetail = '';
let jungianFunctionDetail = '';
try {
const instance = categoryInstances[category];
const itemKey = item.option;
switch (category) {
case 'M':
description = instance.getMotivationDescription(itemKey);
break;
case 'F':
description = instance.getFearDescription(itemKey);
break;
case 'D':
description = instance.getDesireDescription(itemKey);
break;
case 'W':
description = instance.getWeaknessDescription(itemKey);
break;
case 'S':
description = instance.getStrengthDescription(itemKey);
break;
}
console.log("Retrieved Description:", description);
// Extract the Enneagram type and name for the current item using the category class methods
const enneagramName = instance.getEnneagramTypeName(itemKey) || "Unknown Type";
enneagramDetail = `<details><summary>Enneagram Type</summary>${enneagramName}</details>`;
// Extract the Jungian function name for the current item using the category class methods
const jungianFunctionName = instance.getJungianFunctionName(itemKey) || "Unknown Function";
jungianFunctionDetail = `<details><summary>Function</summary>${jungianFunctionName}</details>`;
} catch (error) {
console.error("Error in getCategoryResult:", error);
console.error("Current Item:", item);
}
if (description) {
result += `<details><summary>${terms[index]} ${categoryNames[category].toLowerCase()}: ${description}</summary>${enneagramDetail}${jungianFunctionDetail}</details>`;
}
});
console.log("Constructed Result:", result);
result += '</details>'; // Close the <details> tag opened at the start
return result;
}
function getEnneagramResultSummary() {
let result = '<h3>Enneagram Type Breakdown</h3>';
enneagramTypeRatings.slice(0, 4).forEach((item, index) => {
if(item && item.type) {
result += `<details>`;
result += `<summary>*${terms[index]}: Type ${item.type} (${enneagramTypesInstance.getTypeName(item.type)}) - Score: ${item.rating}</summary>`;
result += getEnneagramResultDetailed(item);
result += `</details>`;
}
});
return result;
}
function getEnneagramResultDetailed(item) {
if(!item || !item.type) return "";
let result = `<details>`;
result += `<summary>${enneagramTypesInstance.getTypeDescription(item.type)}</summary>`;
result += getEnneagramDetailedWithType(item);
result += `</details>`;
return result;
}
function getEnneagramDetailedWithType(item) {
if(!item || !item.type) return "";
let result = `<ul>`;
result += `<li>Core motivation: ${enneagramTypesInstance.getTypeMotivations(item.type)}</li>`;
result += `<li>Core fear: ${enneagramTypesInstance.getTypeFears(item.type)}</li>`;
result += `<li>Core desire: ${enneagramTypesInstance.getTypeDesires(item.type)}</li>`;
result += `<li>Core weakness: ${enneagramTypesInstance.getTypeWeaknesses(item.type)}</li>`;
result += `<li>Core strength: ${enneagramTypesInstance.getTypeStrengths(item.type)}</li>`;
result += `</ul>`;
return result;
}
function getJungianFunctionsResult() {
let result = '<h3>Jungian Function Overview</h3><details><summary>Jungian functions</summary>';
sortedJungianFunctions.forEach(func => {
const functionName = jungianFunctionsInstance.getName(func.function);
const functionDescription = jungianFunctionsInstance.getDescription(func.function);
result += `
<details>
<summary>jungianFunction(${func.function}) Score: ${func.rating} (${functionName})</summary>
${functionDescription}
</details><br>`;
});
result += '</details>';
return result;
}
function displayResults() {
const resultElement = document.getElementById('result');
let resultString = '<h3>Results\n\n<h3>';
resultString += getEnneagramResultSummary();
resultString += getEnneagramResultDetailed();
resultString += getEnneagramDetailedWithType();
categories.forEach(category => {
resultString += getCategoryResult(category);
});
resultString += getJungianFunctionsResult();
resultElement.innerHTML = resultString;
resultElement.classList.remove('hidden');
}
displayResults();
const resetButton = document.getElementById('reset-button');
resetButton.addEventListener('click', resetTest);
function resetTest() {
// 1. Reset the internal state
enneagramTestInstance.userAnswers = {
motivations: [],
fears: [],
desires: [],
weaknesses: [],
strengths: []
};
for (let groupKey in enneagramTestInstance.selectedCount) {
enneagramTestInstance.selectedCount[groupKey] = 0;
}
// 2. Uncheck all checkboxes
document.querySelectorAll('input[type="checkbox"]').forEach(checkbox => {
checkbox.checked = false;
});
// 3. Reset all select elements to default
document.querySelectorAll('select').forEach(select => {
select.selectedIndex = 0;
});
// 4. Clear displayed results
const resultElement = document.getElementById('result');
resultElement.innerHTML = '';
resultElement.classList.add('hidden'); // Assuming you want to hide it again after clearing.
console.log('Test Reset!');
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.