Make JS in HTML templates more consistent

pull/896/head
Oleksii Holub 2 years ago
parent 9aba36fce5
commit e8f8c47dbd

@ -725,18 +725,17 @@
<script> <script>
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.chatlog__sticker--media[data-source]').forEach(e => { document.querySelectorAll('.chatlog__sticker--media[data-source]').forEach(e => {
const imageDataUrl = e.getAttribute('data-source');
const anim = lottie.loadAnimation({ const anim = lottie.loadAnimation({
container: e, container: e,
renderer: 'svg', renderer: 'svg',
loop: true, loop: true,
autoplay: true, autoplay: true,
path: imageDataUrl path: e.getAttribute('data-source')
}); });
anim.addEventListener('data_failed', () => anim.addEventListener(
e.innerHTML = '<strong>[Sticker cannot be rendered]</strong>' 'data_failed',
() => e.innerHTML = '<strong>[Sticker cannot be rendered]</strong>'
); );
}); });
}); });
@ -745,7 +744,7 @@
@{/* Scripts */} @{/* Scripts */}
<script> <script>
function scrollToMessage(event, id) { function scrollToMessage(event, id) {
var element = document.getElementById('chatlog__message-container-' + id); const element = document.getElementById('chatlog__message-container-' + id);
if (!element) if (!element)
return; return;
@ -757,9 +756,10 @@
behavior: 'smooth' behavior: 'smooth'
}); });
window.setTimeout(function() { window.setTimeout(
element.classList.remove('chatlog__message-container--highlighted'); () => element.classList.remove('chatlog__message-container--highlighted'),
}, 2000); 2000
);
} }
function showSpoiler(event, element) { function showSpoiler(event, element) {

Loading…
Cancel
Save