From 4a30a5d728f337d35fddeacae55ccfe7a36a50df Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Mon, 22 May 2023 14:04:35 +0200 Subject: [PATCH] added: open note if url param --- main.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 25b3448..3729f1c 100644 --- a/main.js +++ b/main.js @@ -1039,10 +1039,20 @@ function loadstorage() var item = window.localStorage.getItem(currentvault); localdata = item ? JSON.parse(item) : []; - // only refresh content? + var urlparam = (new URLSearchParams(window.location.search)).get("n"); + if (currentnote) { - currentnote = localdata.find(n => n.title == currentnote.title); + currentnote = getnote(currentnote.title); + } + else if (urlparam) + { + currentnote = getnote(urlparam); + if (!currentnote) + { + currentnote = {title: urlparam, content: ""}; + localdata.unshift(currentnote); + } } if (currentnote)