Fix idle.js not change isAway property on onAway and onAwayBack events

This commit is contained in:
Wu Cheng-Han 2016-07-30 11:32:19 +08:00
parent f69a5361cb
commit 3a5bda3067
1 changed files with 12 additions and 10 deletions

View File

@ -685,8 +685,18 @@ var spinner = new Spinner(opts).spin(ui.spinner[0]);
//idle
var idle = new Idle({
onAway: idleStateChange,
onAwayBack: idleStateChange,
onAway: function () {
idle.isAway = true;
emitUserStatus();
updateOnlineStatus();
},
onAwayBack: function () {
idle.isAway = false;
emitUserStatus();
updateOnlineStatus();
setHaveUnreadChanges(false);
updateTitleReminder();
},
awayTimeout: idleTime
});
ui.area.codemirror.on('touchstart', function () {
@ -713,14 +723,6 @@ function updateTitleReminder() {
}
}
function idleStateChange() {
emitUserStatus();
updateOnlineStatus();
if (!idle.isAway)
setHaveUnreadChanges(false);
updateTitleReminder();
}
function setRefreshModal(status) {
$('#refreshModal').modal('show');
$('#refreshModal').find('.modal-body > div').hide();