Changeset 1447

Show
Ignore:
Timestamp:
06/15/11 11:08:53 (11 months ago)
Author:
zeank
Message:

make window "Ring! Ring!" if someone enters the chat

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • HelpIM3/branches/chatgroups/htdocs/helpim.js

    r1446 r1447  
    499499                if (user.chatW && !user.chatW.closed && user.chatW.popMsgs) 
    500500                    user.chatW.popMsgs(); 
    501                 playSound('ring'); 
     501 
     502                // backported from 3.1: 
     503                // taken from 
     504                // http://stackoverflow.com/questions/37122/make-browser-window-blink-in-task-bar 
     505                var oldTitle = document.title; 
     506                var msg = "Ring! Ring!"; 
     507                var ring = 0; 
     508                var timeoutId = setInterval(function() { 
     509                    document.title = (document.title == msg)?'':msg; 
     510                    if ((ring % 5) == 0) { 
     511                        playSound('ring'); 
     512                    } 
     513                    ring++; 
     514                }, 1000); 
     515                user.chatW.document.onmousemove = function() { 
     516                    clearInterval(timeoutId); 
     517                    document.title = oldTitle; 
     518                    document.onmousemove = null; 
     519                }; 
     520                user.chatW.focus(); 
    502521            } 
    503522