trimed trailing whitespaces

This commit is contained in:
quenousimporte 2023-09-11 09:57:00 +02:00
parent f716fb83f1
commit 36458ad166
10 changed files with 44 additions and 44 deletions

View File

@ -148,7 +148,7 @@ axios.post(`${settings.url}/handler.php`,
} }
notes.unshift(currentnote); notes.unshift(currentnote);
console.log(`Creating new note: ${title}`); console.log(`Creating new note: ${title}`);
editnote(); editnote();
} }
break; break;
@ -158,7 +158,7 @@ axios.post(`${settings.url}/handler.php`,
console.log(`[${i}] ${notes[i].title}`); console.log(`[${i}] ${notes[i].title}`);
} }
break; break;
default: default:
var arg = command; var arg = command;
if (arg === "open" || arg === "edit") if (arg === "open" || arg === "edit")
@ -181,7 +181,7 @@ axios.post(`${settings.url}/handler.php`,
else else
{ {
console.log(`Note ${arg} not found`); console.log(`Note ${arg} not found`);
} }
break; break;
} }
}); });

View File

@ -1 +1 @@
@node app %1 %2 @node app %1 %2

View File

@ -13,7 +13,7 @@ function editnote()
file.close(); file.close();
os.exec(["cp", "data/note.md", "data/backup.md"]); os.exec(["cp", "data/note.md", "data/backup.md"]);
os.exec(settings.editor.concat("data/note.md")); os.exec(settings.editor.concat("data/note.md"));
var newcontent = std.loadFile("data/note.md"); var newcontent = std.loadFile("data/note.md");
@ -38,7 +38,7 @@ function editnote()
file.puts(postdata); file.puts(postdata);
file.close(); file.close();
os.exec(["curl", "-X", "POST", os.exec(["curl", "-X", "POST",
"-d", "@data/postdata", "-d", "@data/postdata",
settings.url + "/handler.php"]); settings.url + "/handler.php"]);
@ -92,7 +92,7 @@ else
} }
notes.unshift(currentnote); notes.unshift(currentnote);
console.log(`Creating new note: ${title}`); console.log(`Creating new note: ${title}`);
editnote(); editnote();
} }
break; break;
@ -102,7 +102,7 @@ else
console.log(`[${i}] ${notes[i].title}`); console.log(`[${i}] ${notes[i].title}`);
} }
break; break;
default: default:
var arg = command; var arg = command;
if (arg === "open" || arg === "edit") if (arg === "open" || arg === "edit")
@ -125,7 +125,7 @@ else
else else
{ {
console.log(`Note ${arg} not found`); console.log(`Note ${arg} not found`);
} }
break; break;
} }
} }

View File

@ -37,7 +37,7 @@ else if (isset($_POST['action']))
else else
{ {
echo '{}'; echo '{}';
} }
break; break;
case 'cal': case 'cal':

View File

@ -22,7 +22,7 @@
<script src="libs/jszip.min.js"></script> <script src="libs/jszip.min.js"></script>
<script src="libs/FileSaver.js"></script> <script src="libs/FileSaver.js"></script>
<script src="main.js"></script> <script src="main.js"></script>
<div id="networkpage" hidden> <div id="networkpage" hidden>
<div id="network"></div> <div id="network"></div>
</div> </div>

56
main.js
View File

