refactor: clean up code structure in multiple files
This commit is contained in:
parent
3e85a88bd3
commit
99027e6315
4 changed files with 18 additions and 22 deletions
|
|
@ -214,16 +214,15 @@ function saveOptions(e) {
|
||||||
case 'number':
|
case 'number':
|
||||||
options[element.id] = element.valueAsNumber;
|
options[element.id] = element.valueAsNumber;
|
||||||
break;
|
break;
|
||||||
case 'text':
|
case 'text':
|
||||||
case 'password':
|
case 'password':
|
||||||
options[element.id] = element.value.trim();
|
options[element.id] = element.value.trim();
|
||||||
break;
|
break;
|
||||||
|
case 'select-one':
|
||||||
|
options[element.id] = element.value;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (element.tagName === 'SELECT') {
|
console.error("[ThunderAI] Unhandled input type:", element.type);
|
||||||
options[element.id] = element.value;
|
|
||||||
}else{
|
|
||||||
console.error("[ThunderAI] Unhandled input type:", element.type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
browser.storage.sync.set(options);
|
browser.storage.sync.set(options);
|
||||||
|
|
|
||||||
|
|
@ -97,12 +97,11 @@ function saveOptions(e) {
|
||||||
case 'password':
|
case 'password':
|
||||||
options[element.id] = element.value.trim();
|
options[element.id] = element.value.trim();
|
||||||
break;
|
break;
|
||||||
|
case 'select-one':
|
||||||
|
options[element.id] = element.value;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (element.tagName === 'SELECT') {
|
console.error("[ThunderAI] Unhandled input type:", element.type);
|
||||||
options[element.id] = element.value;
|
|
||||||
}else{
|
|
||||||
console.error("[ThunderAI] Unhandled input type:", element.type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
browser.storage.sync.set(options);
|
browser.storage.sync.set(options);
|
||||||
|
|
|
||||||
|
|
@ -97,12 +97,11 @@ function saveOptions(e) {
|
||||||
case 'password':
|
case 'password':
|
||||||
options[element.id] = element.value.trim();
|
options[element.id] = element.value.trim();
|
||||||
break;
|
break;
|
||||||
|
case 'select-one':
|
||||||
|
options[element.id] = element.value;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (element.tagName === 'SELECT') {
|
console.error("[ThunderAI] Unhandled input type:", element.type);
|
||||||
options[element.id] = element.value;
|
|
||||||
}else{
|
|
||||||
console.error("[ThunderAI] Unhandled input type:", element.type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
browser.storage.sync.set(options);
|
browser.storage.sync.set(options);
|
||||||
|
|
|
||||||
|
|
@ -210,12 +210,11 @@ function saveOptions(e) {
|
||||||
case 'password':
|
case 'password':
|
||||||
options[element.id] = element.value.trim();
|
options[element.id] = element.value.trim();
|
||||||
break;
|
break;
|
||||||
|
case 'select-one':
|
||||||
|
options[element.id] = element.value;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (element.tagName === 'SELECT') {
|
console.error("[ThunderAI] Unhandled input type:", element.type);
|
||||||
options[element.id] = element.value;
|
|
||||||
}else{
|
|
||||||
console.error("[ThunderAI] Unhandled input type:", element.type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
browser.storage.sync.set(options);
|
browser.storage.sync.set(options);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue