This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
ebgamesreal-live/index.js
2020-04-11 03:13:37 -05:00

61 lines
2 KiB
JavaScript

let textIndex = 1;
const textArray = [
"Hey guys, welcome to EB Games Real (dot) Live! (click to advance)",
"Feel free to browse our very real website, check out our links, and enjoy the experience.",
"Here at EB Games, we are hard at work planning and creating updates, so check back often!",
"You might even find some things you didn't notice before.",
"Thank you for choosing EB Games!",
];
const checkFadeInFinished = async function () {
const ebgamesguySpeech = document.getElementById(
"ebgamesguy-txt-speech-container"
);
await new Promise((resolve) => setTimeout(resolve, 15000));
if (ebgamesguySpeech.id) {
console.log("We did it");
ebgamesguySpeech.id = "";
}
};
const showSpeech = function () {
const ebgamesguy = document.getElementById("ebgamesguy");
const ebgamesguySpeech = document.getElementById(
"ebgamesguy-txt-speech-container"
);
const ebgamesguyTxt = document.getElementById("ebgamesguy-txt");
if (!ebgamesguy.style.display) {
ebgamesguy.style.display = "flex";
}
ebgamesguy.addEventListener("click", function () {
if (textIndex < textArray.length) {
if (textIndex == 1 && ebgamesguySpeech.id) {
ebgamesguySpeech.id = "";
ebgamesguy.id = "";
} else {
ebgamesguyTxt.innerHTML = textArray[textIndex];
textIndex = textIndex + 1;
}
} else {
ebgamesguySpeech.style.display = "none";
ebgamesguy.id = "ebgamesguy-done";
}
});
checkFadeInFinished();
};
setSpecialPromo = function () {
const specialPromo = document.getElementById("special-promo");
specialPromo.addEventListener("click", function () {
alert("Sorry! There are no special promotions running at this time. Please follow https://gamestop.store/@ebgamesguy for updates on our current promotions and sales!")
});
};
window.addEventListener("load", function () {
console.log("Hello, world!");
const ebgamesguyTxt = document.getElementById("ebgamesguy-txt");
ebgamesguyTxt.innerHTML = textArray[0];
showSpeech();
setSpecialPromo();
});