Removed unneeded IF

This commit is contained in:
joe 2023-08-03 19:29:48 +09:00
parent aebdd6cd42
commit 4b7c837fe3
1 changed files with 5 additions and 8 deletions

View File

@ -449,7 +449,7 @@ async function loadLiveChar() {
function handleImageChange() { function handleImageChange() {
const imgElement = document.querySelector('img#expression-image.expression'); const imgElement = document.querySelector('img#expression-image.expression');
if (!imgElement) { if (!imgElement) {
console.log("Cannot find addExpressionImage()"); console.log("Cannot find addExpressionImage()");
return; return;
@ -504,7 +504,7 @@ async function moduleWorker() {
//set checkbox to global var //set checkbox to global var
$('#image_type_toggle').prop('checked', extension_settings.expressions.live2d); $('#image_type_toggle').prop('checked', extension_settings.expressions.live2d);
if(extension_settings.expressions.live2d == true){ if(extension_settings.expressions.live2d == true){
live2d(extension_settings.expressions.live2d); setLive2dState(extension_settings.expressions.live2d);
} }
} }
@ -610,7 +610,7 @@ async function moduleWorker() {
} }
} }
function live2d(switch_var){ function setLive2dState(switch_var){
extension_settings.expressions.live2d = switch_var; // Store setting extension_settings.expressions.live2d = switch_var; // Store setting
saveSettingsDebounced(); saveSettingsDebounced();
@ -916,16 +916,13 @@ async function setExpression(character, expression, force) {
document.getElementById("expression-holder").style.display = ''; document.getElementById("expression-holder").style.display = '';
} else { } else {
if (extension_settings.expressions.live2d == true) {
// Find the <img> element with id="expression-image" and class="expression" // Find the <img> element with id="expression-image" and class="expression"
const imgElement = document.querySelector('img#expression-image.expression'); const imgElement = document.querySelector('img#expression-image.expression');
//console.log("searching"); //console.log("searching");
if (imgElement) { if (imgElement) {
console.log("setting value"); console.log("setting value");
imgElement.src = getApiUrl() + '/api/live2d/result_feed'; imgElement.src = getApiUrl() + '/api/live2d/result_feed';
} }
}
} }
} }
@ -1237,7 +1234,7 @@ function setExpressionOverrideHtml(forceClear = false) {
$('.expression_settings').hide(); $('.expression_settings').hide();
$('#image_type_toggle').on('click', function () { $('#image_type_toggle').on('click', function () {
live2d(this.checked); setLive2dState(this.checked);
}); });
} }