Skip to content
Browse files

Plays a ding for new messages when not focused

  • Loading branch information...
1 parent 60af992 commit eb68a15c8be2f6d6a756d7f73952791e8f80dff7 @sgrove sgrove committed Apr 12, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 app/assets/javascripts/backbone/helpers/utils.js.coffee
  2. BIN public/sounds/ding.wav
View
10 app/assets/javascripts/backbone/helpers/utils.js.coffee
@@ -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"
View
BIN public/sounds/ding.wav
Binary file not shown.

0 comments on commit eb68a15

Please sign in to comment.
Something went wrong with that request. Please try again.