[PE] localStorage.getItem -> getBool.
This commit is contained in:
parent
5a4204b18a
commit
8c1c09e437
|
@ -229,22 +229,19 @@ define([
|
|||
},
|
||||
|
||||
applySettings: function(menu) {
|
||||
var value = Common.localStorage.getItem("pe-settings-inputmode");
|
||||
this.api.SetTextBoxInputMode(parseInt(value) == 1);
|
||||
this.api.SetTextBoxInputMode(Common.localStorage.getBool("pe-settings-inputmode"));
|
||||
|
||||
/** coauthoring begin **/
|
||||
if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring) {
|
||||
value = Common.localStorage.getItem("pe-settings-coauthmode");
|
||||
this.api.asc_SetFastCollaborative(value===null || parseInt(value) == 1);
|
||||
this.api.asc_SetFastCollaborative(Common.localStorage.getBool("pe-settings-coauthmode", true));
|
||||
}
|
||||
/** coauthoring end **/
|
||||
|
||||
if (this.mode.isEdit) {
|
||||
value = Common.localStorage.getItem("pe-settings-autosave");
|
||||
var value = Common.localStorage.getItem("pe-settings-autosave");
|
||||
this.api.asc_setAutoSaveGap(parseInt(value));
|
||||
|
||||
value = Common.localStorage.getItem("pe-settings-spellcheck");
|
||||
this.api.asc_setSpellCheck(parseInt(value) == 1);
|
||||
this.api.asc_setSpellCheck(Common.localStorage.getBool("pe-settings-spellcheck", true));
|
||||
}
|
||||
|
||||
this.api.put_ShowSnapLines( Common.localStorage.getBool("pe-settings-showsnaplines") );
|
||||
|
|
|
@ -565,8 +565,7 @@ define([
|
|||
var zf = (value!==null) ? parseInt(value) : (this.appOptions.customization && this.appOptions.customization.zoom ? parseInt(this.appOptions.customization.zoom) : -1);
|
||||
(zf == -1) ? this.api.zoomFitToPage() : ((zf == -2) ? this.api.zoomFitToWidth() : this.api.zoom(zf>0 ? zf : 100));
|
||||
|
||||
value = Common.localStorage.getItem("pe-settings-spellcheck");
|
||||
me.api.asc_setSpellCheck(value===null || parseInt(value) == 1);
|
||||
me.api.asc_setSpellCheck(Common.localStorage.getBool("pe-settings-spellcheck", true));
|
||||
|
||||
function checkWarns() {
|
||||
if (!window['AscDesktopEditor']) {
|
||||
|
@ -595,7 +594,7 @@ define([
|
|||
/** coauthoring begin **/
|
||||
if (me.appOptions.isEdit && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) {
|
||||
value = Common.localStorage.getItem("pe-settings-coauthmode");
|
||||
if (value===null && Common.localStorage.getItem("pe-settings-autosave")===null &&
|
||||
if (value===null && !Common.localStorage.itemExists("pe-settings-autosave") &&
|
||||
me.appOptions.customization && me.appOptions.customization.autosave===false) {
|
||||
value = 0; // use customization.autosave only when pe-settings-coauthmode and pe-settings-autosave are null
|
||||
}
|
||||
|
@ -607,7 +606,7 @@ define([
|
|||
me.api.asc_SetFastCollaborative(me._state.fastCoauth);
|
||||
/** coauthoring end **/
|
||||
|
||||
Common.localStorage.setItem("pe-settings-showsnaplines", me.api.get_ShowSnapLines() ? 1 : 0);
|
||||
Common.localStorage.setBool("pe-settings-showsnaplines", me.api.get_ShowSnapLines());
|
||||
|
||||
var application = me.getApplication();
|
||||
var toolbarController = application.getController('Toolbar'),
|
||||
|
@ -651,8 +650,7 @@ define([
|
|||
me.api.asc_setAutoSaveGap(value);
|
||||
|
||||
if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true
|
||||
value = Common.localStorage.getItem("pe-settings-forcesave");
|
||||
me.appOptions.forcesave = (value===null) ? me.appOptions.canForcesave : (parseInt(value)==1);
|
||||
me.appOptions.forcesave = Common.localStorage.getBool("pe-settings-forcesave", me.appOptions.canForcesave);
|
||||
me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave);
|
||||
}
|
||||
|
||||
|
@ -706,7 +704,7 @@ define([
|
|||
$(document).on('contextmenu', _.bind(me.onContextMenu, me));
|
||||
|
||||
if (this._state.licenseWarning) {
|
||||
value = Common.localStorage.getItem("de-license-warning");
|
||||
value = Common.localStorage.getItem("pe-license-warning");
|
||||
value = (value!==null) ? parseInt(value) : 0;
|
||||
var now = (new Date).getTime();
|
||||
if (now - value > 86400000) {
|
||||
|
@ -1500,8 +1498,7 @@ define([
|
|||
},
|
||||
|
||||
onTryUndoInFastCollaborative: function() {
|
||||
var val = window.localStorage.getItem("pe-hide-try-undoredo");
|
||||
if (!(val && parseInt(val) == 1))
|
||||
if (!window.localStorage.getBool("pe-hide-try-undoredo"))
|
||||
Common.UI.info({
|
||||
width: 500,
|
||||
msg: this.textTryUndoRedo,
|
||||
|
@ -1533,15 +1530,13 @@ define([
|
|||
|
||||
applySettings: function() {
|
||||
if (this.appOptions.isEdit && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
|
||||
var value = Common.localStorage.getItem("pe-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("pe-settings-coauthmode", true);
|
||||
if (this._state.fastCoauth && !oldval)
|
||||
this.synchronizeChanges();
|
||||
}
|
||||
if (this.appOptions.canForcesave) {
|
||||
value = Common.localStorage.getItem("pe-settings-forcesave");
|
||||
this.appOptions.forcesave = (value===null) ? this.appOptions.canForcesave : (parseInt(value)==1);
|
||||
this.appOptions.forcesave = Common.localStorage.getBool("pe-settings-forcesave", this.appOptions.canForcesave);
|
||||
this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -176,9 +176,7 @@ define([
|
|||
},
|
||||
|
||||
createDelayedElements: function() {
|
||||
var value = Common.localStorage.getItem("pe-settings-spellcheck");
|
||||
this.statusbar.btnSetSpelling.toggle(value===null || parseInt(value) == 1, true);
|
||||
|
||||
this.statusbar.btnSetSpelling.toggle(Common.localStorage.getBool("pe-settings-spellcheck", true), true);
|
||||
this.statusbar.$el.css('z-index', '');
|
||||
},
|
||||
|
||||
|
@ -215,8 +213,7 @@ define([
|
|||
},
|
||||
|
||||
applySettings: function(menu) {
|
||||
var value = Common.localStorage.getItem("pe-settings-spellcheck");
|
||||
this.statusbar.btnSetSpelling.toggle(value===null || parseInt(value) == 1, true);
|
||||
this.statusbar.btnSetSpelling.toggle(Common.localStorage.getBool("pe-settings-spellcheck", true), true);
|
||||
},
|
||||
|
||||
zoomText : 'Zoom {0}%'
|
||||
|
|
|
@ -1551,7 +1551,7 @@ define([
|
|||
var headerView = this.getApplication().getController('Statusbar').getView('Statusbar');
|
||||
headerView && headerView.setVisible(!checked);
|
||||
|
||||
Common.localStorage.setItem('pe-hidden-status', checked ? 1 : 0);
|
||||
Common.localStorage.setBool('pe-hidden-status', checked);
|
||||
|
||||
Common.NotificationCenter.trigger('layout:changed', 'status');
|
||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
|
|
|
@ -285,19 +285,18 @@ define([
|
|||
},
|
||||
|
||||
updateSettings: function() {
|
||||
var value = Common.localStorage.getItem("pe-settings-spellcheck");
|
||||
this.chSpell.setValue(value===null || parseInt(value) == 1);
|
||||
this.chSpell.setValue(Common.localStorage.getBool("pe-settings-spellcheck", true));
|
||||
|
||||
this.chInputMode.setValue(Common.localStorage.getBool("pe-settings-inputmode"));
|
||||
|
||||
value = Common.localStorage.getItem("pe-settings-zoom");
|
||||
var value = Common.localStorage.getItem("pe-settings-zoom");
|
||||
value = (value!==null) ? parseInt(value) : (this.mode.customization && this.mode.customization.zoom ? parseInt(this.mode.customization.zoom) : -1);
|
||||
var item = this.cmbZoom.store.findWhere({value: value});
|
||||
this.cmbZoom.setValue(item ? parseInt(item.get('value')) : (value>0 ? value+'%' : 100));
|
||||
|
||||
/** coauthoring begin **/
|
||||
value = Common.localStorage.getItem("pe-settings-coauthmode");
|
||||
if (value===null && Common.localStorage.getItem("pe-settings-autosave")===null &&
|
||||
if (value===null && !Common.localStorage.itemExists("pe-settings-autosave") &&
|
||||
this.mode.customization && this.mode.customization.autosave===false)
|
||||
value = 0; // use customization.autosave only when pe-settings-coauthmode and pe-settings-autosave are null
|
||||
var fast_coauth = (value===null || parseInt(value) == 1) && !(this.mode.isDesktopApp && this.mode.isOffline) && this.mode.canCoAuthoring;
|
||||
|
@ -318,13 +317,10 @@ define([
|
|||
this.chAutosave.setValue(fast_coauth || (value===null ? this.mode.canCoAuthoring : parseInt(value) == 1));
|
||||
|
||||
if (this.mode.canForcesave) {
|
||||
value = Common.localStorage.getItem("pe-settings-forcesave");
|
||||
value = (value === null) ? this.mode.canForcesave : (parseInt(value) == 1);
|
||||
this.chForcesave.setValue(value);
|
||||
this.chForcesave.setValue(Common.localStorage.getBool("pe-settings-forcesave", this.mode.canForcesave));
|
||||
}
|
||||
|
||||
value = Common.localStorage.getItem("pe-settings-showsnaplines");
|
||||
this.chAlignGuides.setValue(value===null || parseInt(value) == 1);
|
||||
this.chAlignGuides.setValue(Common.localStorage.getBool("pe-settings-showsnaplines", true));
|
||||
},
|
||||
|
||||
applySettings: function() {
|
||||
|
|
Loading…
Reference in a new issue