changed: clip in todo instead of bookmarks

This commit is contained in:
quenousimporte 2024-01-17 09:09:25 +01:00
parent 5bb7742d15
commit cfc781721b
2 changed files with 18 additions and 32 deletions

View File

@ -1,10 +1,5 @@
javascript: (function() javascript: (function()
{ {
var notesurl = ""; var notesurl = "";
var bm = { window.open("https://" + notesurl + "?c=" + encodeURIComponent(document.location.href), "_blank", "popup,width=100,height=100");
title: document.title,
url: document.location.href,
time: Date.now()
};
window.open("https://" + notesurl + "?c=" + encodeURIComponent(JSON.stringify(bm)), "_blank", "popup,width=100,height=100");
})(); })();

35
main.js
View File

@ -228,7 +228,7 @@ var commands = [
}, },
{ {
hint: "Insert text in todo", hint: "Insert text in todo",
action: inserttodo action: promptinserttodo
}, },
{ {
hint: "Edit pgp keys", hint: "Edit pgp keys",
@ -1123,11 +1123,8 @@ function headerandtext(note)
return result; return result;
} }
function inserttodo() function inserttodo(text)
{ {
var text = prompt("Text:");
if (text)
{
var todo = getorcreate("todo", ""); var todo = getorcreate("todo", "");
var split = headerandtext(todo); var split = headerandtext(todo);
todo.content = split.header + text + "\n" + split.text; todo.content = split.header + text + "\n" + split.text;
@ -1135,7 +1132,15 @@ function inserttodo()
{ {
seteditorcontent(todo.content, true); seteditorcontent(todo.content, true);
} }
datachanged(); return datachanged();
}
function promptinserttodo()
{
var text = prompt("Text:");
if (text)
{
inserttodo(text);
} }
} }
@ -1208,28 +1213,14 @@ function loadstorage()
if (clip) if (clip)
{ {
var bmnote = getorcreate("bookmarks"); settings.savedelay = 0;
var newbookmark = JSON.parse(clip);
var date = new Date(newbookmark.time).toDateString();
bmnote.content += "\n\n";
if (!bmnote.content.includes(date))
{
bmnote.content += date + "\n\n";
}
bmnote.content += newbookmark.title + "\n";
bmnote.content += newbookmark.url;
bmnote.pos = bmnote.content.length;
bindfile(bmnote);
colored.hidden = true; colored.hidden = true;
md.hidden = true; md.hidden = true;
var msg = document.createElement("div"); var msg = document.createElement("div");
msg.innerText = "Clipping..."; msg.innerText = "Clipping...";
notepage.appendChild(msg); notepage.appendChild(msg);
saved = false; inserttodo(clip)
return save()
.then(window.close); .then(window.close);
} }