mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-26 21:04:58 -05:00
notifications
This commit is contained in:
32
js/main-1.js
Normal file
32
js/main-1.js
Normal file
@@ -0,0 +1,32 @@
|
||||
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';
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user