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() {
$global;
if(empty($_SERVER['HTTP_USER_AGENT'])){
return false;
}
if(!empty($global['forceOldChrome'])){
return true;
}

View file

@ -201,7 +201,6 @@ class Live extends PluginAbstract {
if(isLive() || isEmbed()){
$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>body.fullScreen{overflow: hidden;}</style>';
}
$js .= '<script>var playLiveInFullScreen = true</script>';
$css .= '<style>body.fullScreen{overflow: hidden;}</style>';

View file

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

View file

@ -216,138 +216,48 @@ include $global['systemRootPath'] . 'plugin/YouPHPFlix2/view/BigVideo.php';
}
TimeLogEnd($timeLog, __LINE__);
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>
<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>
$(document).ready(function () {
$container = $('#categoriesContainer').infiniteScroll({
path: '.pagination__next',
append: '.categoriesContainerItem',
status: '.scroller-status',
hideNav: '.pagination',
history: false,
checkLastPage: true
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) {
var id = "#" + items[0].id;
startModeFlix(id + " ");
//console.log('Append page: ' + path);
$(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
}
?>
<script>
$(document).ready(function () {
setTimeout(function () {
$("img.thumbsJPG").each(function (index) {
$(this).attr('src', $(this).attr('data-flickity-lazyload'));
$(this).addClass('flickity-lazyloaded');
});
lazyImage();
if (typeof linksToFullscreen === 'function') {
linksToFullscreen('a.galleryLink');
}
});
setTimeout(function () {
lazyImage();
if (typeof linksToFullscreen === 'function') {
linksToFullscreen('a.galleryLink');
}
}, 500);
});
</script>

View file

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