Changed around line 1
+ document.addEventListener('DOMContentLoaded', function() {
+ const rangeInputs = document.querySelectorAll('input[type="range"]');
+ const calculateBtn = document.getElementById('calculateBtn');
+ const result = document.getElementById('result');
+
+ // Update range input values
+ rangeInputs.forEach(input => {
+ const valueDisplay = document.getElementById(`${input.id}Value`);
+ input.addEventListener('input', () => {
+ valueDisplay.textContent = input.value;
+ });
+ });
+
+ calculateBtn.addEventListener('click', calculateDecision);
+
+ function calculateDecision() {
+ const yearsLeft = parseInt(document.getElementById('yearsLeft').value);
+ const stipend = parseInt(document.getElementById('stipend').value);
+ const satisfaction = parseInt(document.getElementById('satisfaction').value);
+ const followers = parseInt(document.getElementById('followers').value);
+ const marketability = parseInt(document.getElementById('marketability').value);
+ const comfort = parseInt(document.getElementById('comfort').value);
+
+ // Calculate PhD score (0-100)
+ const phdScore = calculatePhDScore(yearsLeft, stipend, satisfaction);
+
+ // Calculate OF score (0-100)
+ const ofScore = calculateOFScore(followers, marketability, comfort);
+
+ // Calculate final recommendation
+ const recommendationScore = (ofScore - phdScore + 100) / 2;
+
+ displayResults(recommendationScore, phdScore, ofScore);
+ }
+
+ function calculatePhDScore(years, stipend, satisfaction) {
+ const yearsFactor = Math.max(0, 100 - (years * 10));
+ const stipendFactor = Math.min(100, (stipend / 50000) * 100);
+ const satisfactionFactor = satisfaction * 10;
+
+ return (yearsFactor + stipendFactor + satisfactionFactor) / 3;
+ }
+
+ function calculateOFScore(followers, marketability, comfort) {
+ const followersFactor = Math.min(100, (followers / 10000) * 100);
+ const marketabilityFactor = marketability * 10;
+ const comfortFactor = comfort * 10;
+
+ return (followersFactor + marketabilityFactor + comfortFactor) / 3;
+ }
+
+ function displayResults(score, phdScore, ofScore) {
+ result.classList.remove('hidden');
+
+ // Animate gauge fill
+ const gaugeFill = document.querySelector('.gauge-fill');
+ gaugeFill.style.height = `${score}%`;
+
+ // Set recommendation text
+ const recommendationText = document.getElementById('recommendationText');
+ if (score < 40) {
+ recommendationText.textContent = "Stick with your PhD! The academic path looks promising for you.";
+ } else if (score < 60) {
+ recommendationText.textContent = "It's a close call! Consider exploring content creation as a side hustle while continuing your PhD.";
+ } else {
+ recommendationText.textContent = "The numbers suggest content creation might be your calling!";
+ }
+
+ // Display factors
+ const factorsList = document.getElementById('factorsList');
+ factorsList.innerHTML = `
+
PhD Potential Score: ${phdScore.toFixed(1)}/100+
Content Creation Potential Score: ${ofScore.toFixed(1)}/100+
Years to Completion Impact: ${score < 50 ? 'Manageable' : 'Significant'}+
Financial Outlook: ${ofScore > phdScore ? 'Favors content creation' : 'Favors academia'}+ `;
+
+ // Smooth scroll to results
+ result.scrollIntoView({ behavior: 'smooth' });
+ }
+ });