diff --git a/main.c b/main.c index 7613cca..0560de1 100644 --- a/main.c +++ b/main.c @@ -1766,7 +1766,8 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) { "if(l){l.textContent=nm;l.title=path;l.style.display='inline';}if(b)b.style.display='inline';}" "setTimeout(refreshStatus,2000);})" ".catch(function(){if(btn)btn.disabled=false;});}""function showElfPicker(btn,paths,cb){var old=document.getElementById('sm-elf-picker');if(old)old.remove();var picker=document.createElement('div');picker.id='sm-elf-picker';picker.style.cssText='position:fixed;top:0;left:0;width:100%%;height:100%%;background:rgba(0,0,0,.75);display:flex;align-items:center;justify-content:center;z-index:9999;';var box=document.createElement('div');box.style.cssText='background:#0d111a;border:1px solid #1e2a42;border-radius:14px;padding:36px;min-width:500px;max-width:800px;';var title=document.createElement('p');title.style.cssText='margin:0 0 20px;font-size:.7rem;text-transform:uppercase;letter-spacing:.12em;color:#64748b;font-family:monospace;';title.textContent=_t.sel_sm;box.appendChild(title);paths.forEach(function(p){var b=document.createElement('button');b.style.cssText='display:block;width:100%%;margin-bottom:10px;padding:16px 18px;border-radius:8px;border:1px solid #1e2a42;background:#131927;color:#e2e8f0;cursor:pointer;text-align:left;font-family:monospace;font-size:.75rem;word-break:break-all;';b.textContent=p;b.onclick=function(){picker.remove();if(cb)cb(p);else launchElf(btn,p);};box.appendChild(b);});var cancel=document.createElement('button');cancel.style.cssText='display:block;width:100%%;padding:14px;border-radius:8px;border:1px solid #1e2a42;background:transparent;color:#64748b;cursor:pointer;font-family:monospace;font-size:.75rem;margin-top:6px;';cancel.textContent=_t.cancel;cancel.onclick=function(){picker.remove();};box.appendChild(cancel);picker.appendChild(box);document.body.appendChild(picker);}""document.querySelector('form').addEventListener('keydown',function(e){""if(e.key==='Enter'&&e.target.tagName!=='BUTTON')e.preventDefault();""});"); - H("function loadGamePanel(){" + H("var _gpR=0;" + "function loadGamePanel(retry){_gpR=(retry||0);" "var gl=document.getElementById('games-list');" "var il=document.getElementById('images-list');" "if(gl)gl.innerHTML='

Lade...

';" @@ -1777,11 +1778,15 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) { "var gd=res[0],id=res[1];" "if(!gl)return;" "if(!gd||gd.error||gd.status){" - "gl.innerHTML='

SM API: '+(gd&&gd.error?gd.error:'nicht erreichbar')+'

';}" + "gl.innerHTML='

SM API nicht erreichbar — l\\u00e4uft ShadowMountPlus?

';}" "else if(!gd.games||!gd.games.length){" - "gl.innerHTML='

Keine Spiele gefunden

';}" - "else{" - "var h='';" + "if(_gpR<3){" + "gl.innerHTML='

Warte auf SM... ('+(_gpR+1)+'/3)

';" + "setTimeout(function(){loadGamePanel(_gpR+1);},5000);" + "}else{" + "gl.innerHTML='

Keine Spiele — SM scan noch aktiv?

';" + "}}" + "else{_gpR=0;var h='';" "gd.games.forEach(function(g){" "var tid=g.title_id||'';" "var mn=g.mounted" @@ -1809,7 +1814,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) { "ih+='';" "ih+='Datei / Pfad';" "ih+='TypGr\\u00f6\\u00dfe';" - "ih+='Mount';" + "ih+='Mount';" "id.images.forEach(function(img){" "var parts=(img.path||'').split('/');" "var fn=parts.pop()||img.path;" @@ -1817,14 +1822,20 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) { "var ext=fn.indexOf('.')>-1?fn.split('.').pop().toUpperCase():'';" "var sz=img.size?(img.size>1073741824?(img.size/1073741824).toFixed(2)+' GB':(img.size/1048576).toFixed(0)+' MB'):'?';" "var st=img.mounted?'● aktiv':'○';" + "var itid=img.title_id||'';" + "var iba=itid?(img.mounted" + "?''" + ":'')" + ":'–';" "ih+='';" "ih+=''+fn+'';" "ih+='
'+dir+'';" "ih+=''+ext+'';" "ih+=''+sz+'';" - "ih+=''+st+'';" + "ih+=''+st+'';" + "ih+=''+iba+'';" "});ih+='';il.innerHTML=ih;});}" - "function loadGames(){loadGamePanel();}" + "function loadGames(){loadGamePanel(0);}" "function mountGame(tid){" "var el=document.getElementById('games-list');" "if(el)el.innerHTML='

Mounting '+tid+'...

';" @@ -1832,8 +1843,8 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) { ".then(function(r){return r.json();})" ".then(function(d){" "if(d.error&&el)el.innerHTML='

'+d.error+'

';" - "setTimeout(loadGamePanel,3000);})" - ".catch(function(){setTimeout(loadGamePanel,3000);});}" + "setTimeout(function(){loadGamePanel(0);},3000);})" + ".catch(function(){setTimeout(function(){loadGamePanel(0);},3000);});}" "function unmountGame(tid){" "var el=document.getElementById('games-list');" "if(el)el.innerHTML='

Unmounting '+tid+'...

';" @@ -1841,8 +1852,8 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) { ".then(function(r){return r.json();})" ".then(function(d){" "if(d.error&&el)el.innerHTML='

'+d.error+'

';" - "setTimeout(loadGamePanel,3000);})" - ".catch(function(){setTimeout(loadGamePanel,3000);});}"); + "setTimeout(function(){loadGamePanel(0);},3000);})" + ".catch(function(){setTimeout(function(){loadGamePanel(0);},3000);});}"); H("function addPath(){" "var c=document.getElementById('paths-list');" "var d=document.createElement('div');d.className='path-row';"