diff --git a/package.json b/package.json index 5b6f5749..af479d39 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.61.0", + "version": "3.61.1", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/www/js/ui.js b/www/js/ui.js index 67b7de77..dedfa547 100644 --- a/www/js/ui.js +++ b/www/js/ui.js @@ -1,18 +1,18 @@ /* window focus/blur */ -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; - } - }); -} +CyTube.ui.onPageFocus = function () { + FOCUSED = true; + clearInterval(TITLE_BLINK); + TITLE_BLINK = false; + document.title = PAGETITLE; +}; + +CyTube.ui.onPageBlur = function (event) { + FOCUSED = false; +}; + +$(window).focus(CyTube.ui.onPageFocus).blur(CyTube.ui.onPageBlur); +// See #783 +$(".modal").focus(CyTube.ui.onPageFocus); $("#togglemotd").click(function () { var hidden = $("#motd").css("display") === "none";