[DE] Common.localStorage.getItem -> Common.localStorage.getBool.

This commit is contained in:
Julia Radzhabova 2017-04-19 14:22:31 +03:00
parent e1d553049b
commit ecae264fd3
9 changed files with 13 additions and 31 deletions

View file

@ -511,15 +511,7 @@ define([
_setReviewStatus(false); _setReviewStatus(false);
} else { } else {
me.api.asc_HaveRevisionsChanges() && me.view.markChanges(true); me.api.asc_HaveRevisionsChanges() && me.view.markChanges(true);
_setReviewStatus(Common.localStorage.getBool("de-track-changes"));
var value = Common.localStorage.getItem("de-track-changes");
if ( value!== null && parseInt(value) == 1) {
_setReviewStatus(true);
} else {
_setReviewStatus(false);
}
} }
if ( Common.localStorage.getBool("de-settings-spellcheck") ) if ( Common.localStorage.getBool("de-settings-spellcheck") )

View file

@ -792,8 +792,7 @@ define([
me.updateWindowTitle(true); me.updateWindowTitle(true);
value = Common.localStorage.getItem("de-settings-inputmode"); me.api.SetTextBoxInputMode(Common.localStorage.getBool("de-settings-inputmode"));
me.api.SetTextBoxInputMode(value!==null && parseInt(value) == 1);
/** coauthoring begin **/ /** coauthoring begin **/
if (me.appOptions.isEdit && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) { if (me.appOptions.isEdit && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) {
@ -1124,8 +1123,7 @@ define([
Common.Utils.Metric.setCurrentMetric(value); 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)); 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(!Common.localStorage.getBool('de-hidden-rulers'));
me.api.asc_SetViewRulers(value===null || parseInt(value) === 0);
me.api.asc_registerCallback('asc_onDocumentModifiedChanged', _.bind(me.onDocumentModifiedChanged, me)); me.api.asc_registerCallback('asc_onDocumentModifiedChanged', _.bind(me.onDocumentModifiedChanged, me));
me.api.asc_registerCallback('asc_onDocumentCanSaveChanged', _.bind(me.onDocumentCanSaveChanged, me)); me.api.asc_registerCallback('asc_onDocumentCanSaveChanged', _.bind(me.onDocumentCanSaveChanged, me));

View file

@ -273,10 +273,7 @@ define([
this.rightmenu.shapeSettings.createDelayedElements(); this.rightmenu.shapeSettings.createDelayedElements();
var selectedElements = this.api.getSelectedElements(); var selectedElements = this.api.getSelectedElements();
if (selectedElements.length>0) { if (selectedElements.length>0) {
var open = Common.localStorage.getItem("de-hide-right-settings"); this.onFocusObject(selectedElements, !Common.localStorage.getBool("de-hide-right-settings"));
open = (open===null || parseInt(open) == 0);
this.onFocusObject(selectedElements, open);
} }
} }
}, },

View file

@ -134,7 +134,7 @@ define([
_process_changestip(); _process_changestip();
} else } else
if ( me.api.asc_IsTrackRevisions() ) { 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" // show tooltip "track changes in this document"
_process_changestip(); _process_changestip();
} else { } else {
@ -253,11 +253,11 @@ define([
Common.localStorage.setItem(storage, 1); Common.localStorage.setItem(storage, 1);
tip.hide(); tip.hide();
me.btnTurnReview.updateHint(this.tipReview); me.btnTurnReview.updateHint(me.tipReview);
}, },
'closeclick': function() { 'closeclick': function() {
tip.hide(); tip.hide();
me.btnTurnReview.updateHint(this.tipReview); me.btnTurnReview.updateHint(me.tipReview);
} }
}); });

View file

@ -891,8 +891,7 @@ define([
if (me.api) { if (me.api) {
var res = (copy) ? me.api.Copy() : me.api.Paste(); var res = (copy) ? me.api.Copy() : me.api.Paste();
if (!res) { if (!res) {
var value = Common.localStorage.getItem("de-hide-copywarning"); if (!Common.localStorage.getBool("de-hide-copywarning")) {
if (!(value && parseInt(value) == 1)) {
(new Common.Views.CopyWarningDialog({ (new Common.Views.CopyWarningDialog({
handler: function(dontshow) { handler: function(dontshow) {
if (dontshow) Common.localStorage.setItem("de-hide-copywarning", 1); if (dontshow) Common.localStorage.setItem("de-hide-copywarning", 1);

View file

@ -1693,8 +1693,7 @@ define([
if (me.api) { if (me.api) {
var res = (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste()); var res = (item.value == 'cut') ? me.api.Cut() : ((item.value == 'copy') ? me.api.Copy() : me.api.Paste());
if (!res) { if (!res) {
var value = Common.localStorage.getItem("de-hide-copywarning"); if (!Common.localStorage.getBool("de-hide-copywarning")) {
if (!(value && parseInt(value) == 1)) {
(new Common.Views.CopyWarningDialog({ (new Common.Views.CopyWarningDialog({
handler: function(dontshow) { handler: function(dontshow) {
if (dontshow) Common.localStorage.setItem("de-hide-copywarning", 1); if (dontshow) Common.localStorage.setItem("de-hide-copywarning", 1);

View file

@ -330,10 +330,9 @@ define([
}, },
updateSettings: function() { updateSettings: function() {
var value = Common.localStorage.getItem("de-settings-inputmode"); this.chInputMode.setValue(Common.localStorage.getBool("de-settings-inputmode"));
this.chInputMode.setValue(value!==null && parseInt(value) == 1);
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); 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}); var item = this.cmbZoom.store.findWhere({value: value});
this.cmbZoom.setValue(item ? parseInt(item.get('value')) : (value>0 ? value+'%' : 100)); this.cmbZoom.setValue(item ? parseInt(item.get('value')) : (value>0 ? value+'%' : 100));

View file

@ -149,8 +149,7 @@ define([
this.trigger('render:before', this); this.trigger('render:before', this);
var open = Common.localStorage.getItem("de-hide-right-settings"); var open = !Common.localStorage.getBool("de-hide-right-settings");
open = (open===null || parseInt(open) == 0);
el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px'); el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px');
el.show(); el.show();

View file

@ -479,8 +479,7 @@ define([
me.updateWindowTitle(true); me.updateWindowTitle(true);
value = Common.localStorage.getItem("de-settings-inputmode"); me.api.SetTextBoxInputMode(Common.localStorage.getBool("de-settings-inputmode"));
me.api.SetTextBoxInputMode(value!==null && parseInt(value) == 1);
/** coauthoring begin **/ /** coauthoring begin **/
if (me.appOptions.isEdit && me.appOptions.canLicense && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) { if (me.appOptions.isEdit && me.appOptions.canLicense && !me.appOptions.isOffline && me.appOptions.canCoAuthoring) {