[DE] Use localStorate.getBool instead getItem.
This commit is contained in:
parent
72eda1de98
commit
fb8b479e60
|
@ -287,13 +287,12 @@ define([
|
|||
},
|
||||
|
||||
applySettings: function(menu) {
|
||||
var value = Common.localStorage.getItem("de-settings-inputmode");
|
||||
this.api.SetTextBoxInputMode(parseInt(value) == 1);
|
||||
var value;
|
||||
this.api.SetTextBoxInputMode(Common.localStorage.getBool("de-settings-inputmode"));
|
||||
|
||||
/** coauthoring begin **/
|
||||
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) {
|
||||
value = Common.localStorage.getItem("de-settings-coauthmode");
|
||||
var fast_coauth = (value===null || parseInt(value) == 1);
|
||||
var fast_coauth = Common.localStorage.getBool("de-settings-coauthmode", true);
|
||||
this.api.asc_SetFastCollaborative(fast_coauth);
|
||||
|
||||
value = Common.localStorage.getItem((fast_coauth) ? "de-settings-showchanges-fast" : "de-settings-showchanges-strict");
|
||||
|
@ -306,9 +305,7 @@ define([
|
|||
this.api.SetCollaborativeMarksShowType(value);
|
||||
}
|
||||
|
||||
value = Common.localStorage.getItem("de-settings-livecomment");
|
||||
var resolved = Common.localStorage.getItem("de-settings-resolvedcomment");
|
||||
(!(value!==null && parseInt(value) == 0)) ? this.api.asc_showComments(!(resolved!==null && parseInt(resolved) == 0)) : this.api.asc_hideComments();
|
||||
(Common.localStorage.getBool("de-settings-livecomment", true)) ? this.api.asc_showComments(Common.localStorage.getBool("de-settings-resolvedcomment", true)) : this.api.asc_hideComments();
|
||||
/** coauthoring end **/
|
||||
|
||||
value = Common.localStorage.getItem("de-settings-fontrender");
|
||||
|
@ -325,8 +322,7 @@ define([
|
|||
this.api.asc_setSpellCheck(Common.localStorage.getBool("de-settings-spellcheck", true));
|
||||
}
|
||||
|
||||
value = Common.localStorage.getItem("de-settings-showsnaplines");
|
||||
this.api.put_ShowSnapLines(value===null || parseInt(value) == 1);
|
||||
this.api.put_ShowSnapLines(Common.localStorage.getBool("de-settings-showsnaplines", true));
|
||||
|
||||
menu.hide();
|
||||
},
|
||||
|
@ -517,12 +513,10 @@ define([
|
|||
},
|
||||
|
||||
commentsShowHide: function(mode) {
|
||||
var value = Common.localStorage.getItem("de-settings-livecomment"),
|
||||
resolved = Common.localStorage.getItem("de-settings-resolvedcomment");
|
||||
value = (value!==null && parseInt(value) == 0);
|
||||
resolved = (resolved!==null && parseInt(resolved) == 0);
|
||||
if (value || resolved) {
|
||||
(mode === 'show') ? this.api.asc_showComments(true) : ((!value) ? this.api.asc_showComments(!resolved) : this.api.asc_hideComments());
|
||||
var value = Common.localStorage.getBool("de-settings-livecomment", true),
|
||||
resolved = Common.localStorage.getBool("de-settings-resolvedcomment", true);
|
||||
if (!value || !resolved) {
|
||||
(mode === 'show') ? this.api.asc_showComments(true) : ((value) ? this.api.asc_showComments(resolved) : this.api.asc_hideComments());
|
||||
}
|
||||
|
||||
if (mode === 'show') {
|
||||
|
|
|
@ -735,10 +735,8 @@ define([
|
|||
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
||||
|
||||
/** coauthoring begin **/
|
||||
value = Common.localStorage.getItem("de-settings-livecomment");
|
||||
this.isLiveCommenting = !(value!==null && parseInt(value) == 0);
|
||||
var resolved = Common.localStorage.getItem("de-settings-resolvedcomment");
|
||||
this.isLiveCommenting ? this.api.asc_showComments(!(resolved!==null && parseInt(resolved) == 0)) : this.api.asc_hideComments();
|
||||
this.isLiveCommenting = Common.localStorage.getBool("de-settings-livecomment", true);
|
||||
this.isLiveCommenting ? this.api.asc_showComments(Common.localStorage.getBool("de-settings-resolvedcomment", true)) : this.api.asc_hideComments();
|
||||
/** coauthoring end **/
|
||||
|
||||
value = Common.localStorage.getItem("de-settings-zoom");
|
||||
|
@ -782,7 +780,7 @@ define([
|
|||
/** coauthoring begin **/
|
||||
if (me.appOptions.isEdit && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) {
|
||||
value = Common.localStorage.getItem("de-settings-coauthmode");
|
||||
if (value===null && Common.localStorage.getItem("de-settings-autosave")===null &&
|
||||
if (value===null && !Common.localStorage.itemExists("de-settings-autosave") &&
|
||||
me.appOptions.customization && me.appOptions.customization.autosave===false) {
|
||||
value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null
|
||||
}
|
||||
|
@ -848,8 +846,7 @@ define([
|
|||
me.api.asc_setAutoSaveGap(value);
|
||||
|
||||
if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true
|
||||
value = Common.localStorage.getItem("de-settings-forcesave");
|
||||
me.appOptions.forcesave = (value===null) ? me.appOptions.canForcesave : (parseInt(value)==1);
|
||||
me.appOptions.forcesave = Common.localStorage.getBool("de-settings-forcesave", me.appOptions.canForcesave);
|
||||
me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave);
|
||||
}
|
||||
|
||||
|
@ -1750,8 +1747,7 @@ define([
|
|||
},
|
||||
|
||||
onTryUndoInFastCollaborative: function() {
|
||||
var val = window.localStorage.getItem("de-hide-try-undoredo");
|
||||
if (!(val && parseInt(val) == 1))
|
||||
if (!window.localStorage.getBool("de-hide-try-undoredo"))
|
||||
Common.UI.info({
|
||||
width: 500,
|
||||
msg: this.textTryUndoRedo,
|
||||
|
@ -1785,15 +1781,13 @@ define([
|
|||
|
||||
applySettings: function() {
|
||||
if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
|
||||
var value = Common.localStorage.getItem("de-settings-coauthmode"),
|
||||
oldval = this._state.fastCoauth;
|
||||
this._state.fastCoauth = (value===null || parseInt(value) == 1);
|
||||
var oldval = this._state.fastCoauth;
|
||||
this._state.fastCoauth = Common.localStorage.getBool("de-settings-coauthmode", true);
|
||||
if (this._state.fastCoauth && !oldval)
|
||||
this.synchronizeChanges();
|
||||
}
|
||||
if (this.appOptions.canForcesave) {
|
||||
value = Common.localStorage.getItem("de-settings-forcesave");
|
||||
this.appOptions.forcesave = (value===null) ? this.appOptions.canForcesave : (parseInt(value)==1);
|
||||
this.appOptions.forcesave = Common.localStorage.getBool("de-settings-forcesave", this.appOptions.canForcesave);
|
||||
this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -350,14 +350,11 @@ define([
|
|||
this.cmbZoom.setValue(item ? parseInt(item.get('value')) : (value>0 ? value+'%' : 100));
|
||||
|
||||
/** coauthoring begin **/
|
||||
value = Common.localStorage.getItem("de-settings-livecomment");
|
||||
this.chLiveComment.setValue(!(value!==null && parseInt(value) == 0));
|
||||
|
||||
value = Common.localStorage.getItem("de-settings-resolvedcomment");
|
||||
this.chResolvedComment.setValue(!(value!==null && parseInt(value) == 0));
|
||||
this.chLiveComment.setValue(Common.localStorage.getBool("de-settings-livecomment", true));
|
||||
this.chResolvedComment.setValue(Common.localStorage.getBool("de-settings-resolvedcomment", true));
|
||||
|
||||
value = Common.localStorage.getItem("de-settings-coauthmode");
|
||||
if (value===null && Common.localStorage.getItem("de-settings-autosave")===null &&
|
||||
if (value===null && !Common.localStorage.itemExists("de-settings-autosave") &&
|
||||
this.mode.customization && this.mode.customization.autosave===false)
|
||||
value = 0; // use customization.autosave only when de-settings-coauthmode and de-settings-autosave are null
|
||||
var fast_coauth = (value===null || parseInt(value) == 1) && !(this.mode.isDesktopApp && this.mode.isOffline) && this.mode.canCoAuthoring;
|
||||
|
@ -387,16 +384,11 @@ define([
|
|||
value = 0;
|
||||
this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1));
|
||||
|
||||
if (this.mode.canForcesave) {
|
||||
value = Common.localStorage.getItem("de-settings-forcesave");
|
||||
value = (value === null) ? this.mode.canForcesave : (parseInt(value) == 1);
|
||||
this.chForcesave.setValue(value);
|
||||
}
|
||||
if (this.mode.canForcesave)
|
||||
this.chForcesave.setValue(Common.localStorage.getBool("de-settings-forcesave", this.mode.canForcesave));
|
||||
|
||||
this.chSpell.setValue(Common.localStorage.getBool("de-settings-spellcheck", true));
|
||||
|
||||
value = Common.localStorage.getItem("de-settings-showsnaplines");
|
||||
this.chAlignGuides.setValue(value===null || parseInt(value) == 1);
|
||||
this.chAlignGuides.setValue(Common.localStorage.getBool("de-settings-showsnaplines", true));
|
||||
},
|
||||
|
||||
applySettings: function() {
|
||||
|
|
|
@ -452,8 +452,7 @@ define([
|
|||
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
||||
|
||||
/** coauthoring begin **/
|
||||
value = Common.localStorage.getItem("de-settings-livecomment");
|
||||
this.isLiveCommenting = !(value!==null && parseInt(value) == 0);
|
||||
this.isLiveCommenting = Common.localStorage.getBool("de-settings-livecomment", true);
|
||||
this.isLiveCommenting ? this.api.asc_showComments(true) : this.api.asc_hideComments();
|
||||
/** coauthoring end **/
|
||||
|
||||
|
|
Loading…
Reference in a new issue