@ -150,7 +150,7 @@ var themes =
fontsize: "16px", fontsize: "16px",
fontcolor: "rgb(78,78,78)", fontcolor: "rgb(78,78,78)",
lineheight: "24px", lineheight: "24px",
accentcolor: "rgb(54,54,54)" accentcolor: "rgb(54,54,54)"
} }
}; };
@ -429,7 +429,7 @@ function createsubnote(suggestedtitle)
var content = getrangecontent(range); var content = getrangecontent(range);
filter.placeholder = "Create subnote..."; filter.placeholder = "Create subnote...";
searchinlist(name) searchinlist(name)
.then(title => .then(title =>
{ {
if (!title) if (!title)
{ {
@ -443,7 +443,7 @@ function createsubnote(suggestedtitle)
} }
else else
{ {
var newnote = var newnote =
{ {
title: title, title: title,
content: content content: content
@ -475,7 +475,7 @@ function includesub()
if (confirm("Replace [[" + title + "]] by its content?")) if (confirm("Replace [[" + title + "]] by its content?"))
{ {
var subnote = getnote(title); var subnote = getnote(title);
md.value = md.value =
md.value.substring(0, range.start) md.value.substring(0, range.start)
+ subnote.content + subnote.content
+ md.value.substring(range.end); + md.value.substring(range.end);
@ -520,7 +520,7 @@ function showinfo()
var tags = gettags(currentnote); var tags = gettags(currentnote);
showtemporaryinfo( showtemporaryinfo(
[ [
"vault: " + currentvault, "vault: " + currentvault,
"saved: " + saved, "saved: " + saved,
"title: " + currentnote.title, "title: " + currentnote.title,
"cursor position: " + md.selectionStart + " (" + pospercent() + "%)", "cursor position: " + md.selectionStart + " (" + pospercent() + "%)",
@ -597,14 +597,14 @@ function switchvault()
if (confirm("Switch to " + newvault + "?")) if (confirm("Switch to " + newvault + "?"))
{ {
applyvault(newvault); applyvault(newvault);
} }
} }
function ancestors(note) function ancestors(note)
{ {
var list = [note]; var list = [note];
var result = []; var result = [];
while (list.length) while (list.length)
{ {
var current = list.shift(); var current = list.shift();
@ -621,7 +621,7 @@ function descendants(note)
{ {
var list = [note]; var list = [note];
var result = []; var result = [];
while (list.length) while (list.length)
{ {
var current = list.shift(); var current = list.shift();
@ -652,7 +652,7 @@ function connected(note)
{ {
var list = [note]; var list = [note];
var result = []; var result = [];
while (list.length) while (list.length)
{ {
var current = list.shift(); var current = list.shift();
@ -680,7 +680,7 @@ function shownotelinks()
var edges = []; var edges = [];
var list = [currentnote]; var list = [currentnote];
while (list.length) while (list.length)
{ {
var current = list.shift(); var current = list.shift();
@ -704,7 +704,7 @@ function shownotelinks()
from: id(current), from: id(current),
to: id(buddy) to: id(buddy)
}); });
} }
}); });
} }
} }
@ -714,7 +714,7 @@ function shownotelinks()
edges: edges edges: edges
}; };
var options = var options =
{ {
nodes: nodes:
{ {
@ -731,7 +731,7 @@ function shownotelinks()
} }
} }
}; };
var graph = new vis.Network(network, data, options); var graph = new vis.Network(network, data, options);
graph.on("click", function(event) graph.on("click", function(event)
{ {
@ -765,7 +765,7 @@ function showoutline()
else if (line == "---" && index != 0 && index != 3) else if (line == "---" && index != 0 && index != 3)
{ {
var next; var next;
if (next = lines.find((current, i) => if (next = lines.find((current, i) =>
{ {
return i > index && current != ""; return i > index && current != "";
})) }))
@ -796,14 +796,14 @@ function linkrangeatpos()
{ {
var start = md.value.lastIndexOf("[[", md.selectionStart); var start = md.value.lastIndexOf("[[", md.selectionStart);
if (start == -1 || md.value.substring(start, md.selectionStart).indexOf("\n") != -1) return null if (start == -1 || md.value.substring(start, md.selectionStart).indexOf("\n") != -1) return null
var end = md.value.indexOf("]]", md.selectionStart); var end = md.value.indexOf("]]", md.selectionStart);
if (end == -1 || md.value.substring(md.selectionStart, end).indexOf("\n") != -1) return null; if (end == -1 || md.value.substring(md.selectionStart, end).indexOf("\n") != -1) return null;
return { return {
start: start, start: start,
end: end + 2 end: end + 2
}; };
} }
function linkatpos() function linkatpos()
@ -825,7 +825,7 @@ function tagatpos()
var start = md.value.lastIndexOf(" ", md.selectionStart); var start = md.value.lastIndexOf(" ", md.selectionStart);
if (start == -1 || md.value.substring(start, md.selectionStart).indexOf("\n") != -1) return ""; if (start == -1 || md.value.substring(start, md.selectionStart).indexOf("\n") != -1) return "";
var eol = md.value.indexOf("\n", md.selectionStart); var eol = md.value.indexOf("\n", md.selectionStart);
var end = md.value.indexOf(",", md.selectionStart); var end = md.value.indexOf(",", md.selectionStart);
@ -833,7 +833,7 @@ function tagatpos()
{ {
end = eol; end = eol;
} }
return md.value.substring(start + 1, end); return md.value.substring(start + 1, end);
} }
@ -1069,8 +1069,8 @@ function downloadnotewithsubs()
var note = withsubs(); var note = withsubs();
if (note) if (note)
{ {
download(note.title + ".md", note.content); download(note.title + ".md", note.content);
} }
} }
function downloadnote() function downloadnote()
@ -1595,7 +1595,7 @@ function md2html(content)
{ {
converter.setOption("openLinksInNewWindow", true); converter.setOption("openLinksInNewWindow", true);
} }
var html = converter.makeHtml(content); var html = converter.makeHtml(content);
// internal links // internal links
@ -2094,7 +2094,7 @@ function renamereferences(newname)
.forEach(note => .forEach(note =>
{ {
note.content = note.content.replaceAll("[[" + currentnote.title + "]]", "[[" + newname + "]]"); note.content = note.content.replaceAll("[[" + currentnote.title + "]]", "[[" + newname + "]]");
}); });
} }
function rename(newname) function rename(newname)
@ -2410,7 +2410,7 @@ function withsubs()
{ {
try try
{ {
descendants(currentnote); descendants(currentnote);
} }
catch (err) catch (err)
{ {
@ -2418,7 +2418,7 @@ function withsubs()
return null; return null;
} }
var tempnote = var tempnote =
{ {
title: currentnote.title + " (with subnotes)", title: currentnote.title + " (with subnotes)",
content: md.value content: md.value
@ -2456,8 +2456,8 @@ function togglepreviewwithsubs()
{ {
resize(); resize();
md.focus(); md.focus();
} }
} }
} }
function bindfile(note) function bindfile(note)
@ -2475,7 +2475,7 @@ function bindfile(note)
if (changed) if (changed)
{ {
md.style.height = "0px"; md.style.height = "0px";
} }
resize(); resize();
// to improve... // to improve...
@ -2499,7 +2499,7 @@ function loadnote(name)
if (!preview.hidden || (preview.hidden && gettags(note).indexOf("preview") !== -1)) if (!preview.hidden || (preview.hidden && gettags(note).indexOf("preview") !== -1))
{ {
togglepreview(); togglepreview();
} }
} }
function sendpassword() function sendpassword()

View File

@ -6,7 +6,7 @@ launch index.html from your web server or local computer, or try https://notes.o
your notes are stored in your browser local storage. your notes are stored in your browser local storage.
## remote mode ## remote mode
you can use remote mode with your own php server to access your notes from the cloud. you can use remote mode with your own php server to access your notes from the cloud.

View File

@ -13,9 +13,9 @@ iframe {
} }
#left { #left {
float: left; float: left;
} }
#right { #right {
float: right; float: right;
} }

View File

@ -13,5 +13,5 @@
<iframe src="index.html" id="right" name="right"></iframe> <iframe src="index.html" id="right" name="right"></iframe>
</div> </div>
</body> </body>
</html> </html>

View File

@ -50,7 +50,7 @@ body::-webkit-scrollbar-thumb {
color: inherit; color: inherit;
resize: none; resize: none;
font-family: inherit; font-family: inherit;
font-size: inherit; font-size: inherit;
line-height: inherit; line-height: inherit;