Use global animation duration for avatars

This commit is contained in:
Cohee 2024-04-14 20:27:01 +03:00
parent 1de409fdf7
commit a899160311

View File

@ -10213,8 +10213,9 @@ jQuery(async function () {
const avatarSrc = isDataURL(thumbURL) ? thumbURL : charsPath + targetAvatarImg;
if ($(`.zoomed_avatar[forChar="${charname}"]`).length) {
console.debug('removing container as it already existed');
$(`.zoomed_avatar[forChar="${charname}"]`).fadeOut();
setTimeout(function() { $(`.zoomed_avatar[forChar="${charname}"]`).remove(); }, 410);
$(`.zoomed_avatar[forChar="${charname}"]`).fadeOut(animation_duration, () => {
$(`.zoomed_avatar[forChar="${charname}"]`).remove();
});
} else {
console.debug('making new container from template');
const template = $('#zoomed_avatar_template').html();
@ -10225,7 +10226,7 @@ jQuery(async function () {
newElement.find('.drag-grabber').attr('id', `zoomFor_${charname}header`);
$('body').append(newElement);
newElement.fadeIn();
newElement.fadeIn(animation_duration);
const zoomedAvatarImgElement = $(`.zoomed_avatar[forChar="${charname}"] img`);
if (messageElement.attr('is_user') == 'true' || (messageElement.attr('is_system') == 'true' && !isValidCharacter)) { //handle user and system avatars
zoomedAvatarImgElement.attr('src', thumbURL);
@ -10245,8 +10246,9 @@ jQuery(async function () {
if (e.target.closest('.drag-grabber')) {
return;
}
$(`.zoomed_avatar[forChar="${charname}"]`).fadeOut();
setTimeout(function() { $(`.zoomed_avatar[forChar="${charname}"]`).remove(); }, 410);
$(`.zoomed_avatar[forChar="${charname}"]`).fadeOut(animation_duration, () => {
$(`.zoomed_avatar[forChar="${charname}"]`).remove();
});
});
zoomedAvatarImgElement.on('dragstart', (e) => {