Changed around line 1
+ const questions = [
+ {
+ question: "What excites you most?",
+ options: [
+ { text: "Solving medical mysteries", value: "medical-imaging" },
+ { text: "Understanding complex systems", value: "complex-systems" },
+ { text: "Creating realistic simulations", value: "simulation" },
+ { text: "Developing life-changing medical aids", value: "medical-aid" }
+ ]
+ },
+ {
+ question: "What's your preferred work environment?",
+ options: [
+ { text: "Laboratory", value: "medical-imaging" },
+ { text: "Field work", value: "complex-systems" },
+ { text: "Computer-based", value: "simulation" },
+ { text: "Clinical setting", value: "medical-aid" }
+ ]
+ }
+ ];
+
+ const fieldDescriptions = {
+ "medical-imaging": {
+ title: "Medical Imaging Recognition",
+ description: "Focus on developing advanced algorithms for medical image analysis and diagnosis."
+ },
+ "complex-systems": {
+ title: "Complex System Study",
+ description: "Explore the behavior of complex systems across various disciplines."
+ },
+ "simulation": {
+ title: "System Simulation Study",
+ description: "Develop and analyze system simulations for various applications."
+ },
+ "medical-aid": {
+ title: "Socially Beneficial Medical Aid Engineering",
+ description: "Design and develop medical aids that improve quality of life."
+ }
+ };
+
+ let currentQuestion = 0;
+ let userSelections = {};
+
+ function updateProgress() {
+ const progress = (currentQuestion / questions.length) * 100;
+ document.querySelector('.progress').style.width = `${progress}%`;
+ }
+
+ function showResults() {
+ const resultsSection = document.querySelector('.results');
+ const resultCards = document.querySelector('.result-cards');
+
+ // Clear previous results
+ resultCards.innerHTML = '';
+
+ // Calculate scores
+ const scores = Object.keys(userSelections).reduce((acc, key) => {
+ userSelections[key].forEach(value => {
+ acc[value] = (acc[value] || 0) + 1;
+ });
+ return acc;
+ }, {});
+
+ // Sort fields by score
+ const sortedFields = Object.entries(scores)
+ .sort((a, b) => b[1] - a[1])
+ .map(([key]) => key);
+
+ // Display top 3 results
+ sortedFields.slice(0, 3).forEach(field => {
+ const card = document.createElement('div');
+ card.className = 'result-card';
+ card.innerHTML = `
+
${fieldDescriptions[field].title} +
${fieldDescriptions[field].description}
+ `;
+ resultCards.appendChild(card);
+ });
+
+ resultsSection.classList.remove('hidden');
+ }
+
+ function handleOptionClick(value) {
+ if (!userSelections[currentQuestion]) {
+ userSelections[currentQuestion] = [];
+ }
+ userSelections[currentQuestion].push(value);
+
+ currentQuestion++;
+ if (currentQuestion < questions.length) {
+ renderQuestion();
+ } else {
+ showResults();
+ }
+ updateProgress();
+ }
+
+ function renderQuestion() {
+ const questionContainer = document.querySelector('.question');
+ const currentQ = questions[currentQuestion];
+
+ questionContainer.innerHTML = `
+
${currentQ.question} +
+ ${currentQ.options.map(option => `
+ ${option.text}
+ `).join('')}
+
+ `;
+
+ document.querySelectorAll('.options button').forEach(button => {
+ button.addEventListener('click', () => handleOptionClick(button.dataset.value));
+ });
+ }
+
+ // Initialize
+ document.addEventListener('DOMContentLoaded', () => {
+ renderQuestion();
+
+ // University search functionality
+ document.getElementById('search-btn').addEventListener('click', () => {
+ const searchTerm = document.getElementById('university-search').value;
+ // Implement university search logic here
+ console.log(`Searching for: ${searchTerm}`);
+ });
+ });