Note deletion feature added
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
<article class="bottom-space">
|
||||
<h2>Changelog</h2>
|
||||
<ul>
|
||||
<li><strong>2016-03</strong>: Note deletion feature added.</li>
|
||||
<li><strong>2015-10</strong>: NoteHub rewritten in Node.js.</li>
|
||||
<li><strong>2015-10</strong>: NoteHub API and note styling discontinued due to low adoption by the user base.</li>
|
||||
<li><strong>2014-09</strong>: text size setting added</li>
|
||||
|
||||
@@ -4,8 +4,7 @@ var $ = function(id) {
|
||||
var iosDetected = navigator.userAgent.match("(iPad|iPod|iPhone)");
|
||||
var timer = null;
|
||||
var timerDelay = iosDetected ? 800 : 400;
|
||||
var $note, $action, $preview, $plain_password,
|
||||
updatePreview, $tableau;
|
||||
var $note, $action, $preview, $plain_password, $tableau;
|
||||
var backendTimer;
|
||||
|
||||
function md2html(input) {
|
||||
@@ -25,7 +24,7 @@ function onLoad() {
|
||||
$preview = $("draft");
|
||||
$tableau = $("tableau");
|
||||
$plain_password = $("plain-password");
|
||||
updatePreview = function() {
|
||||
var updatePreview = function() {
|
||||
clearTimeout(timer);
|
||||
var content = $note.value;
|
||||
var delay = Math.min(timerDelay, timerDelay * (content.length / 400));
|
||||
@@ -36,6 +35,7 @@ function onLoad() {
|
||||
};
|
||||
if ($action == "UPDATE") updatePreview();
|
||||
else {
|
||||
$("delete-button").style.display = "none";
|
||||
$note.value = "";
|
||||
var draft = localStorage.getItem("draft");
|
||||
if (draft) {
|
||||
@@ -44,14 +44,13 @@ function onLoad() {
|
||||
}
|
||||
}
|
||||
$note.onkeyup = updatePreview;
|
||||
$("publish-button").onclick = function(e) {
|
||||
$("delete-button").onclick = $("publish-button").onclick = function(e) {
|
||||
localStorage.removeItem("draft");
|
||||
self.onbeforeunload = null;;
|
||||
self.onbeforeunload = null;
|
||||
if ($plain_password.value != "") $("password").value = md5($plain_password.value);
|
||||
$plain_password.value = null;
|
||||
$("signature").value = md5($("session").value +
|
||||
$note.value.replace(/[\n\r]/g, ""));
|
||||
}
|
||||
$("signature").value = md5($("session").value + $note.value.replace(/[\n\r]/g, ""));
|
||||
};
|
||||
if (iosDetected) $note.className += " ui-border";
|
||||
else $note.focus();
|
||||
self.onbeforeunload = saveDraft;
|
||||
|
||||
Reference in New Issue
Block a user