feat: mobile search bar in header — tap icon to search Navidrome library
Search icon added to mobile header. Tapping opens an inline search bar below the header. Typing searches artists/albums/songs via Navidrome search3 API with 300ms debounce. X button closes and returns to Home. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
4b34bbc043
commit
09ce590abd
3 files changed
+48
-8
No files matched your search
@@ -508,6 +508,32 @@ async function doLocalSearch(q){
|
||||
}
|
||||
function mkSection(title){const d=document.createElement('div');d.className='search-section';d.innerHTML=`<div class="search-section-title">${title}</div>`;return d}
|
||||
|
||||
function toggleMobileSearch(){
|
||||
const bar=document.getElementById('mobile-search-bar');
|
||||
const btn=document.getElementById('mobile-search-btn');
|
||||
const open=bar.style.display==='none'||bar.style.display==='';
|
||||
bar.style.display=open?'block':'none';
|
||||
btn.style.color=open?'var(--accent)':'var(--text2)';
|
||||
if(open){setTimeout(()=>document.getElementById('mobile-search-input').focus(),50);}
|
||||
else{closeMobileSearch();}
|
||||
}
|
||||
function closeMobileSearch(){
|
||||
const bar=document.getElementById('mobile-search-bar');
|
||||
const inp=document.getElementById('mobile-search-input');
|
||||
const btn=document.getElementById('mobile-search-btn');
|
||||
bar.style.display='none';
|
||||
btn.style.color='var(--text2)';
|
||||
inp.value='';
|
||||
navigate('home');
|
||||
}
|
||||
let _mobileSearchTimer=null;
|
||||
function onMobileSearch(val){
|
||||
clearTimeout(_mobileSearchTimer);
|
||||
if(!val.trim()){navigate('home');return;}
|
||||
navigate('search');
|
||||
_mobileSearchTimer=setTimeout(()=>doLocalSearch(val),300);
|
||||
}
|
||||
|
||||
// ─── ITUNES API ───
|
||||
const ITUNES='https://itunes.apple.com';
|
||||
async function itunesSearch(query,entity='musicTrack',limit=25){
|
||||
|
||||
Reference in new issue
Block a user