mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-08-01 04:05:18 +00:00
refactor(config) getValue
This commit is contained in:
parent
18e6cae27f
commit
1e27733c38
1 changed files with 24 additions and 15 deletions
|
|
@ -125,10 +125,10 @@ var CloudCmd, Util, DOM;
|
|||
name = el.id,
|
||||
type = el.type;
|
||||
|
||||
switch(type) {
|
||||
case 'checkbox':
|
||||
data = el.checked;
|
||||
|
||||
obj[name] =
|
||||
data = getValue(el);
|
||||
|
||||
if (type === 'checkbox')
|
||||
if (el.id === 'localStorage')
|
||||
onLocalStorageChange(data);
|
||||
else if (el.id === 'diff')
|
||||
|
|
@ -139,17 +139,6 @@ var CloudCmd, Util, DOM;
|
|||
onLSChange(data);
|
||||
else if (el.id === 'auth')
|
||||
onAuthChange(data);
|
||||
|
||||
break;
|
||||
case 'number':
|
||||
data = el.value - 0;
|
||||
break;
|
||||
default:
|
||||
data = el.value;
|
||||
break;
|
||||
}
|
||||
|
||||
obj[name] = data;
|
||||
|
||||
if (name === 'notifications') {
|
||||
if (data && !Notify.check())
|
||||
|
|
@ -162,6 +151,26 @@ var CloudCmd, Util, DOM;
|
|||
});
|
||||
}
|
||||
|
||||
function getValue(el) {
|
||||
var data,
|
||||
type = el.type;
|
||||
|
||||
switch(type) {
|
||||
case 'checkbox':
|
||||
data = el.checked;
|
||||
|
||||
break;
|
||||
case 'number':
|
||||
data = el.value - 0;
|
||||
break;
|
||||
default:
|
||||
data = el.value;
|
||||
break;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function onLocalStorageChange(checked) {
|
||||
var elDiff = DOM.getById('diff', Element),
|
||||
elBuffer = DOM.getById('buffer', Element),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue