templates/vitrine/loader/search.html.twig line 1
<style>
.iq-card:hover .block-social-info {
opacity: 1;
}
.iq-card .block-social-info{
left: auto;
}
</style>
<script type="text/javascript">
const UBSearch = function(){
var program, progress, timestamp, empty = "{{'Aucun résultat trouvé !'|trans }}";
const container = "#search-offcanvas-body",
getContent = (d)=>{
$("#count-search").html("("+d.length+")");
if(d.length == 0) return `<div class="w-100 text-center"><h4>`+empty+`</h4></div>`;
const web_movie_detail = ("{{path('web_movie_detail', {'_1_':'_2_'})}}");
const web_serie_detail = ("{{path('web_series_detail', {'_1_':'_2_'})}}");
var movies = "", movie_link;
d.forEach(el => {
if(el.type){
movie_link = web_movie_detail.replace('_1_', 'm').replace('_2_',el.id);
}else if(el.nepisode){
movie_link = web_movie_detail.replace('_1_', 'e').replace('_2_',el.id);
}else{
movie_link = web_serie_detail.replace('_1_', 's').replace('_2_',el.id);
}
movies += `
<div class="col mb-4">
<div class="iq-card card-hover">
<div class="block-images position-relative w-100">
<div class="img-box w-100">
<a href="javascript:void();" class="position-absolute top-0 bottom-0 start-0 end-0"></a>
<img src="{{asset('`+el.cover+`', 'covers')}}" alt="`+el.title+`" class="img-fluid object-cover w-100 d-block border-0">
</div>
<div class="card-description with-transition">
<div class="cart-content">
<div class="content-left">
<h5 class="iq-title text-capitalize">
<a href="`+movie_link+`">`+el.title+`</a>
</h5>
<small>`+composeEpisodeName(el.nseason, el.nepisode)+` `+el.episode+`</small>
<div class="movie-time d-flex align-items-center my-2">
<span class="movie-time-text font-normal">`+el.release+`</span>
</div>
</div>
</div>
</div>
<div class="block-social-info align-items-center">
<ul class="p-0 m-0 d-flex gap-2 music-play-lists">
<li class="share position-relative d-flex align-items-center text-center mb-0">
<span class="w-100 h-100 d-inline-block bg-transparent">
<i class="fas fa-share-alt"></i>
</span>
<div class="share-wrapper">
<div class="share-boxs d-inline-block">
<svg width="15" height="40" class="share-shape" viewBox="0 0 15 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.8842 40C6.82983 37.2868 1 29.3582 1 20C1 10.6418 6.82983 2.71323 14.8842 0H0V40H14.8842Z" fill="#191919"></path>
</svg>
<div class=" overflow-hidden">
<a href="" target="_blank">
<i class="fab fa-facebook-f"></i>
</a>
<a href="" target="_blank">
<i class="fab fa-twitter"></i>
</a>
<a href="#">
<i class="fas fa-link"></i>
</a>
</div>
</div>
</div>
</li>
</ul>
<div class="iq-button ms-2">
<a href="`+movie_link+`" class="btn text-uppercase position-relative rounded-circle">
<i class="fa-solid fa-play ms-0"></i>
</a>
</div>
</div>
</div>
</div>
</div>
`;
});
return `
<div class="mb-5">
<div class="container-fluid">
<div class="card-style-grid">
<div class="row row-cols-xl-5 row-cols-md-4 row-cols-2">
`+movies+`
</div>
</div>
</div>
</div>
`;
};
return {
init: ()=>{
$("#search-input").on('keyup', (e)=>{
clearTimeout(timestamp);
timestamp = setTimeout(()=>{
$(container).html(`<div class="w-100 text-center"><span class="spinner-border spinner-border-sm align-middle ms-2"></span></div>`);
$.ajax({
url: "{{path('app_search_filter')}}",
method: "post",
data: {"search":$(e.target).val()},
dataType: 'json',
success: function(r) {
$(container).html(getContent(r.data));
},
error: function (r) {
$(container).html(getContent([]));
},
});
}, 1500);
}); // Recherche dans l'input search
}
}
}();
UBSearch.init();
</script>