Added keyboard shortcuts (part 1) (#70)

Scrolling in message view (#109)
This commit is contained in:
RainLoop Team 2014-04-08 01:03:58 +04:00
parent 3936a818b7
commit 8979687f88
37 changed files with 2095 additions and 333 deletions

View file

@ -19,6 +19,7 @@ function PopupsAskViewModel()
this.fNoAction = null;
this.bDisabeCloseOnEsc = true;
this.sKeyScope = Enums.KeyState.MessageList;
Knoin.constructorEnd(this);
}
@ -40,22 +41,22 @@ PopupsAskViewModel.prototype.clearPopup = function ()
PopupsAskViewModel.prototype.yesClick = function ()
{
this.cancelCommand();
if (Utils.isFunc(this.fYesAction))
{
this.fYesAction.call(null);
}
this.cancelCommand();
};
PopupsAskViewModel.prototype.noClick = function ()
{
this.cancelCommand();
if (Utils.isFunc(this.fNoAction))
{
this.fNoAction.call(null);
}
this.cancelCommand();
};
/**
@ -82,6 +83,9 @@ PopupsAskViewModel.prototype.onShow = function (sAskDesc, fYesFunc, fNoFunc, sYe
{
this.yesButton(sNoButton);
}
this.sKeyScope = RL.data().keyScope();
RL.data().keyScope(Enums.KeyState.PopupAsk);
};
PopupsAskViewModel.prototype.onFocus = function ()
@ -91,31 +95,25 @@ PopupsAskViewModel.prototype.onFocus = function ()
PopupsAskViewModel.prototype.onHide = function ()
{
RL.data().keyScope(this.sKeyScope);
};
PopupsAskViewModel.prototype.onBuild = function ()
{
var self = this;
$window.on('keydown', function (oEvent) {
var bResult = true;
if (oEvent && self.modalVisibility())
key('tab, right, left', Enums.KeyState.PopupAsk, _.bind(function () {
if (this.modalVisibility())
{
if (Enums.EventKeyCode.Tab === oEvent.keyCode || Enums.EventKeyCode.Right === oEvent.keyCode || Enums.EventKeyCode.Left === oEvent.keyCode)
if (this.yesFocus())
{
if (self.yesFocus())
{
self.noFocus(true);
}
else
{
self.yesFocus(true);
}
bResult = false;
this.noFocus(true);
}
else
{
this.yesFocus(true);
}
}
return bResult;
});
return false;
}
}, this));
};