Skip to content

Commit

Permalink
Improve search form
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Feb 11, 2025
1 parent be16a35 commit 4c30590
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 27 deletions.
3 changes: 2 additions & 1 deletion plugin/YouPHPFlix2/view/modeFlixBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@
<?php
}
if ($obj->Categories) {
$videoFound = true; // it will be decided inside the infinity scroll
$url = "{$global['webSiteRootURL']}plugin/YouPHPFlix2/view/modeFlixCategory.php";
if (!empty($_REQUEST['catName'])) {
$url = addQueryStringParameter($url, 'catName', $_REQUEST['catName']);
Expand All @@ -505,7 +506,7 @@
<i class="fas fa-spinner fa-pulse text-muted"></i>
</div>
</div>
<script src="<?php echo getCDN(); ?>node_modules/infinite-scroll/dist/infinite-scroll.pkgd.min.js" type="text/javascript"></script>
<script src="<?php echo getURL('node_modules/infinite-scroll/dist/infinite-scroll.pkgd.min.js'); ?>" type="text/javascript"></script>
<script>
$(document).ready(function() {
$container = $('#categoriesContainer').infiniteScroll({
Expand Down
3 changes: 2 additions & 1 deletion plugin/YouPHPFlix2/view/modeFlixCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
}
TimeLogEnd($timeLog, __LINE__);
if (empty($videosCounter)) {
include_once __DIR__.'/notFoundHTML.php';
echo "</div>";
return false;
}
Expand Down Expand Up @@ -165,4 +166,4 @@
ObjectYPT::setCache($cacheName, $cache);

echo str_replace('{serie_uid}', uniqid(), $cache);
?>
?>
21 changes: 9 additions & 12 deletions view/include/navbarSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,20 @@
<div class="navbar-header">

<div class="navbar-header">
<button type="button" class="visible-xs navbar-toggle btn btn-default navbar-btn faa-parent animated-hover animate__animated animate__bounceIn" data-toggle="collapse" data-target="#mysearch" style="padding: 6px 12px;">
<button type="button" class="visible-xs navbar-toggle btn btn-default navbar-btn faa-parent animated-hover" data-toggle="collapse" data-target="#mysearch" style="padding: 6px 12px;">
<span class="fa fa-search faa-shake"></span>
</button>
</div>
<div class="input-group" id="mysearch">
<form class="navbar-form form-inline input-group" role="search" id="searchForm" method="get" action="<?php echo $global['webSiteRootURL']; ?>">
<span class="input-group-prepend">
<button type="button" id="filterButton"
class="btn btn-default navbar-btn dropdown-toggle faa-parent animated-hover animate__animated animate__bounceIn"
<button type="button" id="filterButton"
class="btn btn-default navbar-btn dropdown-toggle"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-sliders-h"></i>
</button>
</span>
<input class="form-control globalsearchfield" type="text" value="<?php
if (!empty($_GET['search'])) {
echo htmlentities($_GET['search']);
}
?>" name="search" placeholder="<?php echo __("Search"); ?>" id="searchFormInput">
<input class="form-control globalsearchfield" type="text" name="search" placeholder="<?php echo __("Search"); ?>" id="searchFormInput">
<span class="input-group-append">
<button class="btn btn-default btn-outline-secondary border-right-0 border py-2 faa-parent animated-hover" type="submit" id="buttonSearch" data-toggle="collapse" data-target="#mysearch">
<i class="fas fa-search faa-shake notLoadingIcon"></i>
Expand All @@ -42,20 +38,21 @@ class="btn btn-default navbar-btn dropdown-toggle faa-parent animated-hover anim
var searchSelectedTagVal = '';
var searchSelectedCategory = '';
var searchSelectedTag = '';

function updateSearchSelectedValues() {
searchTotalSelectedSearchIn = $('#search-tab .form-check-input:checked').length;
searchSelectedCategoryVal = $('#filter-tab .form-check-input:checked').val();
searchSelectedTagVal = $('#filter-tags-tab .form-check-input:checked').val();
searchSelectedCategory = $('#filter-tab .form-check-input:checked').parent().find('.form-check-label').html();
searchSelectedTag = $('#filter-tags-tab .form-check-input:checked').parent().find('.form-check-label').html();
}

$(document).ready(function () {
$('#filterButton').click(function () {
$('#filterDropdown').toggleClass('show');
});
setSearchFilterIcon();
$("#searchFormInput").val(getSearchParam("search"));
});
function setSearchFilterIcon() {
updateSearchSelectedValues();
Expand All @@ -71,5 +68,5 @@ function setSearchFilterIcon() {
$('#filterButton').addClass('active');
}
}
</script>

</script>
18 changes: 5 additions & 13 deletions view/js/navbarLogged.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ $(document).ready(function () {
$("#buttonSearch").click(function (event) {
event.stopPropagation();
if (isSearchOpen()) {
closeSearchMenu();
modal.showPleaseWait();
//closeSearchMenu();
} else {
openSearchMenu();
}
Expand Down Expand Up @@ -109,7 +110,6 @@ $(document).ready(function () {
$(selector).attr('aria-expanded', 'false');

$("#mysearch").css({ display: '' });
$("#mysearch").removeClass('animate__bounceOutUp');
}
});
});
Expand Down Expand Up @@ -149,26 +149,18 @@ async function openRightMenu() {
}
var selector = '#buttonMyNavbar svg';
$(selector).addClass('active');
$("#myNavbar").removeClass('animate__bounceOutRight');
$("#myNavbar").show();
$("#myNavbar").addClass('animate__animated animate__bounceInRight');
}

async function closeSearchMenu() {
$("#mysearch").removeClass('animate__bounceInDown');
$("#mysearch").addClass('animate__bounceOutUp');
setTimeout(function () {
$("#mysearch").hide();
}, 500);
$("#mysearch").hide();
}
async function openSearchMenu() {
if (isScreeWidthCollapseSize()) {
closeLeftMenu();
closeRightMenu();
}
$("#mysearch").removeClass('animate__bounceOutUp');
$("#mysearch").show();
$("#mysearch").addClass('animate__animated animate__bounceInDown');
}

async function seachFormPlayURL(url) {
Expand Down Expand Up @@ -200,7 +192,7 @@ async function seachFormPlayURL(url) {
}

function isSearchOpen() {
return $('#mysearch').hasClass('animate__bounceInDown');
return $("#mysearch").is(":visible");
}
function isMyNMavbarOpen() {
return $('#myNavbar').hasClass('animate__bounceInRight');
Expand Down Expand Up @@ -319,4 +311,4 @@ $(document).ready(function () {
setTimeout(function () {
flickityReload();
}, 5000);
});
});
5 changes: 5 additions & 0 deletions view/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,18 @@ if (window.navigator.standalone || window.matchMedia('(display-mode: standalone)
document.body.classList.add('pwa');
}


var queryString = window.location.search;
var urlParams = new URLSearchParams(queryString);

if (urlParams.has('debug')) {
isDebuging = false;
}

function getSearchParam(param) {
return urlParams.get(param) || "";
}

function forwardToIframe(data) {
var iframe = document.getElementById('avideoModalIframe'); // Get the iframe by ID
if (iframe && iframe.contentWindow) {
Expand Down

0 comments on commit 4c30590

Please sign in to comment.