|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
|
|
const ctx = document.getElementById('rainbowChart').getContext('2d'); |
|
|
const rainbowChart = new Chart(ctx, { |
|
|
type: 'line', |
|
|
data: { |
|
|
labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], |
|
|
datasets: [ |
|
|
{ |
|
|
label: 'Rainbow Intensity', |
|
|
data: [12, 19, 3, 17, 6, 3, 20], |
|
|
backgroundColor: 'rgba(255, 99, 132, 0.2)', |
|
|
borderColor: 'rgba(255, 99, 132, 1)', |
|
|
borderWidth: 2, |
|
|
tension: 0.4 |
|
|
}, |
|
|
{ |
|
|
label: 'Magic Sparkles', |
|
|
data: [2, 9, 13, 7, 16, 13, 10], |
|
|
backgroundColor: 'rgba(54, 162, 235, 0.2)', |
|
|
borderColor: 'rgba(54, 162, 235, 1)', |
|
|
borderWidth: 2, |
|
|
tension: 0.4 |
|
|
} |
|
|
] |
|
|
}, |
|
|
options: { |
|
|
responsive: true, |
|
|
maintainAspectRatio: false, |
|
|
scales: { |
|
|
y: { |
|
|
beginAtZero: true, |
|
|
grid: { |
|
|
color: 'rgba(0, 0, 0, 0.05)' |
|
|
} |
|
|
}, |
|
|
x: { |
|
|
grid: { |
|
|
color: 'rgba(0, 0, 0, 0.05)' |
|
|
} |
|
|
} |
|
|
}, |
|
|
plugins: { |
|
|
legend: { |
|
|
labels: { |
|
|
font: { |
|
|
family: "'Comic Sans MS', cursive, sans-serif" |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
const petButton = document.querySelector('button'); |
|
|
petButton.addEventListener('click', function() { |
|
|
const messages = [ |
|
|
"The unicorn nuzzles you affectionately!", |
|
|
"Sparkles fly everywhere! ✨", |
|
|
"The unicorn does a happy dance!", |
|
|
"You hear magical chimes in the distance..." |
|
|
]; |
|
|
const randomMessage = messages[Math.floor(Math.random() * messages.length)]; |
|
|
|
|
|
alert(randomMessage); |
|
|
}); |
|
|
}); |