diff --git a/package.json b/package.json index a8c53ea7..17de6cac 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.60.1", + "version": "3.60.2", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/www/js/ui.js b/www/js/ui.js index 52ba5b91..67b7de77 100644 --- a/www/js/ui.js +++ b/www/js/ui.js @@ -1,12 +1,18 @@ /* window focus/blur */ -$(window).focus(function() { - FOCUSED = true; - clearInterval(TITLE_BLINK); - TITLE_BLINK = false; - document.title = PAGETITLE; -}).blur(function() { - FOCUSED = false; -}); +if (typeof document.hidden === "undefined") { + console.error("Browser is too old; giving up on visibility tracking for notifications"); +} else { + document.addEventListener("visibilitychange", function () { + if (document.hidden) { + FOCUSED = false; + } else { + FOCUSED = true; + clearInterval(TITLE_BLINK); + TITLE_BLINK = false; + document.title = PAGETITLE; + } + }); +} $("#togglemotd").click(function () { var hidden = $("#motd").css("display") === "none";