Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
CardosoGuiVi authored Dec 31, 2024
1 parent c8590d6 commit 9bee707
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ import { ref, onValue } from "https://www.gstatic.com/firebasejs/11.1.0/firebase

const container = document.getElementById("container");
const logo = document.getElementById("logo");
const message = document.getElementById("message"); // Novo elemento para mensagem

onValue(ref(db, 'settings'), (snapshot) => {
const data = snapshot.val();
if (data) {
const animation = data.animation;
const customMessage = data.message;

container.style.backgroundColor = '';
container.classList.remove('blink');
logo.style.display = 'none';
message.style.display = 'none';
message.textContent = '';

if (animation === "blackout") {
container.style.backgroundColor = "#000";
Expand All @@ -23,6 +27,12 @@ onValue(ref(db, 'settings'), (snapshot) => {
document.documentElement.style.setProperty('--color2', data.color2 || 'black');
document.documentElement.style.setProperty('--blink-time', (data.blinkTime || 1) + 's');
container.classList.add('blink');

if (customMessage) {
message.textContent = customMessage;
message.style.display = 'flex';
message.style.color = data.textColor || 'white';
}
}
}
});

0 comments on commit 9bee707

Please sign in to comment.