Refactor main.js

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2024-05-14 21:06:39 +05:00
parent c9eac6b561
commit 3709d6d6ad
Signed by: mctaylors
GPG key ID: 7181BEBE676903C1
3 changed files with 13 additions and 15 deletions

View file

@ -1,28 +1,26 @@
const root = document.documentElement;
const dialogElement = document.getElementById('dialog');
const detailsElement = document.getElementById('details');
const dialogContentElement = document.getElementById('dialog-content');
const errorSoundElement = document.getElementById('error');
const clickSoundElement = document.getElementById('click');
window.onload = function() {
setTimeout(function () {
play("error");
errorSoundElement.play();
}, 1000)
}
const getStyleProperty = (s, p) => getComputedStyle(s).getPropertyValue(p);
function play(audioId) {
let audioElement = document.getElementById(audioId);
audioElement.play();
}
function close_button(href) {
play("click");
clickSoundElement.play();
window.location.href = href;
}
function details_button() {
play("click");
document.getElementById('dialog-content').style.opacity = '0';
let root = document.documentElement;
let dialogElement = document.getElementById('dialog');
let detailsElement = document.getElementById('details');
clickSoundElement.play();
dialogContentElement.style.opacity = '0';
dialogElement.animate([
{