|
|
|
|
@ -4,8 +4,7 @@ var $ = function(id) {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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; |
|
|
|
|
|