1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00
This commit is contained in:
Daniel Neto 2024-10-29 14:12:07 -03:00
parent f40794f03d
commit 68574750cc

View file

@ -4057,6 +4057,15 @@ function addCloseButtonInPage() {
}
}
function closeFullScreenOrHistoryBack(){
if (window.self !== window.top) {
window.parent.postMessage('closeFullscreen', '*');
} else {
console.log('close history.back');
window.history.back();
}
}
function addCloseButton(elementToAppend) {
// If either function exists, add a close button inside videojs
if (window.self !== window.top) {
@ -4069,12 +4078,7 @@ function addCloseButton(elementToAppend) {
closeButton.html('<i class="fas fa-times"></i>');
// Add event listener
closeButton.on('click', function () {
if (window.self !== window.top) {
window.parent.postMessage('closeFullscreen', '*');
} else {
console.log('close history.back');
window.history.back();
}
closeFullScreenOrHistoryBack();
});
// Append the close button to the Video.js player
elementToAppend.append(closeButton);