Initial Bioportal Lab prototype
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
const toast = document.querySelector('.toast');
|
||||
let timer;
|
||||
|
||||
function showToast(message) {
|
||||
toast.textContent = message;
|
||||
toast.classList.add('show');
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => toast.classList.remove('show'), 2600);
|
||||
}
|
||||
|
||||
document.querySelectorAll('[data-toast]').forEach((button) => {
|
||||
button.addEventListener('click', () => showToast(button.dataset.toast));
|
||||
});
|
||||
|
||||
const modal = document.querySelector('#experiment-modal');
|
||||
document.querySelectorAll('[data-modal="experiment"]').forEach((button) => {
|
||||
button.addEventListener('click', () => modal.showModal());
|
||||
});
|
||||
|
||||
document.querySelectorAll('[data-tool]').forEach((button) => {
|
||||
button.addEventListener('click', () => showToast(`Демо «${button.dataset.tool}» будет доступно в следующем экране.`));
|
||||
});
|
||||
|
||||
document.querySelectorAll('[data-route]').forEach((button) => {
|
||||
button.addEventListener('click', () => { window.location.href = button.dataset.route; });
|
||||
});
|
||||
|
||||
modal.addEventListener('close', () => {
|
||||
if (modal.returnValue === 'default') showToast('Эксперимент создан в демо-режиме.');
|
||||
});
|
||||
|
||||
document.querySelector('.mobile-menu').addEventListener('click', () => {
|
||||
showToast('Мобильное меню будет добавлено вместе с внутренними страницами.');
|
||||
});
|
||||
Reference in New Issue
Block a user