1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 02:39:46 +02:00

Fix category load

This commit is contained in:
DanielnetoDotCom 2020-12-14 12:16:52 -03:00
parent 425e03e9a0
commit 7df9ac760f
5 changed files with 69 additions and 169 deletions

View file

@ -3220,6 +3220,9 @@ function get_browser_name($user_agent = "") {
*/ */
function isOldChromeVersion() { function isOldChromeVersion() {
$global; $global;
if(empty($_SERVER['HTTP_USER_AGENT'])){
return false;
}
if(!empty($global['forceOldChrome'])){ if(!empty($global['forceOldChrome'])){
return true; return true;
} }

View file

@ -201,7 +201,6 @@ class Live extends PluginAbstract {
if(isLive() || isEmbed()){ if(isLive() || isEmbed()){
$css .= '<link href="' . $global['webSiteRootURL'] . 'plugin/YouPHPFlix2/view/css/fullscreen.css" rel="stylesheet" type="text/css"/>'; $css .= '<link href="' . $global['webSiteRootURL'] . 'plugin/YouPHPFlix2/view/css/fullscreen.css" rel="stylesheet" type="text/css"/>';
$css .= '<style>.container-fluid {overflow: visible;padding: 0;}#mvideo{padding: 0 !important; position: absolute; top: 0;}</style>'; $css .= '<style>.container-fluid {overflow: visible;padding: 0;}#mvideo{padding: 0 !important; position: absolute; top: 0;}</style>';
$css .= '<style>body.fullScreen{overflow: hidden;}</style>';
} }
$js .= '<script>var playLiveInFullScreen = true</script>'; $js .= '<script>var playLiveInFullScreen = true</script>';
$css .= '<style>body.fullScreen{overflow: hidden;}</style>'; $css .= '<style>body.fullScreen{overflow: hidden;}</style>';

View file

@ -49,7 +49,8 @@ $(function () {
}); });
function startModeFlix(container) { function startModeFlix(container) {
console.log(container + '.carousel', $(container + '.carousel').length);
if ($(container + ".thumbsImage").attr('startModeFlix') == 1) { if ($(container + ".thumbsImage").attr('startModeFlix') == 1) {
return false; return false;
} }

View file

@ -1,6 +1,6 @@
<?php <?php
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/BigVideo.php'; include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/BigVideo.php';
$percent = 90; $percent = 90;
?> ?>
<div id="carouselRows" style=" <div id="carouselRows" style="
background-color: rgb(<?php echo $obj->backgroundRGB; ?>); background-color: rgb(<?php echo $obj->backgroundRGB; ?>);
@ -8,28 +8,28 @@ include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/BigVideo.php';
background: -o-linear-gradient(top, rgba(<?php echo $obj->backgroundRGB; ?>,1) <?php echo $percent; ?>%, rgba(<?php echo $obj->backgroundRGB; ?>,0) 100%); background: -o-linear-gradient(top, rgba(<?php echo $obj->backgroundRGB; ?>,1) <?php echo $percent; ?>%, rgba(<?php echo $obj->backgroundRGB; ?>,0) 100%);
background: linear-gradient(top, rgba(<?php echo $obj->backgroundRGB; ?>,1) <?php echo $percent; ?>%, rgba(<?php echo $obj->backgroundRGB; ?>,0) 100%); background: linear-gradient(top, rgba(<?php echo $obj->backgroundRGB; ?>,1) <?php echo $percent; ?>%, rgba(<?php echo $obj->backgroundRGB; ?>,0) 100%);
background: -moz-linear-gradient(to top, rgba(<?php echo $obj->backgroundRGB; ?>,1) <?php echo $percent; ?>%, rgba(<?php echo $obj->backgroundRGB; ?>,0) 100%); background: -moz-linear-gradient(to top, rgba(<?php echo $obj->backgroundRGB; ?>,1) <?php echo $percent; ?>%, rgba(<?php echo $obj->backgroundRGB; ?>,0) 100%);
"> ">
<?php <?php
$_REQUEST['current'] = 1; $_REQUEST['current'] = 1;
$_REQUEST['rowCount'] = $obj->maxVideos; $_REQUEST['rowCount'] = $obj->maxVideos;
TimeLogEnd($timeLog, __LINE__); TimeLogEnd($timeLog, __LINE__);
if ($obj->Suggested) { if ($obj->Suggested) {
$dataFlickirty = new stdClass(); $dataFlickirty = new stdClass();
$dataFlickirty->wrapAround = true; $dataFlickirty->wrapAround = true;
$dataFlickirty->pageDots = !empty($obj->pageDots); $dataFlickirty->pageDots = !empty($obj->pageDots);
$dataFlickirty->lazyLoad = 15; $dataFlickirty->lazyLoad = 15;
$dataFlickirty->setGallerySize = false; $dataFlickirty->setGallerySize = false;
$dataFlickirty->cellAlign = 'left'; $dataFlickirty->cellAlign = 'left';
$dataFlickirty->groupCells = true; $dataFlickirty->groupCells = true;
if ($obj->SuggestedAutoPlay) { if ($obj->SuggestedAutoPlay) {
$dataFlickirty->autoPlay = 10000; $dataFlickirty->autoPlay = 10000;
} }
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false) //getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false)
$videos = Video::getAllVideos("viewableNotUnlisted", false, true, array(), false, false, true, true); $videos = Video::getAllVideos("viewableNotUnlisted", false, true, array(), false, false, true, true);
if (!empty($videos)) { if (!empty($videos)) {
?> ?>
<div class="row topicRow"> <div class="row topicRow">
<h2> <h2>
<i class="glyphicon glyphicon-sort-by-attributes"></i> <?php <i class="glyphicon glyphicon-sort-by-attributes"></i> <?php
@ -216,141 +216,51 @@ include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/BigVideo.php';
} }
TimeLogEnd($timeLog, __LINE__); TimeLogEnd($timeLog, __LINE__);
if ($obj->Categories) { if ($obj->Categories) {
$dataFlickirty = new stdClass();
$dataFlickirty->wrapAround = true;
$dataFlickirty->pageDots = !empty($obj->pageDots);
$dataFlickirty->lazyLoad = true;
$dataFlickirty->fade = true;
$dataFlickirty->setGallerySize = false;
$dataFlickirty->cellAlign = 'left';
$dataFlickirty->groupCells = true;
if ($obj->CategoriesAutoPlay) {
$dataFlickirty->autoPlay = 10000;
$dataFlickirty->wrapAround = true;
} else {
$dataFlickirty->wrapAround = true;
}
if (!empty($_GET['catName'])) {
unset($_POST['sort']);
$_POST['sort']['v.created'] = "DESC";
$_POST['sort']['likes'] = "DESC";
$_REQUEST['current'] = 1;
$_REQUEST['rowCount'] = $obj->maxVideos;
TimeLogStart("modeFlix.php::getAllVideos");
$videos = Video::getAllVideos("viewableNotUnlisted", false, true);
TimeLogEnd("modeFlix.php::getAllVideos", __LINE__);
TimeLogStart("modeFlix.php::getCategoryByName");
$category = Category::getCategoryByName($_GET['catName']);
TimeLogEnd("modeFlix.php::getCategoryByName", __LINE__);
?>
<div class="row topicRow">
<span class="md-col-12">&nbsp;</span>
<h2>
<a href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $_GET['catName']; ?>"><i class="<?php echo $category['iconClass']; ?>"></i> <?php echo $category['name']; ?></a>
</h2>
<!-- Sub category -->
<?php
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/row.php';
?>
</div>
<?php
TimeLogStart("modeFlix.php::while(1)");
while (1) {
$_REQUEST['current']++;
$videos = Video::getAllVideos("viewableNotUnlisted", false, true);
if (empty($videos)) {
break;
}
echo '<div class="row topicRow">';
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/row.php';
echo '</div>';
}
TimeLogEnd("modeFlix.php::while(1)", __LINE__);
?>
<?php
TimeLogStart("modeFlix.php::getChildCategoriesFromTitle");
unset($_POST['sort']);
$categoriesC = Category::getChildCategoriesFromTitle($_GET['catName']);
foreach ($categoriesC as $value) {
unset($_POST['sort']);
$_GET['catName'] = $value['clean_name'];
$_POST['sort']['v.created'] = "DESC";
$_POST['sort']['likes'] = "DESC";
$videos = Video::getAllVideos("viewableNotUnlisted", false, true);
if (empty($videos)) {
continue;
}
?>
<div class="row topicRow">
<span class="md-col-12">&nbsp;</span>
<h2>
<a href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $value['clean_name']; ?>"><i class="fas fa-folder"></i> <?php echo $value['name']; ?></a>
</h2>
<!-- Sub category -->
<?php
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/row.php';
?>
</div>
<?php
unset($_GET['catName']);
}
TimeLogEnd("modeFlix.php::getChildCategoriesFromTitle", __LINE__);
} else {
?>
<div id="categoriesContainer">
</div>
<p class="pagination">
<a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/YouPHPFlix2/view/modeFlixCategory.php?current=1&rrating=<?php echo @$_GET['rrating']; ?>&search=<?php echo @$_GET['search']; ?>"></a>
</p>
<div class="scroller-status">
<div class="infinite-scroll-request loader-ellips text-center">
<i class="fas fa-spinner fa-pulse text-muted"></i>
</div>
</div>
<script>
$(document).ready(function () {
$container = $('#categoriesContainer').infiniteScroll({
path: '.pagination__next',
append: '.categoriesContainerItem',
status: '.scroller-status',
hideNav: '.pagination',
history: false,
checkLastPage: true
});
$container.on('request.infiniteScroll', function (event, path) {
//console.log('Loading page: ' + path);
});
$container.on('append.infiniteScroll', function (event, response, path, items) {
var id = "#" + items[0].id;
startModeFlix(id + " ");
$(id + " img.thumbsJPG").each(function (index) {
$(this).attr('src', $(this).attr('data-flickity-lazyload'));
$(this).addClass('flickity-lazyloaded');
});
});
$container.infiniteScroll('loadNextPage');
setTimeout(function () {
$container.infiniteScroll('loadNextPage');
}, 1000);
});
</script>
<?php
}
?> ?>
<div id="categoriesContainer"></div>
<p class="pagination infiniteScrollPagination">
<a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/YouPHPFlix2/view/modeFlixCategory.php?tags_id=<?php echo intval(@$_GET['tags_id']); ?>&search=<?php echo getSearchVar(); ?>&current=1"></a>
</p>
<div class="scroller-status">
<div class="infinite-scroll-request loader-ellips text-center">
<i class="fas fa-spinner fa-pulse text-muted"></i>
</div>
</div>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/infinite-scroll.pkgd.min.js" type="text/javascript"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
setTimeout(function () { $container = $('#categoriesContainer').infiniteScroll({
path: '.pagination__next',
append: '.categoriesContainerItem',
status: '.scroller-status',
hideNav: '.infiniteScrollPagination',
prefill: true,
history: false
});
$container.on('request.infiniteScroll', function (event, path) {
//console.log('Loading page: ' + path);
});
$container.on('append.infiniteScroll', function (event, response, path, items) {
//console.log('Append page: ' + path);
$("img.thumbsJPG").each(function (index) { $("img.thumbsJPG").each(function (index) {
$(this).attr('src', $(this).attr('data-flickity-lazyload')); $(this).attr('src', $(this).attr('data-flickity-lazyload'));
$(this).addClass('flickity-lazyloaded'); $(this).addClass('flickity-lazyloaded');
}); });
lazyImage();
if (typeof linksToFullscreen === 'function') {
linksToFullscreen('a.galleryLink');
}
});
setTimeout(function () {
lazyImage();
if (typeof linksToFullscreen === 'function') {
linksToFullscreen('a.galleryLink');
}
}, 500); }, 500);
}); });
</script> </script>
<?php <?php
} }
TimeLogEnd($timeLog, __LINE__); TimeLogEnd($timeLog, __LINE__);

View file

@ -16,17 +16,18 @@ if(empty($_GET['current'])){
$cacheName = "modeFlixCategory".md5(json_encode($_GET)).User::getId(); $cacheName = "modeFlixCategory".md5(json_encode($_GET)).User::getId();
$cache = ObjectYPT::getCache($cacheName, 600); $cache = ObjectYPT::getCache($cacheName, 600);
if(!empty($cache)){ if(false && !empty($cache)){
echo $cache; echo $cache;
exit; return false;
} }
ob_start(); ob_start();
$obj = AVideoPlugin::getObjectData("YouPHPFlix2"); $obj = AVideoPlugin::getObjectData("YouPHPFlix2");
$timeLog = __FILE__ . " - modeFlixCategory"; $timeLog = __FILE__ . " - modeFlixCategory";
$uid = uniqid(); $uid = uniqid();
$divUUID = $uid;
?> ?>
<div class="categoriesContainerItem" id="<?php echo $uid; ?>"> <div class="categoriesContainerItem" id="<?php echo $divUUID; ?>">
<?php <?php
$ads2 = getAdsLeaderBoardTop2(); $ads2 = getAdsLeaderBoardTop2();
if (!empty($ads2)) { if (!empty($ads2)) {
@ -67,10 +68,6 @@ if ($obj->Categories) {
$_REQUEST['current']=1; $_REQUEST['current']=1;
$_REQUEST['rowCount'] = $obj->maxVideos; $_REQUEST['rowCount'] = $obj->maxVideos;
$_POST['searchPhrase'] = $searchPhrase; $_POST['searchPhrase'] = $searchPhrase;
$showAllVideos = false;
if (!empty($_GET['catName'])) {
$showAllVideos = true;
}
foreach ($categories as $value) { foreach ($categories as $value) {
$obj = AVideoPlugin::getObjectData("YouPHPFlix2"); $obj = AVideoPlugin::getObjectData("YouPHPFlix2");
$timeLog2 = __FILE__ . " - Category {$value['clean_name']}"; $timeLog2 = __FILE__ . " - Category {$value['clean_name']}";
@ -106,19 +103,6 @@ if ($obj->Categories) {
TimeLogStart("modeFlixCategory.php include row"); TimeLogStart("modeFlixCategory.php include row");
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/row.php'; include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/row.php';
TimeLogEnd("modeFlixCategory.php include row", __LINE__, 0.2); TimeLogEnd("modeFlixCategory.php include row", __LINE__, 0.2);
if ($showAllVideos) {
TimeLogStart("modeFlixCategory.php showAllVideos");
while (1) {
$_REQUEST['current'] ++;
$videos = Video::getAllVideos("viewableNotUnlisted", false, true);
if (empty($videos)) {
break;
}
include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/row.php';
}
TimeLogEnd("modeFlixCategory.php showAllVideos", __LINE__, 0.2);
}
?> ?>
</div> </div>
<?php <?php
@ -129,6 +113,9 @@ if ($obj->Categories) {
TimeLogEnd($timeLog, __LINE__); TimeLogEnd($timeLog, __LINE__);
?> ?>
<script>
startModeFlix('#<?php echo $divUUID; ?> .topicRow div');
</script>
</div> </div>
<p class="pagination"> <p class="pagination">
<a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/YouPHPFlix2/view/modeFlixCategory.php?current=<?php echo count($categories)?$_REQUEST['current'] + 1:$_REQUEST['current']; ?>&rrating=<?php echo @$_GET['rrating']; ?>"></a> <a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/YouPHPFlix2/view/modeFlixCategory.php?current=<?php echo count($categories)?$_REQUEST['current'] + 1:$_REQUEST['current']; ?>&rrating=<?php echo @$_GET['rrating']; ?>"></a>