-
Notifications
You must be signed in to change notification settings - Fork 17
/
overlay.js
76 lines (64 loc) · 2.17 KB
/
overlay.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
$("#videowrap").append("<div id='VideoOverlay' class='fadein'><button class='btn btn-sm btn-default OLB' id='fs-vid-button'>Fullscreen</button></div>");
$('#videowrap').hover(function(){
$('#VideoOverlay').css({
'opacity':'1',
'display':'block',
});
},function(){
$('#VideoOverlay').css({
'opacity':'0',
'display':'none',
});
});
$("#VideoOverlay").append($("#voteskip"));
$("#VideoOverlay").append($("#mediarefresh"));
$("#VideoOverlay").append("<button id='hidechat' title='Hide Chat' class='btn btn-sm btn-default OLB'>Hide Chat</button>");
$("#VideoOverlay").append("<button id='showchat' title='show Chat' class='btn btn-sm btn-default OLB'>Show Chat</button>");
$(document).ready(function(){
$('#hidechat').on('click', function(){nochat();});
$('#showchat').on('click', function(){maxchat();});
});
function nochat(){
$('#chatwrap').addClass('hidden');
$('#maincontain').addClass('fullvideo');
$('#hidechat').addClass('hidden');
$('#showchat').addClass('showchat');
}
function maxchat(){
$('#chatwrap').removeClass('hidden');
$('#maincontain').removeClass('fullvideo');
$('#hidechat').removeClass('hidden');
$('#showchat').removeClass('showchat');
}
var requestFullscreen = function (ele) {
if (ele.requestFullscreen) {
ele.requestFullscreen();
} else if (ele.webkitRequestFullscreen) {
ele.webkitRequestFullscreen();
} else if (ele.mozRequestFullScreen) {
ele.mozRequestFullScreen();
} else if (ele.msRequestFullscreen) {
ele.msRequestFullscreen();
} else {
console.log('Fullscreen API is not supported.');
}
};
var exitFullscreen = function () {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else {
console.log('Fullscreen API is not supported.');
}
};
var fsVidButton = document.getElementById('fs-vid-button');
var video = document.getElementById('videowrap');
fsVidButton.addEventListener('click', function(e) {
e.preventDefault();
requestFullscreen(videowrap);
});