mirror of
https://github.com/Daniongithub/ER-TPL.git
synced 2025-10-02 14:30:48 +00:00
Seta radiati + ora le mie ricerche mostrano prima l'elemento che inizia con searchTerm
This commit is contained in:
@@ -20,9 +20,15 @@ fetch(url)
|
||||
|
||||
searchBar.addEventListener('input', () => {
|
||||
const searchTerm = searchBar.value.toLowerCase();
|
||||
const filtered = allresults.filter(item =>
|
||||
item.fermata.toLowerCase().includes(searchTerm)
|
||||
);
|
||||
const filtered = allresults
|
||||
.filter(item => item.fermata.toLowerCase().includes(searchTerm))
|
||||
.sort((a, b) => {
|
||||
const aStartsWith = a.fermata.toLowerCase().startsWith(searchTerm);
|
||||
const bStartsWith = b.fermata.toLowerCase().startsWith(searchTerm);
|
||||
if (aStartsWith && !bStartsWith) return -1;
|
||||
if (!aStartsWith && bStartsWith) return 1;
|
||||
return 0;
|
||||
});
|
||||
renderresults(filtered);
|
||||
});
|
||||
|
||||
|
@@ -135,6 +135,12 @@
|
||||
<img class="bus" src="https://drive.serverissimo.freeddns.org/apps/files_sharing/publicpreview/ffdqobqRg2ezKXt?file=/Leo/SETA/Citaro%20G%20ex%20TPER/4853-2%2Btag.jpg&fileId=269642&x=1920&y=1080" alt="Server foto non raggiungibile.">
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="/setamodena_bus/suburbano/cwlefacelift.html">
|
||||
<p>????-????<br>Iveco Crossway LE 12 CNG Facelift</p>
|
||||
<img class="bus" src="" alt="Nessuna foto al momento disponibile.">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
Reference in New Issue
Block a user