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