Skip to content

Commit

Permalink
Update favorite buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Sep 13, 2024
1 parent 614c540 commit fdb3819
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
20 changes: 10 additions & 10 deletions objects/video.php
Original file line number Diff line number Diff line change
Expand Up @@ -6602,7 +6602,7 @@ public static function getVideosListItem($videos_id, $divID = '', $style = '')
return str_replace($search, $replace, $templateContent);
}

public static function generatePlaylistButtons($videos_id, $buttonClass = 'btn btn-dark btn-xs', $iconStyle = 'color: #4285f4;', $isVertical = true)
public static function generatePlaylistButtons($videos_id, $buttonClass = 'btn btn-dark btn-xs', $style = 'background-color: #11111199;', $isVertical = true)
{
if (empty($videos_id) || !User::isLogged()) {
return '';
Expand All @@ -6621,20 +6621,20 @@ public static function generatePlaylistButtons($videos_id, $buttonClass = 'btn b
$favoriteBtnStyle = $isFavorite ? "display: none;" : "";

// Add a layout style to force vertical stacking if required
$layoutStyle = $isVertical ? "display: block; margin-bottom: 5px;" : "display: inline-block; margin-right: 5px;";
$layoutStyle .= 'display: none;';
$layoutStyle = $isVertical ? "display: block;" : "display: inline-block; margin-right: 5px;";
$layoutStyle .= 'display: none;';
$placement = 'top';
if ($isVertical) {
$placement = 'left';
}

// Generate the buttons for Watch Later and Favorite
$buttonsHTML = '
<button onclick="addVideoToPlayList(' . $videos_id . ', false, ' . $watchLaterId . '); return false;" class="' . $buttonClass . ' watchLaterBtnAdded watchLaterBtnAdded' . $videos_id . '" data-toggle="tooltip" data-placement="'.$placement.'" title=' . printJSString("Added On Watch Later", true) . ' style="' . $iconStyle . $watchLaterBtnAddedStyle . $layoutStyle . '">
<button onclick="addVideoToPlayList(' . $videos_id . ', false, ' . $watchLaterId . '); return false;" class="' . $buttonClass . ' watchLaterBtnAdded watchLaterBtnAdded' . $videos_id . '" data-toggle="tooltip" data-placement="' . $placement . '" title=' . printJSString("Added On Watch Later", true) . ' style="' . $style . $watchLaterBtnAddedStyle . $layoutStyle . '">
<i class="fas fa-check"></i>
</button>
<button onclick="addVideoToPlayList(' . $videos_id . ', true, ' . $watchLaterId . '); return false;" class="' . $buttonClass . ' watchLaterBtn watchLaterBtn' . $videos_id . '" data-toggle="tooltip" data-placement="'.$placement.'" title=' . printJSString("Watch Later", true) . ' style="' . $watchLaterBtnStyle . $layoutStyle . '">
<i class="fas fa-clock"></i>
<button onclick="addVideoToPlayList(' . $videos_id . ', true, ' . $watchLaterId . '); return false;" class="' . $buttonClass . ' watchLaterBtn watchLaterBtn' . $videos_id . ' faa-parent animated-hover" data-toggle="tooltip" data-placement="' . $placement . '" title=' . printJSString("Watch Later", true) . ' style="' . $style . $watchLaterBtnStyle . $layoutStyle . '">
<i class="fas fa-clock faa-spin"></i>
</button>';

// Add line break for vertical layout
Expand All @@ -6643,10 +6643,10 @@ public static function generatePlaylistButtons($videos_id, $buttonClass = 'btn b
}

$buttonsHTML .= '
<button onclick="addVideoToPlayList(' . $videos_id . ', false, ' . $favoriteId . '); return false;" class="' . $buttonClass . ' favoriteBtnAdded favoriteBtnAdded' . $videos_id . '" data-toggle="tooltip" data-placement="'.$placement.'" title=' . printJSString("Added On Favorite", true) . ' style="' . $iconStyle . $favoriteBtnAddedStyle . $layoutStyle . '">
<button onclick="addVideoToPlayList(' . $videos_id . ', false, ' . $favoriteId . '); return false;" class="' . $buttonClass . ' favoriteBtnAdded favoriteBtnAdded' . $videos_id . '" data-toggle="tooltip" data-placement="' . $placement . '" title=' . printJSString("Added On Favorite", true) . ' style="' . $style . $favoriteBtnAddedStyle . $layoutStyle . '">
<i class="fas fa-check"></i>
</button>
<button onclick="addVideoToPlayList(' . $videos_id . ', true, ' . $favoriteId . '); return false;" class="' . $buttonClass . ' favoriteBtn favoriteBtn' . $videos_id . ' faa-parent animated-hover" data-toggle="tooltip" data-placement="'.$placement.'" title=' . printJSString("Favorite", true) . ' style="' . $favoriteBtnStyle . $layoutStyle . '">
<button onclick="addVideoToPlayList(' . $videos_id . ', true, ' . $favoriteId . '); return false;" class="' . $buttonClass . ' favoriteBtn favoriteBtn' . $videos_id . ' faa-parent animated-hover" data-toggle="tooltip" data-placement="' . $placement . '" title=' . printJSString("Favorite", true) . ' style="' . $style . $favoriteBtnStyle . $layoutStyle . '">
<i class="fas fa-heart faa-pulse faa-fast"></i>
</button>';
$buttonsHTML .= '<script>$(function () {reloadPlayLists();});</script>';
Expand Down Expand Up @@ -6720,15 +6720,15 @@ public static function getVideoImagewithHoverAnimationFromVideosId($videos_id, $
$galleryVideoButtons = '<!-- getVideoImagewithHoverAnimationFromVideosId generatePlaylistButtons -->';

$galleryDropDownMenu = Gallery::getVideoDropdownMenu($videos_id);

$galleryVideoButtons .= '<!-- getVideoImagewithHoverAnimationFromVideosId -->';
$galleryVideoButtons .= '<div class="galleryVideoButtons ' . getCSSAnimationClassAndStyle('animate__flipInY', uniqid(), 0) . '">';
$galleryVideoButtons .= self::generatePlaylistButtons($videos_id);
if (Video::canEdit($videos_id)) {
$galleryVideoButtons .= '<div class="clearfix"></div>
<button onclick="avideoModalIframe(webSiteRootURL + \'view/managerVideosLight.php?image=1&avideoIframe=1&videos_id=' . $videos_id . '\');return false;" class="btn btn-dark btn-xs" data-toggle="tooltip" data-placement="left" title=' . printJSString("Edit Thumbnail", true) . '><i class="fas fa-edit"></i></button>';
}
$galleryVideoButtons .= '<div class="clearfix"></div>'.$galleryDropDownMenu ;
$galleryVideoButtons .= '<div class="clearfix"></div>' . $galleryDropDownMenu;
$galleryVideoButtons .= '</div>';

// Get links for the video or playlist
Expand Down
6 changes: 4 additions & 2 deletions plugin/YouPHPFlix2/view/modeFlixBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@
?>
<span style="margin-left: 10px;">
<?php
echo Video::generatePlaylistButtons($videoSerie['id'], 'btn btn-dark btn-xs', 'color: #4285f4; ', false);
echo Video::generatePlaylistButtons($videoSerie['id'], 'btn btn-dark btn-xs', 'background-color: #11111199;', false);
?>
</span>
<?php
}else{
echo '<!-- Playlists_id ['.$pl['id'].'] is not a serie -->';
}
?>
</h2>
Expand Down Expand Up @@ -192,7 +194,7 @@
</a>
<span style="margin-left: 10px;">
<?php
echo Video::generatePlaylistButtons($serie['id'], 'btn btn-dark btn-xs', 'color: #4285f4; ', false);
echo Video::generatePlaylistButtons($serie['id'], 'btn btn-dark btn-xs', 'background-color: #11111199;', false);
?>
</span>
</h2>
Expand Down
3 changes: 3 additions & 0 deletions plugin/YouPHPFlix2/view/row.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ class="tile__img <?php echo $cssClass; ?> thumbsJPG img img-responsive carousel-
<?php if (!empty($imgGif)) { ?>
<img style="position: absolute; top: 0; display: none;" src="<?php echo ImagesPlaceHolders::getImageLandscape(ImagesPlaceHolders::$RETURN_URL); ?>" alt="<?php echo $value['title']; ?>" id="tile__img thumbsGIF<?php echo $value['id']; ?>" class="thumbsGIF img-responsive img carousel-cell-image" data-flickity-lazyload="<?php echo $imgGif; ?>" />
<?php } ?>
<div style="position: absolute; right: 5px; top: 0;">
<?php echo Video::generatePlaylistButtons($value['id'], 'btn btn-dark btn-xs', 'background-color: #11111199;'); ?>
</div>
<?php
if ($advancedCustom->paidOnlyShowLabels && $obj->paidOnlyLabelOverPoster) {
foreach ($value['tags'] as $value2) {
Expand Down
4 changes: 4 additions & 0 deletions view/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,10 @@ img.blur {
border-color: #000;
}

.btn-dark.watchLaterBtnAdded, .btn-dark.favoriteBtnAdded {
color: #4285f4;
}

.opacityBtn {
opacity: 0.2;
}
Expand Down

0 comments on commit fdb3819

Please sign in to comment.