[FE] fix private image button is not stored correctly

This commit is contained in:
HappyZ 2023-05-27 20:01:52 -07:00
parent 0b241902a7
commit 203268252f
1 changed files with 10 additions and 5 deletions

View File

@ -58,7 +58,7 @@
Key</label>
<input type="password" class="form-control" id="apiKey" value="">
<div class="input-group-text">
<input class="form-check-input" type="checkbox" value="" id="isPrivate" value="">
<input class="form-check-input" type="checkbox" value="" id="isPrivate">
</div>
<label for="isPrivate" class="input-group-text" data-en_XX="Generate Private Images"
data-zh_CN="生成非公开图片">Generate Private Images</label>
@ -593,12 +593,17 @@
var input = $(this);
var key = input.attr('id');
var value = input.val();
if (input.attr('type') == "checkbox") {
value = input.is(":checked");
}
localStorage.setItem(key, value);
}).each(function () {
var input = $(this);
var key = input.attr('id');
var value = localStorage.getItem(key);
if (value) {
if (input.attr('type') == "checkbox") {
input.prop('checked', value == "true");
} else if (value) {
input.val(value);
}
});