function adjustTextSize(size) { const baseSize = parseInt(size); document.body.style.fontSize = baseSize + 'px'; } function toggleOpenDyslexic() { var article = document.getElementById('article'); article.classList.toggle('dyslexic'); } // Function to toggle background color for the article function toggleAccessibleBackground() { var article = document.getElementById('article'); if (article.style.backgroundColor === 'rgb(234, 251, 251)') { article.style.backgroundColor = 'white'; } else { article.style.backgroundColor = 'rgb(234, 251, 251)'; } } function openDialog(event, dialogId) { var dialog = document.getElementById(dialogId); dialog.style.display = 'block'; var rect = event.target.getBoundingClientRect(); var dialogHeight = dialog.offsetHeight; var dialogWidth = dialog.offsetWidth; var top = rect.top + window.scrollY + rect.height / 2 - dialogHeight / 2; var left = rect.left + window.scrollX + rect.width / 2 - dialogWidth / 2; if (top + dialogHeight > window.innerHeight) { top = window.innerHeight - dialogHeight - 20; } if (left + dialogWidth > window.innerWidth) { left = window.innerWidth - dialogWidth - 20; } dialog.style.top = top + 'px'; dialog.style.left = left + 'px'; } function closeDialog(dialogId) { var dialog = document.getElementById(dialogId); dialog.style.display = 'none'; }