Jazzと読書の日々

iPadを筆記具として使う方法を模索します

Obsidian:Roomが復活しました

ふぅー、助かった。

Room

そう、これがないとObsidianは使えません。 ファイル履歴をカード表示するホームページです。 Dataviewのバージョンが0.5.64になって復活しました。

Room.md

以下のスクリプトを貼りつけてリーディングビューにしてください。

Import Obsidian: Room

>[!example]- Room
>```dataview
> task where !completed group by file.link
>```

```dataviewjs
const FOLDER = "keyword/"
const s = "background:ivory;width:119px;height:112px;border:1px solid #eee;border-top:8px solid gold;text-decoration:none;padding:3px;border-radius:3px;margin:3px;overflow:hidden;float:left;"

const p = dv.el("input")
p.placeholder = "..."
p.style = "font-size:18px;background:whitesmoke;border-radius:3px;"
const btn = dv.el("button","+")
btn.style = "font-size:12px;margin:5px;width:40px;"
const h = dv.el("hr", "")
h.style = "border:0;margin:5px;"
const b = dv.el("div", "")
b.style = "font-size:small;font-weight:bold;height:5000px;"
disp()

p.onkeyup = () => disp()

btn.onclick = () => {
  q = encodeURI(p.value)
  if(q){
    open("obsidian://new?file=" + encodeURI(FOLDER) + q + "&content=%0A```query%0A" + q + "%0A```%0A")
  }else{
    open("obsidian://new")
  }
}

function disp(){
  r = new RegExp("("+ p.value +")","i")
  const d = dv.array(Object.entries(dv.app.metadataCache.fileCache))
    .filter(([x,y]) => r.test(x))
    .sort(([x,y]) => y.mtime, "desc")
    .limit(200)
    .map(([x,y]) => "<a class=internal-link style='" + s + "' href='" + x + "'>" + x.split("/").pop().replace(".md","") + "</a>")
  b.innerHTML = d.join("\n")
}
```

使い方

カードをタップするとそのファイルを開きます。

検索欄にキーワードを書くことで絞り込みできます。 検索欄の右にある「+」をタップすると新規ファイル作成になります。

Roomのタブをタップすると未完了のタスクをリストアップします。

まとめ

一安心。