@@ -1967,27 +1967,39 @@ function sepiaFW_build_webSocket_client(){
19671967 var day = undefined ;
19681968 var showedNew = false ;
19691969 var lastMsgTS = lastChannelMessageTimestamps [ message . data . channelId ] ;
1970+ var numOfMsg = message . data . channelHistory . length ;
1971+ var n = 0 ;
19701972 message . data . channelHistory . forEach ( function ( msg ) {
1973+ var isNew = false ;
19711974 if ( msg . timeUNIX ) {
19721975 //add day name
19731976 var d = new Date ( msg . timeUNIX ) ;
19741977 var thisDay = d . getDay ( ) ;
19751978 if ( thisDay != day ) {
19761979 day = thisDay ;
1977- var customTag = "weekday-note-" + SepiaFW . tools . getLocalDateWithCustomSeparator ( "-" ) ;
1980+ var customTag = "weekday-note-" + SepiaFW . tools . getLocalDateWithCustomSeparator ( "-" , msg . timeUNIX ) ;
19781981 //... but only if we haven't already
19791982 if ( $ ( "#sepiaFW-chat-output" ) . find ( '[data-channel-id=' + message . data . channelId + ']' ) . filter ( '[data-msg-custom-tag=' + customTag + ']' ) . length == 0 ) {
19801983 var weekdayName = SepiaFW . local . getWeekdayName ( day ) + " " + d . toLocaleDateString ( ) ;
19811984 SepiaFW . ui . showInfo ( weekdayName , false , customTag , true , message . data . channelId ) ; //SepiaFW.local.g('history')
19821985 }
19831986 }
19841987 //add unread note - TODO: place this at correct position
1985- if ( ! showedNew && ( ! lastMsgTS || msg . timeUNIX > lastMsgTS ) ) {
1988+ isNew = ( ! lastMsgTS || msg . timeUNIX > lastMsgTS ) ;
1989+ if ( isNew && ! showedNew ) {
19861990 SepiaFW . ui . showInfo ( SepiaFW . local . g ( 'newMessages' ) , false , "unread-note" , true , message . data . channelId ) ;
19871991 showedNew = true ;
19881992 }
19891993 }
1990- SepiaFW . ui . showCustomChatMessage ( msg . text , msg ) ;
1994+ n ++ ;
1995+ var isLast = ( n == numOfMsg ) ;
1996+ var options = {
1997+ displayOptions : {
1998+ skipAnimation : ! isLast ,
1999+ beSilent : ! isNew
2000+ }
2001+ }
2002+ SepiaFW . ui . showCustomChatMessage ( msg . text , msg , options ) ;
19912003 } ) ;
19922004 }
19932005
0 commit comments