/edit page implemented

This commit is contained in:
Christian Müller
2015-10-17 23:40:13 +02:00
parent c0ea94ad7b
commit b078891190
4 changed files with 20 additions and 7 deletions
+3 -2
View File
@@ -15,11 +15,12 @@
<article id="preview" style="flex: none; -webkit-flex: none"></article>
<div class="hidden" id="dashed-line"></div>
<div class="central-element helvetica" style="margin-bottom: 3em">
<form action="/note" autocomplete="off" method="%METHOD%">
<form action="/note" autocomplete="off" method="POST">
<input id="action" value="%METHOD%" type="hidden">
<input id="password" name="password" type="hidden">
<input id="session" name="session" type="hidden" value="%SESSION%" />
<input id="signature" name="signature" type="hidden" />
<textarea id="note" name="note">Loading...</textarea>
<textarea id="note" name="note">%CONTENT%</textarea>
<fieldset class="hidden" id="input-elems">
<input class="ui-elem" id="plain-password" name="plain-password" placeholder="Password for editing" type="text">&nbsp;
<input class="button ui-elem" id="publish-button" type="submit" value="Publish">
+2 -2
View File
@@ -16,7 +16,7 @@ function md2html(input) {
function onLoad() {
$note = $("note");
$action = document.getElementsByTagName("form")[0].method;
$action = $("action").value;
$preview = $("preview");
$plain_password = $("plain-password");
$proposed_title = $("proposed-title");
@@ -32,7 +32,7 @@ function onLoad() {
$preview.innerHTML = md2html(content);
}, delay);
};
if ($action.value == "update") updatePreview();
if ($action == "UPDATE") updatePreview();
else $note.value = "";
$note.onkeyup = updatePreview;
$("publish-button").onclick = function(e) {