37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
document.addEventListener('DOMContentLoaded', function () {
|
|
var messageStream = document.getElementById('messageStream');
|
|
if (messageStream) {
|
|
messageStream.scrollTop = messageStream.scrollHeight;
|
|
}
|
|
|
|
var toggles = document.querySelectorAll('.edit-toggle, .edit-cancel');
|
|
toggles.forEach(function (button) {
|
|
button.addEventListener('click', function () {
|
|
var targetId = button.getAttribute('data-target');
|
|
var target = document.getElementById(targetId);
|
|
if (target) {
|
|
target.classList.toggle('hidden');
|
|
}
|
|
});
|
|
});
|
|
|
|
var fileInputs = document.querySelectorAll('.file-label input[type="file"]');
|
|
fileInputs.forEach(function (input) {
|
|
input.addEventListener('change', function () {
|
|
var label = input.parentElement.querySelector('span');
|
|
if (label && input.files && input.files.length > 0) {
|
|
label.textContent = input.files[0].name;
|
|
}
|
|
});
|
|
});
|
|
|
|
var floatingAlerts = document.querySelectorAll('.alert.floating');
|
|
floatingAlerts.forEach(function (alert) {
|
|
window.setTimeout(function () {
|
|
alert.style.opacity = '0';
|
|
alert.style.transform = 'translateY(-6px)';
|
|
alert.style.transition = 'opacity 250ms ease, transform 250ms ease';
|
|
}, 3500);
|
|
});
|
|
});
|