diff --git a/.DS_Store b/.DS_Store index 75c2287..e481c56 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index 72f1563..2987c1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -._* \ No newline at end of file +._* +.vscode +.DS_Store \ No newline at end of file diff --git a/cmd.js b/cmd.js index 39b4a07..260df56 100644 --- a/cmd.js +++ b/cmd.js @@ -39,10 +39,12 @@ open: opens an app`) err(c, e) { c.err(e.join(" ")) }, - open(c, e) { - if (c) { - - } + open(_, e) { + let fname=e.join` `,h=true + Object.keys(hmm.storage['.pr'].handlers).forEach(e=>{ + if(fname.endsWith(e)){hmm.openApp(hmm.storage['.pr'].handlers[e],"$open "+fname);h=false} + }) + if(h)hmm.openApp('textpad.hmm',"$open "+fname) }, "#"() { }, } diff --git a/cursors-move.png b/cursors-move.png index a3fa040..655bb20 100644 Binary files a/cursors-move.png and b/cursors-move.png differ diff --git a/fe.html b/fe.html index f34ef39..d734eb1 100644 --- a/fe.html +++ b/fe.html @@ -44,11 +44,21 @@ path += e + '/' loadpath() } + }else{ + el.onclick=(ev)=>{ + hmm.$("open "+path+ev.target.innerText) + } } if (e.startsWith('.')) el.style.color = "#aaa" el.innerText = e document.getElementById('files').appendChild(el) }) } + setTimeout(()=>{ + if((window.arg||'').startsWith("$open ")){ + path=window.arg.slice(6) + loadpath() + } + },100) loadpath() \ No newline at end of file diff --git a/main.js b/main.js index d5973dd..c3fabcc 100644 --- a/main.js +++ b/main.js @@ -3,14 +3,11 @@ function e(query) { } window.hmm = { testcommand: function () { - hmm.openApp("fe.hmm", "/.pr"); + hmm.openApp("textpad.hmm", "$open /apps/textpad.hmm/code"); }, restart: function () { window.location = window.location.href }, - opts: { - lang: "en" - }, safe: {}, hasPerms: (name, filename) => { return eval("hmm.storage['.pr'].perms." + name).includes(filename + " ") @@ -28,6 +25,9 @@ window.hmm = { var cr = hmm.storage; (p.match(/\/[^/]+/g) || []).forEach((e) => cr = cr[e.slice(1)]) return cr + }, + pathToDot(p){ + return "hmm.storage[atob('"+p.replace(/^\//,"").split('/').map(btoa).join("')][atob('")+"')]" } } hmm.l.en = new Polyglot({ @@ -63,11 +63,17 @@ hmm.l.cd = new Polyglot({ } }) hmm.storage = { + name:"HmmOS (tm)", apps: { "app.hmm": { title: "testapp with a particularly long title", type: "iframe", - code: `Lorem ipsum sit amet
Test

Some text