Created
June 24, 2014 18:48
-
-
Save kladov/92f163ab2f1250143b07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newExcitingAlerts = (function () { | |
var oldTitle = document.title; | |
var msg = "New!"; | |
var timeoutId; | |
var blink = function() { document.title = document.title == msg ? ' ' : msg; }; | |
var clear = function() { | |
clearInterval(timeoutId); | |
document.title = oldTitle; | |
window.onmousemove = null; | |
timeoutId = null; | |
}; | |
return function () { | |
if (!timeoutId) { | |
timeoutId = setInterval(blink, 1000); | |
window.onmousemove = clear; | |
} | |
}; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment