mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-22 10:55:15 -04:00
Make JS in HTML templates more consistent
This commit is contained in:
parent
9aba36fce5
commit
e8f8c47dbd
1 changed files with 13 additions and 13 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue