mirror of
https://github.com/KarnerF/SMPlusGui.git
synced 2026-10-06 08:00:19 +02:00
Fix JS: use data-i attribute for button index, no quote escaping in onclick
This commit is contained in:
1 parent
4bef8ed17d
commit
3abb58a6b0
1 file changed
+6
-2
@@ -1795,8 +1795,8 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
||||
"var mn=img.mounted?'<span style=\"color:#10b981;font-size:.75rem;\">● aktiv</span>'"
|
||||
":'<span style=\"color:var(--dim);font-size:.75rem;\">○ inaktiv</span>';"
|
||||
"var ba=img.mounted"
|
||||
"?'<button type=\'button\' onclick=\"_smUnmount('+i+')\" style=\"background:transparent;border:1px solid #f87171;border-radius:4px;color:#f87171;padding:3px 10px;cursor:pointer;font-size:.75rem;\">Unmount</button>'"
|
||||
":'<button type=\'button\' onclick=\"_smMount('+i+')\" style=\"background:transparent;border:1px solid var(--accent);border-radius:4px;color:var(--accent);padding:3px 10px;cursor:pointer;font-size:.75rem;white-space:nowrap;\">Mount</button>';"
|
||||
"?'<button type=\"button\" data-i=\"'+i+'\" onclick=\"_smUnmountThis(this)\" style=\"background:transparent;border:1px solid #f87171;border-radius:4px;color:#f87171;padding:3px 10px;cursor:pointer;font-size:.75rem;\">Unmount</button>'"
|
||||
":'<button type=\"button\" data-i=\"'+i+'\" onclick=\"_smMountThis(this)\" style=\"background:transparent;border:1px solid var(--accent);border-radius:4px;color:var(--accent);padding:3px 10px;cursor:pointer;font-size:.75rem;white-space:nowrap;\">Mount</button>';"
|
||||
/* /api/icon/{tid} has no query string - safe in img src */
|
||||
"var ic=tid"
|
||||
"?'<div style=\"position:relative;width:48px;height:48px;border-radius:8px;overflow:hidden;background:#1e2a42;flex-shrink:0;\">'"
|
||||
@@ -1816,6 +1816,10 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
||||
"gl.innerHTML=((!gd||gd.error||gd.status)?'<p class=\"hint\" style=\"color:#f87171;\">SM API nicht erreichbar — l\\u00e4uft ShadowMountPlus?</p>':'<p class=\"hint\">Keine Spiele gefunden</p>');"
|
||||
"}});}"
|
||||
"function loadGames(){loadGamePanel(0);}"
|
||||
"function _smMountThis(el){var i=el&&el.dataset?parseInt(el.dataset.i):NaN;"
|
||||
"if(isNaN(i))return;_smMount(i);}"
|
||||
"function _smUnmountThis(el){var i=el&&el.dataset?parseInt(el.dataset.i):NaN;"
|
||||
"if(isNaN(i))return;_smUnmount(i);}"
|
||||
"function _smMount(i){var g=window._smG&&window._smG[i];if(!g)return;"
|
||||
"var gl=document.getElementById('games-list');"
|
||||
"if(gl)gl.innerHTML='<p class=\"hint\">Mounting...</p>';"
|
||||
|
||||
Reference in new issue
Block a user