toujours pas resultats
Browse files- no-results.html +3 -2
- script.js +43 -0
- style.css +10 -1
no-results.html
CHANGED
|
@@ -46,7 +46,6 @@
|
|
| 46 |
</li>
|
| 47 |
</ul>
|
| 48 |
</div>
|
| 49 |
-
|
| 50 |
<div class="flex flex-col sm:flex-row justify-center gap-4">
|
| 51 |
<a href="/" class="px-6 py-3 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors font-medium">
|
| 52 |
Retour à l'accueil
|
|
@@ -55,7 +54,9 @@
|
|
| 55 |
Réessayer
|
| 56 |
</button>
|
| 57 |
</div>
|
| 58 |
-
|
|
|
|
|
|
|
| 59 |
</main>
|
| 60 |
|
| 61 |
<custom-footer></custom-footer>
|
|
|
|
| 46 |
</li>
|
| 47 |
</ul>
|
| 48 |
</div>
|
|
|
|
| 49 |
<div class="flex flex-col sm:flex-row justify-center gap-4">
|
| 50 |
<a href="/" class="px-6 py-3 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors font-medium">
|
| 51 |
Retour à l'accueil
|
|
|
|
| 54 |
Réessayer
|
| 55 |
</button>
|
| 56 |
</div>
|
| 57 |
+
|
| 58 |
+
<div id="searchSuggestions" class="mt-8"></div>
|
| 59 |
+
</div>
|
| 60 |
</main>
|
| 61 |
|
| 62 |
<custom-footer></custom-footer>
|
script.js
CHANGED
|
@@ -257,5 +257,48 @@ year: currentYear - Math.floor(Math.random() * (yearsFilter === 'all' ? 20 : par
|
|
| 257 |
showLoading(false);
|
| 258 |
resultsContainer.classList.add('hidden');
|
| 259 |
noResults.classList.remove('hidden');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
}
|
| 261 |
});
|
|
|
|
| 257 |
showLoading(false);
|
| 258 |
resultsContainer.classList.add('hidden');
|
| 259 |
noResults.classList.remove('hidden');
|
| 260 |
+
|
| 261 |
+
// Generate search suggestions based on the query
|
| 262 |
+
const query = searchQuery.value.trim();
|
| 263 |
+
if (query) {
|
| 264 |
+
const suggestions = generateSearchSuggestions(query);
|
| 265 |
+
const suggestionsContainer = document.createElement('div');
|
| 266 |
+
suggestionsContainer.className = 'mt-6 bg-gray-50 p-4 rounded-lg';
|
| 267 |
+
suggestionsContainer.innerHTML = `
|
| 268 |
+
<h4 class="text-sm font-semibold text-gray-700 mb-2">Essayez ces recherches alternatives :</h4>
|
| 269 |
+
<div class="flex flex-wrap gap-2">
|
| 270 |
+
${suggestions.map(s => `
|
| 271 |
+
<button onclick="document.getElementById('searchQuery').value='${s}'; performSearch();"
|
| 272 |
+
class="text-xs px-3 py-1 bg-white text-purple-600 border border-purple-200 rounded-full hover:bg-purple-50 transition-colors">
|
| 273 |
+
${s}
|
| 274 |
+
</button>
|
| 275 |
+
`).join('')}
|
| 276 |
+
</div>
|
| 277 |
+
`;
|
| 278 |
+
noResults.appendChild(suggestionsContainer);
|
| 279 |
+
}
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
function generateSearchSuggestions(query) {
|
| 283 |
+
const commonTerms = {
|
| 284 |
+
'cancer': ['cancer du sein', 'cancer du poumon', 'traitement du cancer', 'thérapie ciblée cancer'],
|
| 285 |
+
'diabète': ['diabète type 1', 'diabète type 2', 'traitement diabète', 'prévention diabète'],
|
| 286 |
+
'covid': ['covid-19', 'vaccin covid', 'variants covid', 'traitement covid']
|
| 287 |
+
};
|
| 288 |
+
|
| 289 |
+
// Check if query matches any common term
|
| 290 |
+
for (const [term, suggestions] of Object.entries(commonTerms)) {
|
| 291 |
+
if (query.toLowerCase().includes(term)) {
|
| 292 |
+
return suggestions;
|
| 293 |
+
}
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
// Default suggestions
|
| 297 |
+
return [
|
| 298 |
+
query + ' traitement',
|
| 299 |
+
query + ' étude clinique',
|
| 300 |
+
'nouveautés ' + query,
|
| 301 |
+
'méta-analyse ' + query
|
| 302 |
+
];
|
| 303 |
}
|
| 304 |
});
|
style.css
CHANGED
|
@@ -45,7 +45,6 @@
|
|
| 45 |
.article-card:first-child {
|
| 46 |
background: linear-gradient(to right, rgba(124, 58, 237, 0.05), transparent);
|
| 47 |
}
|
| 48 |
-
|
| 49 |
/* No results page styles */
|
| 50 |
.no-results-icon {
|
| 51 |
animation: bounce 2s infinite;
|
|
@@ -56,6 +55,16 @@
|
|
| 56 |
40% {transform: translateY(-20px);}
|
| 57 |
60% {transform: translateY(-10px);}
|
| 58 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
/* Responsive adjustments */
|
| 60 |
@media (max-width: 640px) {
|
| 61 |
#constellation {
|
|
|
|
| 45 |
.article-card:first-child {
|
| 46 |
background: linear-gradient(to right, rgba(124, 58, 237, 0.05), transparent);
|
| 47 |
}
|
|
|
|
| 48 |
/* No results page styles */
|
| 49 |
.no-results-icon {
|
| 50 |
animation: bounce 2s infinite;
|
|
|
|
| 55 |
40% {transform: translateY(-20px);}
|
| 56 |
60% {transform: translateY(-10px);}
|
| 57 |
}
|
| 58 |
+
|
| 59 |
+
/* Search suggestions */
|
| 60 |
+
[onclick*="performSearch"] {
|
| 61 |
+
transition: all 0.2s ease;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
[onclick*="performSearch"]:hover {
|
| 65 |
+
transform: translateY(-2px);
|
| 66 |
+
box-shadow: 0 2px 4px rgba(124, 58, 237, 0.1);
|
| 67 |
+
}
|
| 68 |
/* Responsive adjustments */
|
| 69 |
@media (max-width: 640px) {
|
| 70 |
#constellation {
|