mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Assorted SD fixes
This commit is contained in:
@ -9055,19 +9055,12 @@ jQuery(async function () {
|
||||
});
|
||||
|
||||
$(document).on('click', '.mes .avatar', function () {
|
||||
|
||||
//console.log(isMobile());
|
||||
//console.log($('body').hasClass('waifuMode'));
|
||||
|
||||
/* if (isMobile() === true && !$('body').hasClass('waifuMode')) {
|
||||
console.debug('saw mobile regular mode, returning');
|
||||
return;
|
||||
} else { console.debug('saw valid env for zoomed display') } */
|
||||
|
||||
let thumbURL = $(this).children('img').attr('src');
|
||||
let charsPath = '/characters/'
|
||||
let targetAvatarImg = thumbURL.substring(thumbURL.lastIndexOf("=") + 1);
|
||||
let charname = targetAvatarImg.replace('.png', '');
|
||||
const messageElement = $(this).closest('.mes');
|
||||
const thumbURL = $(this).children('img').attr('src');
|
||||
const charsPath = '/characters/'
|
||||
const targetAvatarImg = thumbURL.substring(thumbURL.lastIndexOf("=") + 1);
|
||||
const charname = targetAvatarImg.replace('.png', '');
|
||||
const isValidCharacter = characters.some(x => x.avatar === targetAvatarImg);
|
||||
|
||||
// Remove existing zoomed avatars for characters that are not the clicked character when moving UI is not enabled
|
||||
if (!power_user.movingUI) {
|
||||
@ -9080,7 +9073,7 @@ jQuery(async function () {
|
||||
});
|
||||
}
|
||||
|
||||
let avatarSrc = isDataURL(thumbURL) ? thumbURL : charsPath + targetAvatarImg;
|
||||
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}"]`).remove();
|
||||
@ -9094,11 +9087,11 @@ jQuery(async function () {
|
||||
newElement.find('.drag-grabber').attr('id', `zoomFor_${charname}header`);
|
||||
|
||||
$('body').append(newElement);
|
||||
if ($(this).parent().parent().attr('is_user') == 'true') { //handle user avatars
|
||||
if (messageElement.attr('is_user') == 'true') { //handle user avatars
|
||||
$(`.zoomed_avatar[forChar="${charname}"] img`).attr('src', thumbURL);
|
||||
} else if ($(this).parent().parent().attr('is_system') == 'true') { //handle system avatars
|
||||
} else if (messageElement.attr('is_system') == 'true' && !isValidCharacter) { //handle system avatars
|
||||
$(`.zoomed_avatar[forChar="${charname}"] img`).attr('src', thumbURL);
|
||||
} else if ($(this).parent().parent().attr('is_user') == 'false') { //handle char avatars
|
||||
} else if (messageElement.attr('is_user') == 'false') { //handle char avatars
|
||||
$(`.zoomed_avatar[forChar="${charname}"] img`).attr('src', avatarSrc);
|
||||
}
|
||||
loadMovingUIState();
|
||||
|
Reference in New Issue
Block a user