Crystallization Temperature
--
°C
Supercooling (ΔT)
--
K
Degree of Crystallinity
--
%
`);
printWindow.document.close();
printWindow.focus();
printWindow.print();
}// Share Results
function shareResults() {
const shareContainer = document.getElementById('social-share');
shareContainer.scrollIntoView({ behavior: 'smooth' });
}// Social Media Sharing
function shareToSocial(platform) {
if (!lastCalculation) {
showError('Please calculate first to share results');
return;
}
const { results } = lastCalculation;
const tcC = convertTemperature(results.tc, 'K', 'C');
const text = `🧪 Crystallization Temperature: ${tcC.toFixed(1)}°C | Supercooling: ${results.supercooling.toFixed(1)} K | Crystallinity: ${results.crystallinity.toFixed(1)}%`;
const url = window.location.href;
const shareUrls = {
facebook: `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}"e=${encodeURIComponent(text)}`,
x: `https://twitter.com/intent/tweet?text=${encodeURIComponent(text + ' ' + url)}`,
whatsapp: `https://wa.me/?text=${encodeURIComponent(text + ' ' + url)}`,
telegram: `https://t.me/share/url?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}`,
reddit: `https://reddit.com/submit?url=${encodeURIComponent(url)}&title=${encodeURIComponent(text)}`,
pinterest: `https://pinterest.com/pin/create/button/?url=${encodeURIComponent(url)}&description=${encodeURIComponent(text)}`,
linkedin: `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`,
tiktok: `https://www.tiktok.com/upload?caption=${encodeURIComponent(text)}`,
vk: `https://vk.com/share.php?url=${encodeURIComponent(url)}&title=${encodeURIComponent(text)}`,
email: `mailto:?subject=Crystallization Temperature Results&body=${encodeURIComponent(text + '\n\n' + url)}`
};
window.open(shareUrls[platform], '_blank', 'width=600,height=400');
}// Preload Critical Resources
function preloadCriticalResources() {
const criticalImages = [
'data:image/svg+xml,
'
];
criticalImages.forEach(src => {
const img = new Image();
img.src = src;
});
// Preload fonts if available
if ('fonts' in document) {
document.fonts.ready.then(() => {
console.log('Fonts loaded');
});
}
}// Performance monitoring
const observer = new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
if (entry.entryType === 'largest-contentful-paint') {
console.log('LCP:', entry.startTime);
}
}
});
observer.observe({ entryTypes: ['largest-contentful-paint'] });