Mein Tages-Anker – NeelixberliN
🔒 Deine Privatsphäre ist geschützt: Was du hier schreibst, bleibt zu 100% bei dir.
Deine IP-Adresse bekommt hier zudem eine Maske. Die Daten werden nur einmalig und verschlüsselt
an meine KI-Schnittstelle zum Reagieren geschickt. Dein NeelixberliN ❤️
`);
printWindow.document.close();
printWindow.print();
}
};
// Email functionality
const emailPlan = (elementClass, subject) => {
const element = document.querySelector(elementClass);
if (element) {
const content = element.textContent;
const mailtoLink = `mailto:?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(content)}`;
window.location.href = mailtoLink;
}
};
// Download functionality
const downloadPlan = (elementClass, filename) => {
const element = document.querySelector(elementClass);
if (element) {
const content = element.textContent;
const blob = new Blob([content], { type: 'text/plain;charset=utf-8' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = filename + '_' + new Date().toISOString().split('T')[0] + '.txt';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
};
// Add event listeners to export buttons
const exportButtons = document.querySelectorAll('.export-button');
exportButtons.forEach((button, index) => {
button.addEventListener('click', function() {
const isEmergencyPlan = this.closest('.neelix-emergency-result') !== null;
const targetClass = isEmergencyPlan ? '.neelix-emergency-result' : '.neelix-daily-plan';
const filename = isEmergencyPlan ? 'Notfallplan' : 'Tagesplan';
const subject = isEmergencyPlan ? 'Mein Notfallplan' : 'Mein Tagesplan';
switch (index % 4) {
case 0: // Print
printPlan(targetClass);
break;
case 1: // Email
emailPlan(targetClass, subject);
break;
case 2: // Download
downloadPlan(targetClass, filename);
break;
case 3: // Copy
if (isEmergencyPlan) {
copyEmergencyPlan();
} else {
// Copy daily plan
const element = document.querySelector(targetClass);
if (element) {
navigator.clipboard.writeText(element.textContent);
}
}
break;
}
// Visual feedback
const originalText = this.innerHTML;
this.innerHTML = this.innerHTML.replace(/🖨️|✉️|💾|📋/, '✅');
setTimeout(() => {
this.innerHTML = originalText;
}, 2000);
});
});
// Smooth scrolling for navigation
const scrollButtons = document.querySelectorAll('button[class*="emergency"], button[class*="back"]');
scrollButtons.forEach(button => {
button.addEventListener('click', function() {
if (this.textContent.includes('Notfallplan')) {
// Scroll to emergency section
const emergencySection = document.querySelector('.neelix-emergency-section:last-of-type');
if (emergencySection) {
emergencySection.scrollIntoView({ behavior: 'smooth' });
}
} else if (this.textContent.includes('Zurück')) {
// Scroll to top
window.scrollTo({ top: 0, behavior: 'smooth' });
}
});
});
// Character counter for textareas
const textareas = document.querySelectorAll('textarea');
textareas.forEach(textarea => {
const counter = document.createElement('div');
counter.className = 'neelix-char-counter';
counter.style.cssText = 'text-align: right; font-size: 12px; color: #9CA3AF; margin-top: 5px;';
textarea.parentNode.insertBefore(counter, textarea.nextSibling);
const updateCounter = () => {
const count = textarea.value.length;
const maxLength = 1000;
counter.textContent = `${count} / ${maxLength} Zeichen`;
if (count > maxLength * 0.9) counter.style.color = '#ef4444';
else if (count > maxLength * 0.7) counter.style.color = '#f59e0b';
else counter.style.color = '#9CA3AF';
};
textarea.addEventListener('input', updateCounter);
updateCounter();
});
// Generate timestamp for emergency plan
const updateTimestamp = () => {
const now = new Date();
const timestamp = now.toLocaleString('de-DE');
const timestampElement = document.querySelector('.neelix-emergency-result h3');
if (timestampElement) {
timestampElement.textContent = `🚨 MEIN PERSÖNLICHER NOTFALLPLAN - ${timestamp}`;
}
};
// Update timestamp when emergency plan is created
const saveButton = document.querySelector('button.save');
if (saveButton) {
saveButton.addEventListener('click', updateTimestamp);
}
});