1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 10:49:36 +02:00
This commit is contained in:
Daniel Neto 2024-05-08 15:12:39 -03:00
parent 706a11bdb9
commit 42d4e2d5bd
2 changed files with 19 additions and 9 deletions

View file

@ -3526,7 +3526,7 @@ if (typeof gtag !== \"function\") {
?> ?>
</div> </div>
</div> </div>
<div class="panel-footer " style="font-size: 0.8em"> <div class="panel-footer channelsFooter" style="font-size: 0.8em">
<div class=" text-muted"> <div class=" text-muted">
<?php echo number_format_short(VideoStatistic::getChannelsTotalViews($users_id)), " ", __("Views in the last 30 days"); ?> <?php echo number_format_short(VideoStatistic::getChannelsTotalViews($users_id)), " ", __("Views in the last 30 days"); ?>
</div> </div>

View file

@ -27,6 +27,9 @@ try {
var avideoIsOnline = false; var avideoIsOnline = false;
var userLang = navigator.language || navigator.userLanguage; var userLang = navigator.language || navigator.userLanguage;
var iframeAllowAttributes = 'allow="fullscreen;autoplay;camera *;microphone *;" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen"'; var iframeAllowAttributes = 'allow="fullscreen;autoplay;camera *;microphone *;" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen"';
// make sure it does not close all the windows in cascade
var _justPropagateClose = false;
// Create browser compatible event handler. // Create browser compatible event handler.
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
@ -53,7 +56,9 @@ try {
tryToPlayMuted(currentTime); tryToPlayMuted(currentTime);
} }
} }
forwardToIframe(e.data); if(!_justPropagateClose && e.data !== 'closeFullscreen'){
forwardToIframe(e.data);
}
}, false); }, false);
eventer("online", function (e) { eventer("online", function (e) {
@ -85,6 +90,8 @@ if (urlParams.has('debug')) {
function forwardToIframe(data) { function forwardToIframe(data) {
var iframe = document.getElementById('avideoModalIframe'); // Get the iframe by ID var iframe = document.getElementById('avideoModalIframe'); // Get the iframe by ID
if (iframe && iframe.contentWindow) { if (iframe && iframe.contentWindow) {
console.trace('forwardToIframe');
console.log('forwardToIframe', data);
iframe.contentWindow.postMessage(data, '*'); // Send the message to the iframe, replace '*' with the iframe's origin for security iframe.contentWindow.postMessage(data, '*'); // Send the message to the iframe, replace '*' with the iframe's origin for security
} }
} }
@ -1412,7 +1419,9 @@ function avideoModalIframeClose() {
} }
} }
try { try {
if (inIframe()) { if (!_justPropagateClose && inIframe()) {
console.trace('window.parent.swal.close()');
console.log('window.parent.swal.close() _justPropagateClose', _justPropagateClose);
window.parent.swal.close(); window.parent.swal.close();
} }
} catch (e) { } catch (e) {
@ -1425,16 +1434,13 @@ function avideoModalIframeFullScreenClose() {
} }
function closeFullscreenVideo() { function closeFullscreenVideo() {
console.trace('closeFullscreenVideo');
avideoModalIframeClose(); avideoModalIframeClose();
} }
// make sure it does not close all the windows in cascade
var _justPropagateClose = false;
// Listen for messages from child frames // Listen for messages from child frames
window.addEventListener('message', function (event) { window.addEventListener('message', function (event) {
if (event.data === 'closeFullscreen') { if (event.data === 'closeFullscreen') {
_justPropagateClose = true;
setTimeout(function(){_justPropagateClose = false;},500);
// Call the function to close fullscreen video // Call the function to close fullscreen video
closeFullscreenVideo(); closeFullscreenVideo();
} }
@ -3978,8 +3984,12 @@ function addCloseButton(elementToAppend) {
if (window.self !== window.top) { if (window.self !== window.top) {
//window.parent.closeFullscreenVideo(); //window.parent.closeFullscreenVideo();
if(!_justPropagateClose){ if(!_justPropagateClose){
console.log('close parent iframe'); _justPropagateClose = true;
console.trace(); console.log('close parent iframe _justPropagateClose = true');
setTimeout(function(){
_justPropagateClose = false;
console.log('_justPropagateClose = false');
},10000);
window.parent.postMessage('closeFullscreen', '*'); window.parent.postMessage('closeFullscreen', '*');
}else{ }else{
console.log('close parent iframe _justPropagateClose'); console.log('close parent iframe _justPropagateClose');