File tree 3 files changed +17
-0
lines changed
app/assets/javascripts/backbone
3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -121,10 +121,12 @@ class Kandan.Helpers.Channels
121
121
@scrollToLatestMessage(channelId) if @pastAutoScrollThreshold(channelId)
122
122
123
123
124
+
124
125
@add_message: (activityAttributes, state)->
125
126
@channel_activities_el(activityAttributes.channel_id)
126
127
.append(@new_activity_view(activityAttributes).render().el)
127
128
@flushActivities(activityAttributes.channel_id)
129
+ Kandan.Helpers.Utils.notifyInTitleIfRequired()
128
130
@set_pagination_data(activityAttributes.channel_id)
129
131
130
132
Original file line number Diff line number Diff line change 1
1
class Kandan.Helpers.Utils
2
2
3
+ @browserTabFocused : true
4
+
5
+ @ notifyInTitleIfRequired: ->
6
+ $ (document ).attr (' title' , ' (new) Kandan' ) if @browserTabFocused != true
7
+
3
8
@months : [
4
9
" January"
5
10
," February"
Original file line number Diff line number Diff line change @@ -39,6 +39,16 @@ window.Kandan =
39
39
action : data .event .split (" #" )[1 ]
40
40
})
41
41
42
+ $ (window ).focus (->
43
+ Kandan .Helpers .Utils .browserTabFocused = true
44
+ $ (document ).attr (' title' , ' Kandan' )
45
+ )
46
+
47
+ $ (window ).blur (->
48
+ Kandan .Helpers .Utils .browserTabFocused = false
49
+ )
50
+
51
+
42
52
initBroadcasterAndSubscribe : ()->
43
53
Kandan .broadcaster = new Kandan.Broadcasters.FayeBroadcaster ()
44
54
Kandan .broadcaster .subscribe " /channels/*"
You can’t perform that action at this time.
0 commit comments