Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
inventionpro authored Oct 22, 2024
1 parent 4118899 commit 89d8e50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion media/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ function ObjectToTree(obj, prefix) {
return Object.keys(obj).map(k=>(typeof obj[k])==='string'?`<button onclick="loadPanelFor('${(prefix.length?prefix+'.':'')+k}')">${k}</button>`:`<details id="d-${(prefix.length?prefix+'.':'')+k}"${document.getElementById(`d-${(prefix.length?prefix+'.':'')+k}`)?.getAttribute('open')==null?'':' open'}><summary>${k}</summary>${ObjectToTree(obj[k], (prefix.length?prefix+'.':'')+k)}</details>`).join('')
}
function side() {
document.getElementById('lang-select').innerHTML = Object.keys(data).map(l=>`<option value="${l}">${l}${main==l?' (main)':''}</option>`).sort().join('');
const ls = document.getElementById('lang-select');
ls.innerHTML = Object.keys(data).map(l=>`<option value="${l}"${ls?.value===l?' selected':''}>${l}${main==l?' (main)':''}</option>`).sort().join('');
document.getElementById('tree').innerHTML = ObjectToTree(data[main]??(data[Object.keys(data)[0]]??{}), '');
}
window.side = side;
Expand Down

0 comments on commit 89d8e50

Please sign in to comment.