mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
Update, the first page now as a load more instead a paginaton
This commit is contained in:
parent
dde371e59d
commit
b6d47e94c8
7 changed files with 58 additions and 24 deletions
|
@ -1,12 +1,14 @@
|
|||
|
||||
<button class="btn btn-default btn-block loadInfiniteScrollButton" id="loadInfiniteScrollButton$uid">
|
||||
<div style="display: inline-flex;">
|
||||
<div class="scroller-status scroller-status$uid">
|
||||
<div class="infinite-scroll-request loader-ellips text-center">
|
||||
<i class="fas fa-spinner fa-pulse text-muted"></i>
|
||||
</div>
|
||||
</div>
|
||||
<i class="fas fa-angle-double-down"></i>
|
||||
$laodMore
|
||||
</div>
|
||||
|
||||
<i class="fas fa-angle-double-down"></i>
|
||||
$laodMore
|
||||
</button>
|
||||
<script src="$webSiteRootURLnode_modules/infinite-scroll/dist/infinite-scroll.pkgd.min.js" type="text/javascript"></script>
|
||||
<script>
|
||||
|
@ -24,7 +26,7 @@
|
|||
status: '.scroller-status$uid',
|
||||
hideNav: '.infiniteScrollPagination$uid',
|
||||
debug: false,
|
||||
prefill: true,
|
||||
prefill: $loadOnScroll,
|
||||
history: false,
|
||||
checkLastPage: false,
|
||||
button: '#loadInfiniteScrollButton$uid',
|
||||
|
|
|
@ -7280,7 +7280,7 @@ function getSEOTitle($text, $maxChars = 120)
|
|||
}
|
||||
}
|
||||
|
||||
function getPagination($total, $page = 0, $link = "", $maxVisible = 10, $infinityScrollGetFromSelector = "", $infinityScrollAppendIntoSelector = "", $loadOnScroll = true)
|
||||
function getPagination($total, $page = 0, $link = "", $maxVisible = 10, $infinityScrollGetFromSelector = "", $infinityScrollAppendIntoSelector = "", $loadOnScroll = true, $showOnly='')
|
||||
{
|
||||
global $global, $advancedCustom;
|
||||
if ($total < 2) {
|
||||
|
@ -7293,7 +7293,7 @@ function getPagination($total, $page = 0, $link = "", $maxVisible = 10, $infinit
|
|||
|
||||
$isInfiniteScroll = !empty($infinityScrollGetFromSelector) && !empty($infinityScrollAppendIntoSelector);
|
||||
|
||||
$uid = md5($link);
|
||||
$uid = uniqid();
|
||||
|
||||
if ($total < $maxVisible) {
|
||||
$maxVisible = $total;
|
||||
|
@ -7307,6 +7307,12 @@ function getPagination($total, $page = 0, $link = "", $maxVisible = 10, $infinit
|
|||
$link .= (parse_url($link, PHP_URL_QUERY) ? '&' : '?') . 'current={page}';
|
||||
}
|
||||
}
|
||||
if($isInfiniteScroll){
|
||||
$link = addQueryStringParameter($link, 'isInfiniteScroll', 1);
|
||||
}
|
||||
if(is_string($showOnly)){
|
||||
$link = addQueryStringParameter($link, 'showOnly',$showOnly);
|
||||
}
|
||||
|
||||
$class = '';
|
||||
if (!empty($infinityScrollGetFromSelector) && !empty($infinityScrollAppendIntoSelector)) {
|
||||
|
@ -7391,7 +7397,7 @@ function getPagination($total, $page = 0, $link = "", $maxVisible = 10, $infinit
|
|||
$content = file_get_contents($global['systemRootPath'] . 'objects/functiongetPagination.php');
|
||||
$pag .= str_replace(
|
||||
['$uid', '$webSiteRootURL', '$infinityScrollGetFromSelector', '$infinityScrollAppendIntoSelector', '$laodMore', '$loadOnScroll'],
|
||||
[$uid, $global['webSiteRootURL'], $infinityScrollGetFromSelector, $infinityScrollAppendIntoSelector, __('Load More'), ($loadOnScroll?'true':'false')],
|
||||
[$uid, $global['webSiteRootURL'], $infinityScrollGetFromSelector, $infinityScrollAppendIntoSelector, __('Load More'), (!empty($loadOnScroll)?'true':'false')],
|
||||
$content
|
||||
);
|
||||
}
|
||||
|
@ -7812,6 +7818,12 @@ function isIframe()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
function isInfiniteScroll()
|
||||
{
|
||||
return !empty($_GET['isInfiniteScroll']);
|
||||
}
|
||||
|
||||
function inIframe()
|
||||
{
|
||||
return isIframe();
|
||||
|
|
|
@ -129,6 +129,9 @@ class ADs extends PluginAbstract
|
|||
|
||||
public function getHeadCode()
|
||||
{
|
||||
if(isInfiniteScroll()){
|
||||
return '';
|
||||
}
|
||||
$head = "";
|
||||
//$head .= "<script> var adsbygoogleTimeout = []; </script>";
|
||||
if (!empty($_GET['abkw'])) {
|
||||
|
@ -387,6 +390,9 @@ class ADs extends PluginAbstract
|
|||
public static function getAdsCode($type)
|
||||
{
|
||||
global $global;
|
||||
if(isInfiniteScroll()){
|
||||
return false;
|
||||
}
|
||||
if (isBot()) {
|
||||
self::debug(__LINE__);
|
||||
return false;
|
||||
|
@ -555,6 +561,10 @@ class ADs extends PluginAbstract
|
|||
public function getFooterCode()
|
||||
{
|
||||
global $global;
|
||||
|
||||
if(isInfiniteScroll()){
|
||||
return '';
|
||||
}
|
||||
$js = "<script>$(function(){
|
||||
$('.carousel').carousel({
|
||||
interval: 5000
|
||||
|
|
|
@ -19,9 +19,12 @@ function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord,
|
|||
global $contentSearchFound;
|
||||
$title = __($title);
|
||||
$getName = str_replace(array("'", '"', """, "'"), array('', '', '', ''), xss_esc($getName));
|
||||
if (!empty($_GET['showOnly'])) {
|
||||
/*
|
||||
if (!empty($_GET['showOnly']) && !isInfiniteScroll()) {
|
||||
$rowCount = 24;
|
||||
}
|
||||
*/
|
||||
|
||||
global $global, $args, $url;
|
||||
$paggingId = uniqid();
|
||||
$uid = "gallery" . uniqid();
|
||||
|
@ -81,7 +84,7 @@ function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord,
|
|||
$videos = Video::getAllVideos($videoStatus, false, $ignoreGroup);
|
||||
// need to add dechex because some times it return an negative value and make it fails on javascript playlists
|
||||
?>
|
||||
<div class="gallerySectionContent">
|
||||
<div class="gallerySectionContent<?php echo $getName; ?>">
|
||||
<?php
|
||||
$countCols = createGallerySection($videos);
|
||||
?>
|
||||
|
@ -95,11 +98,11 @@ function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord,
|
|||
$infinityScrollGetFromSelector = "";
|
||||
$infinityScrollAppendIntoSelector = "";
|
||||
if ($infinityScroll) {
|
||||
$infinityScrollGetFromSelector = ".gallerySectionContent";
|
||||
$infinityScrollAppendIntoSelector = ".gallerySectionContent";
|
||||
$infinityScrollGetFromSelector = ".gallerySectionContent{$getName}";
|
||||
$infinityScrollAppendIntoSelector = ".gallerySectionContent{$getName}";
|
||||
}
|
||||
|
||||
echo getPagination($totalPages, $page, "{$url}{page}{$args}", 10, $infinityScrollGetFromSelector, $infinityScrollAppendIntoSelector);
|
||||
echo getPagination($totalPages, $page, "{$url}{page}{$args}", 10, $infinityScrollGetFromSelector, $infinityScrollAppendIntoSelector, false, $getName);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
|
|
|
@ -41,7 +41,7 @@ saveRequestVars();
|
|||
global $contentSearchFound;
|
||||
$contentSearchFound = true;
|
||||
$img_portrait = ($video['rotation'] === "90" || $video['rotation'] === "270") ? "img-portrait" : "";
|
||||
if (empty($_GET['search'])) {
|
||||
if (empty($_GET['search']) && !isInfiniteScroll()) {
|
||||
include $global['systemRootPath'] . 'plugin/Gallery/view/BigVideo.php';
|
||||
}
|
||||
echo '<center style="margin:5px;">' . getAdsLeaderBoardTop2() . '</center>';
|
||||
|
@ -80,17 +80,17 @@ saveRequestVars();
|
|||
continue;
|
||||
}
|
||||
$countSections++;
|
||||
if (preg_match('/Channel_([0-9]+)_/', $value['name'], $matches)) {
|
||||
if (preg_match('/Channel_([0-9]+)_/', $value['name'], $matches) && empty($_GET['showOnly'])) {
|
||||
$users_id = intval($matches[1]);
|
||||
User::getChannelPanel($users_id);
|
||||
} else
|
||||
if ($value['name'] == 'Shorts' && AVideoPlugin::isEnabledByName('Shorts')) {
|
||||
if ($value['name'] == 'Shorts' && empty($_GET['showOnly']) && AVideoPlugin::isEnabledByName('Shorts')) {
|
||||
include $global['systemRootPath'] . 'plugin/Shorts/row.php';
|
||||
} else
|
||||
if ($value['name'] == 'Suggested') {
|
||||
createGallery(!empty($obj->SuggestedCustomTitle) ? $obj->SuggestedCustomTitle : __("Suggested"), 'suggested', $obj->SuggestedRowCount, 'SuggestedOrder', "", "", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-star");
|
||||
createGallery(!empty($obj->SuggestedCustomTitle) ? $obj->SuggestedCustomTitle : __("Suggested"), 'suggested', $obj->SuggestedRowCount, 'SuggestedOrder', "", "", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-star", true);
|
||||
} else
|
||||
if(empty(getSearchVar()) && $value['name'] == 'PlayLists'){
|
||||
if(empty(getSearchVar()) && empty($_GET['showOnly']) && $value['name'] == 'PlayLists'){
|
||||
$objPl = AVideoPlugin::getDataObject('PlayLists');
|
||||
$plRows = PlayList::getAllToShowOnFirstPage();
|
||||
//var_dump(count($plRows));exit;
|
||||
|
@ -122,22 +122,22 @@ saveRequestVars();
|
|||
}
|
||||
}else
|
||||
if ($value['name'] == 'Trending') {
|
||||
createGallery(!empty($obj->TrendingCustomTitle) ? $obj->TrendingCustomTitle : __("Trending"), 'trending', $obj->TrendingRowCount, 'TrendingOrder', "zyx", "abc", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-chart-line");
|
||||
createGallery(!empty($obj->TrendingCustomTitle) ? $obj->TrendingCustomTitle : __("Trending"), 'trending', $obj->TrendingRowCount, 'TrendingOrder', "zyx", "abc", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-chart-line", true);
|
||||
} else
|
||||
if ($value['name'] == 'SortByName') {
|
||||
createGallery(!empty($obj->SortByNameCustomTitle) ? $obj->SortByNameCustomTitle : __("Sort by name"), 'title', $obj->SortByNameRowCount, 'sortByNameOrder', "zyx", "abc", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-font");
|
||||
createGallery(!empty($obj->SortByNameCustomTitle) ? $obj->SortByNameCustomTitle : __("Sort by name"), 'title', $obj->SortByNameRowCount, 'sortByNameOrder', "zyx", "abc", $orderString, "ASC", !$obj->hidePrivateVideos, "fas fa-font", true);
|
||||
} else
|
||||
if ($value['name'] == 'DateAdded' && empty($_REQUEST['catName'])) {
|
||||
createGallery(!empty($obj->DateAddedCustomTitle) ? $obj->DateAddedCustomTitle : __("Date added"), 'created', $obj->DateAddedRowCount, 'dateAddedOrder', __("newest"), __("oldest"), $orderString, "DESC", !$obj->hidePrivateVideos, "far fa-calendar-alt");
|
||||
createGallery(!empty($obj->DateAddedCustomTitle) ? $obj->DateAddedCustomTitle : __("Date added"), 'created', $obj->DateAddedRowCount, 'dateAddedOrder', __("newest"), __("oldest"), $orderString, "DESC", !$obj->hidePrivateVideos, "far fa-calendar-alt", true);
|
||||
} else
|
||||
if ($value['name'] == 'PrivateContent') {
|
||||
createGallery(!empty($obj->PrivateContentCustomTitle) ? $obj->PrivateContentCustomTitle : __("Private Content"), 'created', $obj->PrivateContentRowCount, 'privateContentOrder', __("Most"), __("Fewest"), $orderString, "DESC", true, "fas fa-lock");
|
||||
createGallery(!empty($obj->PrivateContentCustomTitle) ? $obj->PrivateContentCustomTitle : __("Private Content"), 'created', $obj->PrivateContentRowCount, 'privateContentOrder', __("Most"), __("Fewest"), $orderString, "DESC", true, "fas fa-lock", true);
|
||||
} else
|
||||
if ($value['name'] == 'MostWatched') {
|
||||
createGallery(!empty($obj->MostWatchedCustomTitle) ? $obj->MostWatchedCustomTitle : __("Most watched"), 'views_count', $obj->MostWatchedRowCount, 'mostWatchedOrder', __("Most"), __("Fewest"), $orderString, "DESC", !$obj->hidePrivateVideos, "far fa-eye");
|
||||
createGallery(!empty($obj->MostWatchedCustomTitle) ? $obj->MostWatchedCustomTitle : __("Most watched"), 'views_count', $obj->MostWatchedRowCount, 'mostWatchedOrder', __("Most"), __("Fewest"), $orderString, "DESC", !$obj->hidePrivateVideos, "far fa-eye", true);
|
||||
} else
|
||||
if ($value['name'] == 'MostPopular') {
|
||||
createGallery(!empty($obj->MostPopularCustomTitle) ? $obj->MostPopularCustomTitle : __("Most popular"), 'likes', $obj->MostPopularRowCount, 'mostPopularOrder', __("Most"), __("Fewest"), $orderString, "DESC", !$obj->hidePrivateVideos, "fas fa-fire");
|
||||
createGallery(!empty($obj->MostPopularCustomTitle) ? $obj->MostPopularCustomTitle : __("Most popular"), 'likes', $obj->MostPopularRowCount, 'mostPopularOrder', __("Most"), __("Fewest"), $orderString, "DESC", !$obj->hidePrivateVideos, "fas fa-fire", true);
|
||||
} else
|
||||
if ($value['name'] == 'SubscribedChannels' && User::isLogged() && empty($_GET['showOnly'])) {
|
||||
include $global['systemRootPath'] . 'plugin/Gallery/view/mainAreaChannels.php';
|
||||
|
|
|
@ -2051,6 +2051,11 @@ body.ypt-is-compressed #videoCol {
|
|||
.loadInfiniteScrollButton .scroller-status{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.loadInfiniteScrollButton:disabled .fas.fa-angle-double-down {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/*
|
||||
#_avideoPageLoader{
|
||||
display: none !important;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
$tTolerance = 0.2;
|
||||
$tname = TimeLogStart(basename(__FILE__));
|
||||
if (isset($_GET['noNavbar'])) {
|
||||
if (isInfiniteScroll()) {
|
||||
return '';
|
||||
} else if (isset($_GET['noNavbar'])) {
|
||||
_session_start();
|
||||
if (!empty($_GET['noNavbar'])) {
|
||||
$_SESSION['noNavbar'] = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue