mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-26 21:04:58 -05:00
36 lines
1.4 KiB
JavaScript
36 lines
1.4 KiB
JavaScript
function toggleMenu() {
|
|
if (document.querySelector('.hamburger').classList.contains('opened')) {
|
|
document.querySelector('.hamburger').classList.remove('opened');
|
|
Array.from(document.querySelectorAll('.menu-visible')).forEach(element => element.classList.remove('menu-visible'));
|
|
} else {
|
|
document.documentElement.style.setProperty('--window-diagonal-size', (Math.floor(Math.sqrt(window.innerWidth ** 2 + window.innerHeight ** 2)) + 100) + 'px');
|
|
document.querySelector('.hamburger').classList.add('opened');
|
|
document.querySelector('.menu').classList.add('menu-visible');
|
|
}
|
|
}
|
|
function notify(message = '', seconds) {
|
|
var notification = document.createElement('div');
|
|
notification.classList = 'notification padding';
|
|
var notificationMessage = document.createElement('h4');
|
|
notificationMessage.innerHTML = message;
|
|
notification.appendChild(notificationMessage);
|
|
var close = document.createElement('h3');
|
|
close.innerHTML = 'X';
|
|
close.onclick = closeNotification;
|
|
notification.appendChild(close);
|
|
document.querySelector('.notification-container').appendChild(notification);
|
|
if (seconds) {
|
|
setTimeout(function(){close.click();}, seconds * 1000)
|
|
}
|
|
}
|
|
function closeNotification(event) {
|
|
var target = event.target.closest('.notification');
|
|
target.classList.add('hidden');
|
|
setTimeout(function(){target.remove();}, 500);
|
|
}
|
|
window.onload = function() {
|
|
Array.from(document.querySelectorAll('input')).forEach(element => {
|
|
element.autocomplete = 'off';
|
|
});
|
|
}
|