Commit 8dd9b52e authored by Samarth Joshi's avatar Samarth Joshi

BugFix: Quiz doesnot notify event if user Alt+Tabs in fullscreen

parent 118a5df6
......@@ -20,6 +20,16 @@
return false;
}
document.addEventListener('contextmenu', event => event.preventDefault());
var isTabActive;
window.onfocus = function () {
isTabActive = true;
};
window.onblur = function () {
isTabActive = false;
};
</script>
</head>
<body>
......@@ -148,7 +158,26 @@
return false;
}
}
var vis = (function(){
var stateKey, eventKey, keys = {
hidden: "visibilitychange",
webkitHidden: "webkitvisibilitychange",
mozHidden: "mozvisibilitychange",
msHidden: "msvisibilitychange"
};
for (stateKey in keys) {
if (stateKey in document) {
eventKey = keys[stateKey];
break;
}
}
return function(c) {
if (c) document.addEventListener(eventKey, c);
return !document[stateKey];
}
})();
var heartbeat = setInterval(function() {
var currfs = get_fs();
var flag = false;
if (currfs != prevfs) {
......@@ -161,8 +190,8 @@
{
question: selected_questions,
quiz: quizId,
fullscreen: currfs,
log:flag
fullscreen: (currfs && isTabActive),
log:flag,
},
function(data, status){
console.log("Heartbeat sent!");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment