How to make the screen blink when there is an unread message

I'm looking for any way to make the entire screen blink red or any other color when there is an unread letter. It can be for any email client. I did a lot and did not find anything. There is an addition to thunderbird that creates a small blinking notification, but it only seems very small in the lower right corner of the screen.

I was thinking about maybe some kind of add-on for Firefox or Chrome that will allow me to write custom css and javascript that will run in Gmail and make blinking. Any ideas are welcome.

I know that this is not an ordinary question, but everything is fine, and I do not know where else to turn. If there is a better forum on this issue, you can also report it.

Thank!

+5
source share
4 answers

Instead of creating a Chrome plugin, I would either start the window title or use HTML5 notifications. Create a simple page that polls your Gmail IMAP for new messages and includes gmail in a large iFrame. If a new message is found, your external window may issue a notification.

HTML5 notifications : http://www.html5rocks.com/en/tutorials/notifications/quick/

Blinking header (adopted from this ):

var newMailBlinker = (function () {
    var oldTitle = document.title,
        msg = 'New Mail!',
        timeoutId,
        blink = function() { 
            document.title = document.title == msg ? ' ' : msg; 
        },
        clear = function() {
            clearInterval(timeoutId);
            document.title = oldTitle;
            window.onmousemove = null;
            timeoutId = null;
        };

    return function () {
        if (!timeoutId) {
            timeoutId = setInterval(blink, 1000);
            window.onmousemove = clear;
        }
    };
}());

PHP Gmail IMAP poll (adopted from this ):

$t1=time();//mark time in
$tt=$t1+(60*1);//total time = t1 + n seconds

do{
    if(isset($t2)) unset($t2);//clean it at every loop cicle
    $t2=time();//mark time
    if(imap_num_msg($imap)!=0){//if there is any message (in the inbox)

        $mc=imap_check($imap);//messages check
        //var_dump($mc); die;//vardump it to see all the data it is possible to get with imap_check() and them customize it for yourself
        echo 'New messages available';

    }else echo 'No new messagens';

    sleep(rand(7,13));//Give Google server a breack
    if(!@imap_ping($imap)){//if the connection is not up
        //start the imap connection the normal way like you did at first
    }

}while($tt>$t2);//if the total time was not achivied yet, get back to the beginning of the loop

jQuery AJAX Poll to your IMAP script (adopted from this ):

// make the AJAX request
function ajax_request() {
  $.ajax({
    url: '/path/to/gmail/imap/checkMessages.php',
    dataType: 'json',
    error: function(xhr_data) {
      // terminate the script
    },
    success: function(xhr_data) {
        console.log(xhr_data);
        if (xhr_data.status == 'No new messages') {
            setTimeout(function() { ajax_request(); }, 15000); // wait 15 seconds than call ajax request again
        } else {
            newMailBlinker(); // blink the title here for new messages
        }
    }
    contentType: 'application/json'
  });
}

, jQuery PHP . , . , , PHP IMAP . .

+1
+2

Google (https://developer.chrome.com/extensions/samples.html). ( ), . . Fullscreen . , .

+1

, , JS.

, :

  • gmail chrome
  • chrome, . , . , gmail css . JS .

  • ( , ).

, - ?

- , FF, JS.

0

All Articles