Skip to content

Commit

Permalink
Plays a ding for new messages when not focused
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrove committed Apr 13, 2012
1 parent 60af992 commit eb68a15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/assets/javascripts/backbone/helpers/utils.js.coffee
Expand Up @@ -5,9 +5,19 @@ class Kandan.Helpers.Utils

@notifyInTitleIfRequired: ->
if @browserTabFocused != true
@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"
,"February"
Expand Down
Binary file added public/sounds/ding.wav
Binary file not shown.

0 comments on commit eb68a15

Please sign in to comment.