Download script.js from AlbertRenzo/python-pathfinder-code-your-way-up: direct link, hf CLI and curl.
- Browser
- Download file 2.89 kB
-
https://huggingface.co/spaces/AlbertRenzo/python-pathfinder-code-your-way-up/resolve/main/script.js
- Command line
-
hf download hf://spaces/AlbertRenzo/python-pathfinder-code-your-way-up/script.js
-
curl -L -o script.js https://huggingface.co/spaces/AlbertRenzo/python-pathfinder-code-your-way-up/resolve/main/script.js
2.89 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize all tooltips | |
| const tooltipTriggers = document.querySelectorAll('[data-tooltip]'); | |
| tooltipTriggers.forEach(trigger => { | |
| const tooltip = document.createElement('div'); | |
| tooltip.className = 'tooltip hidden absolute z-10 bg-gray-800 text-white text-xs rounded py-1 px-2'; | |
| tooltip.textContent = trigger.getAttribute('data-tooltip'); | |
| trigger.appendChild(tooltip); | |
| trigger.addEventListener('mouseenter', () => { | |
| tooltip.classList.remove('hidden'); | |
| }); | |
| trigger.addEventListener('mouseleave', () => { | |
| tooltip.classList.add('hidden'); | |
| }); | |
| }); | |
| // Assessment form handling | |
| const assessmentForm = document.getElementById('assessment-form'); | |
| if (assessmentForm) { | |
| assessmentForm.addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| // Calculate score | |
| let score = 0; | |
| const answers = document.querySelectorAll('input[type="radio"]:checked'); | |
| answers.forEach(answer => { | |
| score += parseInt(answer.value); | |
| }); | |
| // Determine learning path | |
| const resultsDiv = document.getElementById('results'); | |
| const resultText = document.getElementById('result-text'); | |
| const startLearningBtn = document.getElementById('start-learning'); | |
| let path = ''; | |
| if (score <= 3) { | |
| path = 'beginner'; | |
| resultText.textContent = 'Based on your results, we recommend starting with our Beginner Python track. This will cover fundamentals before moving to Java integration and CS concepts.'; | |
| startLearningBtn.href = '/beginner.html'; | |
| } else if (score <= 6) { | |
| path = 'intermediate'; | |
| resultText.textContent = 'You have some Python knowledge! We recommend our Intermediate track which focuses on object-oriented programming and basic Java integration.'; | |
| startLearningBtn.href = '/intermediate.html'; | |
| } else { | |
| path = 'advanced'; | |
| resultText.textContent = 'Great job! You have strong Python skills. We recommend our Advanced track focusing on Python-Java interoperability and advanced CS concepts.'; | |
| startLearningBtn.href = '/advanced.html'; | |
| } | |
| // Store learning path in localStorage | |
| localStorage.setItem('learningPath', path); | |
| // Show results with animation | |
| resultsDiv.classList.remove('hidden'); | |
| resultsDiv.classList.add('fade-in'); | |
| // Scroll to results | |
| resultsDiv.scrollIntoView({ behavior: 'smooth' }); | |
| }); | |
| } | |
| }); |