Repository navigation
Expand file tree
/
Copy pathg.html
More file actions
executable file
·25 lines (25 loc) · 1.62 KB
/
Copy pathg.html
File metadata and controls
executable file
·25 lines (25 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html><title>tiny desktop</title><meta name=viewport content="width=device-width,initial-scale=1.0"><style>.bar{user-select:none}iframe{flex:1;border:0;width:100%}.w{position:absolute;display:flex;flex-direction:column;resize:both;overflow:hidden;left:10vw;top:10vh}body{height:100vh;display:flex;align-items:center;justify-content:center}</style><body><span style=position:fixed;bottom:0;right:0;width:100%;display:flex;flex-direction:row><p id=n style=padding:0;float:right;max-width:100%;flex-grow:1></p><p id=m style=right:0;padding:0;max-width:100%></p></span><script src=./api.js></script><script>
(async()=>{await aR
try{if(!await getf('boot'))location.href="index.html"
ui=await getf("ui.sys")
token=localStorage.getItem('sys_id',crypto.randomUUID())
document.head.appendChild(Object.assign(document.createElement("style"),{textContent:ui}))
c=JSON.parse(await getf('apps.sys'))
n.innerHTML=Object.entries(c).map(([k,v])=>`<a href=${v} onclick="cW('${k}','${v}');return false">${k}</a>`).join(" ")
window.addEventListener("message",async e=>{
if(e.origin==location.origin&&e.data?.token==token){
if(e.data.cmd==="open") {
await cW(e.data.title,e.data.url);
}else if(e.data.cmd==="f5"){
location.reload()
}else if(e.data.cmd==="getf"){
console.log(e.source.postMessage({id:e.data.id,r:await getf(e.data.name)}))
}else if(e.data.cmd==="setf"){
await setf(e.data.name,e.data.cont)
e.source.postMessage({id:e.data.id,r:"ok"})
}}
});
applets=await getf("applets.sys")
m.innerHTML=Object.entries(JSON.parse(applets)).map(([k,v])=>`<button title="${k}" onclick="${v.onclick}">${v.icon}</button>`).join(" ")
await iW()}catch(e){}})();
</script>