From 880fc6ddd497bd31484b3711a9f8ed013263b684 Mon Sep 17 00:00:00 2001 From: Sean Grove Date: Thu, 12 Apr 2012 23:46:31 -0700 Subject: [PATCH] Only notify in the title or make a sound when a message happens in the channel we're in --- .../javascripts/backbone/helpers/utils.js.coffee | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/backbone/helpers/utils.js.coffee b/app/assets/javascripts/backbone/helpers/utils.js.coffee index c273c41a..b107e3fc 100644 --- a/app/assets/javascripts/backbone/helpers/utils.js.coffee +++ b/app/assets/javascripts/backbone/helpers/utils.js.coffee @@ -3,20 +3,12 @@ class Kandan.Helpers.Utils @browserTabFocused: true - @notifyInTitleIfRequired: -> - if @browserTabFocused != true - @playAudioNotice() + @notifyInTitleIfRequired: (activityAttributes) -> + if Kandan.Data.Channels.activeChannelId() == activityAttributes.channel_id and activityAttributes.action == "message" and @browserTabFocused != true + Kandan.Plugins.MusicPlayer.playAudioNotice() @unreadActivities += 1 $(document).attr('title', "(#{@unreadActivities}) Kandan") - @playAudioNotice: -> - url = @localFileUrl('ding.wav') - player = $('.audio_private')[0] - player.setAttribute('src', url) - player.play() - - @localFileUrl: (fileName) -> - return "http://#{ window.location.hostname }:#{ window.location.port }/sounds/#{ fileName }" @months: [ "January"