let goalNode = document.getElementById('donationgoal');
let nameText = document.getElementById('name');
let rangeText = document.getElementById('range');

window.addEventListener('message', function (event) {
    let message = event.detail;
    let data = message.data;

    let percent = ((data.value / data.goal) * 100);
    if (percent > 100) {percent = 100;}

    nameText.textContent = data.title;
    goalNode.style.setProperty('--progress', `${percent}%`);
});
