From 8c9622f1b2b829df6b0bb6dbca622257d823f5f3 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Thu, 15 Nov 2018 22:40:01 -0800 Subject: [PATCH] Fix #783 --- package.json | 2 +- www/js/ui.js | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) 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";