Fix: rely on data-value-type instead of input name
This commit is contained in:
parent
7ae2f9ca3a
commit
88da38ef3a
|
@ -450,23 +450,22 @@ function setupLivePrefs(
|
|||
if (input.type === 'radio' && !input.checked) {
|
||||
return undefined;
|
||||
}
|
||||
// FIXME: use a string value for iconset
|
||||
if (input.name === 'iconset') {
|
||||
if (input.dataset.valueType === 'number') {
|
||||
return Number(input.value);
|
||||
}
|
||||
return input.value;
|
||||
}
|
||||
function setInputValue(input, value, force = false) {
|
||||
let oldValue, newValue;
|
||||
const inputValue = input.dataset.valueType === 'number' ? Number(input.value) : input.value;
|
||||
if (input.type === 'radio') {
|
||||
oldValue = input.checked;
|
||||
// FIXME: use == because we use number value in iconset
|
||||
newValue = input.checked = value == input.value;
|
||||
newValue = input.checked = value === inputValue;
|
||||
} else if (input.type === 'checkbox') {
|
||||
oldValue = input.checked;
|
||||
newValue = input.checked = value;
|
||||
} else {
|
||||
oldValue = input.value;
|
||||
oldValue = inputValue;
|
||||
newValue = input.value = value;
|
||||
}
|
||||
if (force || oldValue !== newValue) {
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<label>
|
||||
<span i18n-text="optionsIconDark"></span>
|
||||
<div class="iconset">
|
||||
<input type="radio" name="iconset" value="0">
|
||||
<input type="radio" name="iconset" value="0" data-value-type="number">
|
||||
<img src="/images/icon/16.png">
|
||||
<img src="/images/icon/16w.png">
|
||||
<img src="/images/icon/16x.png">
|
||||
|
@ -50,7 +50,7 @@
|
|||
<label>
|
||||
<span i18n-text="optionsIconLight"></span>
|
||||
<div class="iconset">
|
||||
<input type="radio" name="iconset" value="1">
|
||||
<input type="radio" name="iconset" value="1" data-value-type="number">
|
||||
<img src="/images/icon/light/16.png">
|
||||
<img src="/images/icon/light/16w.png">
|
||||
<img src="/images/icon/light/16x.png">
|
||||
|
|
Loading…
Reference in New Issue
Block a user