99 lines
2.9 KiB
JavaScript
99 lines
2.9 KiB
JavaScript
// GLOBAL VARS
|
|
let Warning = document.getElementsByClassName("WarningMessage")[0];
|
|
let Main = document.getElementsByClassName("Main")[0];
|
|
|
|
let BrowserWidth = window.innerWidth;
|
|
let BrowserHeight = window.innerHeight;
|
|
|
|
// fuck you. I see why website developers use divs so fucking often.
|
|
let Arrows = document.getElementsByClassName("Arrow");
|
|
let ContainerContainer = document.getElementsByClassName("PostContainerContainer")[0];
|
|
|
|
// Sounds
|
|
const ButtonSound = new Audio("Audio/button-305770.mp3");
|
|
const WarningClick = new Audio("Audio/button-pressed-38129.mp3");
|
|
const BackgroundMusic = new Audio("Audio/soft-piano-music-312509.mp3");
|
|
|
|
// Update a timer
|
|
function UpdateTime() {
|
|
var TimeNow = new Date();
|
|
var Hour = TimeNow.getHours();
|
|
var Minute = TimeNow.getMinutes();
|
|
|
|
var WebsiteTime = document.getElementsByClassName("Time")[0]
|
|
WebsiteTime.innerHTML = "";
|
|
if (Hour < 10) {
|
|
WebsiteTime.innerHTML = WebsiteTime.innerHTML + "0" + Hour;
|
|
} else {
|
|
WebsiteTime.innerHTML = WebsiteTime.innerHTML + Hour;
|
|
}
|
|
WebsiteTime.innerHTML = WebsiteTime.innerHTML + ":";
|
|
if (Minute < 10) {
|
|
WebsiteTime.innerHTML = WebsiteTime.innerHTML + "0" + Minute;
|
|
} else {
|
|
WebsiteTime.innerHTML = WebsiteTime.innerHTML + Minute;
|
|
}
|
|
}
|
|
|
|
setInterval(UpdateTime, 1000);
|
|
|
|
// When the window is resized.
|
|
onresize = (event) => {
|
|
BrowserWidth = window.innerWidth;
|
|
BrowserHeight = window.innerHeight;
|
|
Start();
|
|
};
|
|
|
|
// When the <body> tag is done loading all it's elements
|
|
function Start() {
|
|
Warning.setAttribute("style", "height: " + BrowserHeight + "px; width: " + BrowserWidth + "px;");
|
|
Main.setAttribute("style", "height: " + BrowserHeight + "px; width: " + BrowserWidth + "px;");
|
|
Arrows[1].setAttribute("style", "left: " + (BrowserWidth - 100) + "px;");
|
|
}
|
|
|
|
// On clicking the warning message
|
|
function WarningFade() {
|
|
Warning.classList.add("WarningFadeOutAnimation");
|
|
// fixes a damn stupid bug
|
|
document.getElementsByClassName("BlinkAnimation")[0].classList.remove("BlinkAnimation");
|
|
Main.classList.add("MainFadeInAnimation");
|
|
Main.classList.remove("Main");
|
|
WarningClick.play();
|
|
setTimeout(() => {
|
|
Main.classList.remove("MainFadeInAnimation");
|
|
BackgroundMusic.play();
|
|
}, 5000);
|
|
Main = document.getElementsByClassName("MainFadeInAnimation")[0];
|
|
}
|
|
|
|
// Clicking the next button
|
|
function Next() {
|
|
if (!ContainerContainer.classList.contains("NextAnimation")) {
|
|
ContainerContainer.classList.add("NextAnimation");
|
|
ButtonSound.play();
|
|
console.log("loading next posts...");
|
|
setTimeout(() => {
|
|
ContainerContainer.classList.remove("NextAnimation");
|
|
}, 1000);
|
|
}
|
|
}
|
|
|
|
// Clicking the back button
|
|
function Back() {
|
|
if (!ContainerContainer.classList.contains("BackAnimation")) {
|
|
ContainerContainer.classList.add("BackAnimation");
|
|
ButtonSound.play();
|
|
console.log("getting previous posts...");
|
|
setTimeout(() => {
|
|
ContainerContainer.classList.remove("BackAnimation");
|
|
}, 1000);
|
|
}
|
|
}
|
|
|
|
function Setting() {
|
|
window.location.href = "setting.html";
|
|
}
|
|
|
|
function Mail() {
|
|
window.location.href = "mail.html";
|
|
}
|