Files
cardconjurer/js/main-1.js
2020-12-29 10:32:59 -08:00

33 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 = '') {
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);
}
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';
});
}