mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(config) onLSChange
This commit is contained in:
parent
3976ffed2d
commit
e42ee15564
1 changed files with 15 additions and 15 deletions
|
|
@ -175,13 +175,13 @@ var CloudCmd, Util, DOM, io;
|
|||
|
||||
if (type === 'checkbox')
|
||||
if (el.id === 'localStorage')
|
||||
data = onLocalStorageChange(data);
|
||||
onLocalStorageChange();
|
||||
else if (el.id === 'diff')
|
||||
data = onLSChange(data);
|
||||
onLSChange(el);
|
||||
else if (el.id === 'buffer')
|
||||
data = onLSChange(data);
|
||||
onLSChange(el);
|
||||
else if (el.id === 'dirStorage')
|
||||
data = onLSChange(data);
|
||||
onLSChange(el);
|
||||
else if (el.id === 'auth')
|
||||
onAuthChange(data);
|
||||
|
||||
|
|
@ -249,10 +249,11 @@ var CloudCmd, Util, DOM, io;
|
|||
}
|
||||
}
|
||||
|
||||
function onLocalStorageChange(checked) {
|
||||
function onLocalStorageChange() {
|
||||
var isChecked,
|
||||
names = ['diff', 'buffer', 'dirStorage', 'localStorage'],
|
||||
elements = names.map(DOM.getById),
|
||||
showed,
|
||||
el = {},
|
||||
msg = 'Diff, Buffer and Directory Storage do not work without localStorage';
|
||||
|
||||
|
|
@ -274,21 +275,20 @@ var CloudCmd, Util, DOM, io;
|
|||
|
||||
onChange(element);
|
||||
}
|
||||
|
||||
return element;
|
||||
});
|
||||
|
||||
checked = false;
|
||||
}
|
||||
|
||||
return checked;
|
||||
}
|
||||
|
||||
function onLSChange(checked) {
|
||||
var element = DOM.getById('localStorage', Element);
|
||||
function onLSChange(el) {
|
||||
var elLocalStorage = DOM.getById('localStorage', Element),
|
||||
msg = el.id + ' depends on localStorage';
|
||||
|
||||
if (checked && !element.checked)
|
||||
checked = onLocalStorageChange(checked);
|
||||
|
||||
return checked;
|
||||
if (el.checked && !elLocalStorage.checked) {
|
||||
alert(msg);
|
||||
elLocalStorage.checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
function onAuthChange(checked) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue