Created
June 26, 2013 15:18
-
-
Save grundprinzip/5868304 to your computer and use it in GitHub Desktop.
Change Window Title on Blur
This file contains hidden or 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
var n,t; | |
typeof document.hidden != "undefined" ? | |
(e = "hidden", n = "visibilitychange", t = "visibilityState") : | |
typeof document.mozHidden != "undefined" ? | |
(e = "mozHidden", n = "mozvisibilitychange", t = "mozVisibilityState") : | |
typeof document.msHidden != "undefined" ? | |
(e = "msHidden", n = "msvisibilitychange", t = "msVisibilityState") : | |
typeof document.webkitHidden != "undefined" && | |
(e = "webkitHidden", n = "webkitvisibilitychange", t = "webkitVisibilityState"), t && $(document).on(n, function (e) { | |
var n = "Come back! We miss you!"; | |
document[t] === "visible" && | |
typeof window.originalDocumentTitle != "undefined" && | |
(document.title = window.originalDocumentTitle), | |
document[t] === "hidden" && document.title !== n && | |
(window.originalDocumentTitle = document.title, document.title = n) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment