[Common] LocalStorage: use default value in getBool function.

This commit is contained in:
Julia Radzhabova 2017-06-15 16:33:04 +03:00
parent 5d40fdc1ed
commit 8705842152
3 changed files with 5 additions and 6 deletions

View file

@ -94,9 +94,10 @@ define(['gateway'], function () {
return _store[name]===undefined ? null : _store[name]; return _store[name]===undefined ? null : _store[name];
}; };
var _getItemAsBool = function (name) { var _getItemAsBool = function (name, defValue) {
var value = _getItem(name); var value = _getItem(name);
return (value !== null && parseInt(value) != 0); defValue = defValue || false;
return (value!==null) ? (parseInt(value) != 0) : defValue;
} }
var _getItemExists = function (name) { var _getItemExists = function (name) {

View file

@ -321,8 +321,7 @@ define([
value = Common.localStorage.getItem("de-settings-autosave"); value = Common.localStorage.getItem("de-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value)); this.api.asc_setAutoSaveGap(parseInt(value));
value = Common.localStorage.getItem("de-settings-spellcheck"); this.api.asc_setSpellCheck(Common.localStorage.getBool("de-settings-spellcheck", true));
this.api.asc_setSpellCheck(value===null || parseInt(value) == 1);
value = Common.localStorage.getItem("de-settings-showsnaplines"); value = Common.localStorage.getItem("de-settings-showsnaplines");
this.api.put_ShowSnapLines(value===null || parseInt(value) == 1); this.api.put_ShowSnapLines(value===null || parseInt(value) == 1);

View file

@ -393,8 +393,7 @@ define([
this.chForcesave.setValue(value); this.chForcesave.setValue(value);
} }
value = Common.localStorage.getItem("de-settings-spellcheck"); this.chSpell.setValue(Common.localStorage.getBool("de-settings-spellcheck", true));
this.chSpell.setValue(value===null || parseInt(value) == 1);
value = Common.localStorage.getItem("de-settings-showsnaplines"); value = Common.localStorage.getItem("de-settings-showsnaplines");
this.chAlignGuides.setValue(value===null || parseInt(value) == 1); this.chAlignGuides.setValue(value===null || parseInt(value) == 1);