mirror of https://github.com/calzoneman/sync.git
Use page visibility API instead of buggy window.focus tracking
This commit is contained in:
parent
60a39890f0
commit
cd94c8b83d
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "3.60.1",
|
"version": "3.60.2",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
22
www/js/ui.js
22
www/js/ui.js
|
@ -1,12 +1,18 @@
|
||||||
/* window focus/blur */
|
/* window focus/blur */
|
||||||
$(window).focus(function() {
|
if (typeof document.hidden === "undefined") {
|
||||||
FOCUSED = true;
|
console.error("Browser is too old; giving up on visibility tracking for notifications");
|
||||||
clearInterval(TITLE_BLINK);
|
} else {
|
||||||
TITLE_BLINK = false;
|
document.addEventListener("visibilitychange", function () {
|
||||||
document.title = PAGETITLE;
|
if (document.hidden) {
|
||||||
}).blur(function() {
|
FOCUSED = false;
|
||||||
FOCUSED = false;
|
} else {
|
||||||
});
|
FOCUSED = true;
|
||||||
|
clearInterval(TITLE_BLINK);
|
||||||
|
TITLE_BLINK = false;
|
||||||
|
document.title = PAGETITLE;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$("#togglemotd").click(function () {
|
$("#togglemotd").click(function () {
|
||||||
var hidden = $("#motd").css("display") === "none";
|
var hidden = $("#motd").css("display") === "none";
|
||||||
|
|
Loading…
Reference in New Issue