mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Default expressions for groups
This commit is contained in:
@ -247,16 +247,27 @@ async function setExpression(character, expression, force) {
|
|||||||
const imgUrl = `/characters/${character}/${filename}`;
|
const imgUrl = `/characters/${character}/${filename}`;
|
||||||
img.attr('src', imgUrl);
|
img.attr('src', imgUrl);
|
||||||
img.removeClass('default');
|
img.removeClass('default');
|
||||||
|
img.off('error');
|
||||||
|
img.on('error', function() {
|
||||||
|
$(this).attr('src', '');
|
||||||
|
if (force && extension_settings.expressions.showDefault) {
|
||||||
|
setDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
if (extension_settings.expressions.showDefault) {
|
if (extension_settings.expressions.showDefault) {
|
||||||
//console.log('no character images, trying default expressions');
|
//console.log('no character images, trying default expressions');
|
||||||
|
setDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setDefault() {
|
||||||
const defImgUrl = `/img/default-expressions/${filename}`;
|
const defImgUrl = `/img/default-expressions/${filename}`;
|
||||||
//console.log(defImgUrl);
|
//console.log(defImgUrl);
|
||||||
img.attr('src', defImgUrl);
|
img.attr('src', defImgUrl);
|
||||||
img.addClass('default');
|
img.addClass('default');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function onClickExpressionImage() {
|
function onClickExpressionImage() {
|
||||||
// online mode doesn't need force set
|
// online mode doesn't need force set
|
||||||
@ -276,9 +287,6 @@ function onClickExpressionImage() {
|
|||||||
function addExpressionImage() {
|
function addExpressionImage() {
|
||||||
const html = `<div class="expression-holder"><img class="expression"></div>`;
|
const html = `<div class="expression-holder"><img class="expression"></div>`;
|
||||||
$('body').append(html);
|
$('body').append(html);
|
||||||
$('img.expression').on('error', function () {
|
|
||||||
$(this).attr('src', '');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
function addSettings() {
|
function addSettings() {
|
||||||
const html = `
|
const html = `
|
||||||
|
Reference in New Issue
Block a user