From ecae264fd354b71c5551b0b815b055ce6c565d04 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 19 Apr 2017 14:22:31 +0300 Subject: [PATCH] [DE] Common.localStorage.getItem -> Common.localStorage.getBool. --- apps/common/main/lib/controller/ReviewChanges.js | 10 +--------- apps/documenteditor/main/app/controller/Main.js | 6 ++---- apps/documenteditor/main/app/controller/RightMenu.js | 5 +---- apps/documenteditor/main/app/controller/Statusbar.js | 6 +++--- apps/documenteditor/main/app/controller/Toolbar.js | 3 +-- apps/documenteditor/main/app/view/DocumentHolder.js | 3 +-- apps/documenteditor/main/app/view/FileMenuPanels.js | 5 ++--- apps/documenteditor/main/app/view/RightMenu.js | 3 +-- apps/documenteditor/mobile/app/controller/Main.js | 3 +-- 9 files changed, 13 insertions(+), 31 deletions(-) diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 690512e71..d6cc032ad 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -511,15 +511,7 @@ define([ _setReviewStatus(false); } else { me.api.asc_HaveRevisionsChanges() && me.view.markChanges(true); - - var value = Common.localStorage.getItem("de-track-changes"); - if ( value!== null && parseInt(value) == 1) { - _setReviewStatus(true); - - } else { - _setReviewStatus(false); - - } + _setReviewStatus(Common.localStorage.getBool("de-track-changes")); } if ( Common.localStorage.getBool("de-settings-spellcheck") ) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 604397264..26fafcdfc 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -792,8 +792,7 @@ define([ me.updateWindowTitle(true); - value = Common.localStorage.getItem("de-settings-inputmode"); - me.api.SetTextBoxInputMode(value!==null && parseInt(value) == 1); + me.api.SetTextBoxInputMode(Common.localStorage.getBool("de-settings-inputmode")); /** coauthoring begin **/ if (me.appOptions.isEdit && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) { @@ -1124,8 +1123,7 @@ define([ Common.Utils.Metric.setCurrentMetric(value); me.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter)); - value = Common.localStorage.getItem('de-hidden-rulers'); - me.api.asc_SetViewRulers(value===null || parseInt(value) === 0); + me.api.asc_SetViewRulers(!Common.localStorage.getBool('de-hidden-rulers')); me.api.asc_registerCallback('asc_onDocumentModifiedChanged', _.bind(me.onDocumentModifiedChanged, me)); me.api.asc_registerCallback('asc_onDocumentCanSaveChanged', _.bind(me.onDocumentCanSaveChanged, me)); diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index a07f3e433..67e8afae1 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -273,10 +273,7 @@ define([ this.rightmenu.shapeSettings.createDelayedElements(); var selectedElements = this.api.getSelectedElements(); if (selectedElements.length>0) { - var open = Common.localStorage.getItem("de-hide-right-settings"); - open = (open===null || parseInt(open) == 0); - - this.onFocusObject(selectedElements, open); + this.onFocusObject(selectedElements, !Common.localStorage.getBool("de-hide-right-settings")); } } }, diff --git a/apps/documenteditor/main/app/controller/Statusbar.js b/apps/documenteditor/main/app/controller/Statusbar.js index e7ba72769..9f4aa5086 100644 --- a/apps/documenteditor/main/app/controller/Statusbar.js +++ b/apps/documenteditor/main/app/controller/Statusbar.js @@ -134,7 +134,7 @@ define([ _process_changestip(); } else if ( me.api.asc_IsTrackRevisions() ) { - if ( Common.localStorage.getItem("de-track-changes") ) { + if ( Common.localStorage.getBool("de-track-changes") ) { // show tooltip "track changes in this document" _process_changestip(); } else { @@ -253,11 +253,11 @@ define([ Common.localStorage.setItem(storage, 1); tip.hide(); - me.btnTurnReview.updateHint(this.tipReview); + me.btnTurnReview.updateHint(me.tipReview); }, 'closeclick': function() { tip.hide(); - me.btnTurnReview.updateHint(this.tipReview); + me.btnTurnReview.updateHint(me.tipReview); } }); diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 83f7b915a..4c6398579 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -891,8 +891,7 @@ define([ if (me.api) { var res = (copy) ? me.api.Copy() : me.api.Paste(); if (!res) { - var value = Common.localStorage.getItem("de-hide-copywarning"); - if (!(value && parseInt(value) == 1)) { + if (!Common.localStorage.getBool("de-hide-copywarning")) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { if (dontshow) Common.localStorage.setItem("de-hide-copywarning", 1); diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index b29869844..1f51161e1 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -1693,8 +1693,7 @@ define([ if (me.api) { var res = (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); if (!res) { - var value = Common.localStorage.getItem("de-hide-copywarning"); - if (!(value && parseInt(value) == 1)) { + if (!Common.localStorage.getBool("de-hide-copywarning")) { (new Common.Views.CopyWarningDialog({ handler: function(dontshow) { if (dontshow) Common.localStorage.setItem("de-hide-copywarning", 1); diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index da34fbd31..01d2100bb 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -330,10 +330,9 @@ define([ }, updateSettings: function() { - var value = Common.localStorage.getItem("de-settings-inputmode"); - this.chInputMode.setValue(value!==null && parseInt(value) == 1); + this.chInputMode.setValue(Common.localStorage.getBool("de-settings-inputmode")); - value = Common.localStorage.getItem("de-settings-zoom"); + var value = Common.localStorage.getItem("de-settings-zoom"); value = (value!==null) ? parseInt(value) : (this.mode.customization && this.mode.customization.zoom ? parseInt(this.mode.customization.zoom) : 100); var item = this.cmbZoom.store.findWhere({value: value}); this.cmbZoom.setValue(item ? parseInt(item.get('value')) : (value>0 ? value+'%' : 100)); diff --git a/apps/documenteditor/main/app/view/RightMenu.js b/apps/documenteditor/main/app/view/RightMenu.js index bdc155b38..0d52aace0 100644 --- a/apps/documenteditor/main/app/view/RightMenu.js +++ b/apps/documenteditor/main/app/view/RightMenu.js @@ -149,8 +149,7 @@ define([ this.trigger('render:before', this); - var open = Common.localStorage.getItem("de-hide-right-settings"); - open = (open===null || parseInt(open) == 0); + var open = !Common.localStorage.getBool("de-hide-right-settings"); el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px'); el.show(); diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index e6d76e1f6..55084e395 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -479,8 +479,7 @@ define([ me.updateWindowTitle(true); - value = Common.localStorage.getItem("de-settings-inputmode"); - me.api.SetTextBoxInputMode(value!==null && parseInt(value) == 1); + me.api.SetTextBoxInputMode(Common.localStorage.getBool("de-settings-inputmode")); /** coauthoring begin **/ if (me.appOptions.isEdit && me.appOptions.canLicense && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) {