move search script
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Gestion des clics sur les vidéos
|
||||
const videoCards = document.querySelectorAll('.video-card');
|
||||
videoCards.forEach(card => {
|
||||
card.addEventListener('click', function() {
|
||||
const videoId = this.dataset.videoId;
|
||||
if (videoId) {
|
||||
window.location.href = 'video.php?id=' + videoId;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
+15
-28
@@ -41,7 +41,7 @@ if ($resultsCount > 0) {
|
||||
<title><?php echo !empty($query) ? 'Recherche: ' . htmlspecialchars($query) . ' - ' : 'Recherche - '; ?>kaubuntu.re</title>
|
||||
<link rel="stylesheet" href="css/styles.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
||||
|
||||
|
||||
<!-- Favicons -->
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png">
|
||||
@@ -52,11 +52,11 @@ if ($resultsCount > 0) {
|
||||
</head>
|
||||
<body>
|
||||
<?php include 'includes/sidebar.php'; ?>
|
||||
|
||||
|
||||
<!-- Contenu principal -->
|
||||
<div class="main-content">
|
||||
<?php include 'includes/header.php'; ?>
|
||||
|
||||
|
||||
<!-- Section de recherche -->
|
||||
<div class="video-section search-page" data-search-query="<?php echo htmlspecialchars($query); ?>">
|
||||
<div class="section-header">
|
||||
@@ -73,7 +73,7 @@ if ($resultsCount > 0) {
|
||||
<h2 class="section-title">Rechercher des vidéos</h2>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
<?php if (!empty($query)): ?>
|
||||
<?php if ($resultsCount > 0): ?>
|
||||
<div class="search-results-count">
|
||||
@@ -83,7 +83,7 @@ if ($resultsCount > 0) {
|
||||
<p><?php echo $resultsCount; ?> résultat<?php echo $resultsCount > 1 ? 's' : ''; ?> trouvé<?php echo $resultsCount > 1 ? 's' : ''; ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="video-grid category-videos">
|
||||
<?php foreach ($currentPageVideos as $video): ?>
|
||||
<div class="video-card" data-video-id="<?php echo $video['id']; ?>">
|
||||
@@ -114,7 +114,7 @@ if ($resultsCount > 0) {
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
|
||||
<?php if ($totalPages > 1): ?>
|
||||
<div class="pagination">
|
||||
<?php if ($currentSearchPage > 1): ?>
|
||||
@@ -123,14 +123,14 @@ if ($resultsCount > 0) {
|
||||
<i class="fas fa-chevron-left"></i> Précédent
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<div class="page-numbers">
|
||||
<?php
|
||||
// Déterminer la plage de pages à afficher
|
||||
$pageRange = 2; // Nombre de pages à afficher de chaque côté
|
||||
$startPage = max(1, $currentSearchPage - $pageRange);
|
||||
$endPage = min($totalPages, $currentSearchPage + $pageRange);
|
||||
|
||||
|
||||
// Afficher le lien vers la première page si nécessaire
|
||||
if ($startPage > 1) {
|
||||
echo '<a href="recherche.php?q=' . urlencode($query) . '&page=1" class="page-number">1</a>';
|
||||
@@ -138,7 +138,7 @@ if ($resultsCount > 0) {
|
||||
echo '<span class="page-dots">...</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Afficher les liens de pagination
|
||||
for ($i = $startPage; $i <= $endPage; $i++) {
|
||||
if ($i == $currentSearchPage) {
|
||||
@@ -147,7 +147,7 @@ if ($resultsCount > 0) {
|
||||
echo '<a href="recherche.php?q=' . urlencode($query) . '&page=' . $i . '" class="page-number">' . $i . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Afficher le lien vers la dernière page si nécessaire
|
||||
if ($endPage < $totalPages) {
|
||||
if ($endPage < $totalPages - 1) {
|
||||
@@ -157,7 +157,7 @@ if ($resultsCount > 0) {
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
||||
<?php if ($currentSearchPage < $totalPages): ?>
|
||||
<a href="recherche.php?q=<?php echo urlencode($query); ?>&page=<?php echo $currentSearchPage + 1; ?>" class="page-link next">
|
||||
Suivant <i class="fas fa-chevron-right"></i>
|
||||
@@ -187,25 +187,12 @@ if ($resultsCount > 0) {
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
<?php include 'includes/mobile-menu.php'; ?>
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||
<script src="js/main.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Gestion des clics sur les vidéos
|
||||
const videoCards = document.querySelectorAll('.video-card');
|
||||
videoCards.forEach(card => {
|
||||
card.addEventListener('click', function() {
|
||||
const videoId = this.dataset.videoId;
|
||||
if (videoId) {
|
||||
window.location.href = 'video.php?id=' + videoId;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script src="js/search.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user