From 2fff40f20f297c4b12a60c329b071cff51feae3f Mon Sep 17 00:00:00 2001 From: Christian Mueller Date: Sun, 19 Jan 2014 15:54:47 +0100 Subject: [PATCH] escaping bug --- resources/public/js/main.js | 66 ++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/resources/public/js/main.js b/resources/public/js/main.js index 915e104..e9a8923 100644 --- a/resources/public/js/main.js +++ b/resources/public/js/main.js @@ -6,45 +6,45 @@ var show = function(elem) { elem.style.display = "block" } var $note, $action, $preview, $plain_password, $input_elems, $dashed_line, updatePreview; var md5 = function (input) { - return hex_md5(input.replace(/[\n\r]/g, "")); + return hex_md5(input.replace(/[\n\r]/g, "")); } function md2html(input){ - return marked(input); + return marked(input); } function onLoad() { - applyTheme(); - $note = $("note"); - $action = $("action"); - $preview = $("preview"); - $plain_password = $("plain-password"); - $input_elems = $("input-elems"); - $dashed_line = $("dashed-line"); - updatePreview = function(){ - clearTimeout(timer); - var content = $note.value; - var delay = Math.min(timerDelay, timerDelay * (content.length / 400)); - timer = setTimeout(function(){ - show($dashed_line); - show($input_elems); - $preview.innerHTML = md2html(content); - }, delay); - }; - if($action){ - if($action.value == "update") updatePreview(); else $note.value = ""; - $note.onkeyup = updatePreview; - $("publish-button").onclick = function(e) { - if($plain_password.value != "") $("password").value = md5($plain_password.value); - $plain_password.value = null; - $("signature").value = md5($("session").value + $note.value); - } - if(iosDetected) $note.className += " ui-border"; else $note.focus(); + applyTheme(); + $note = $("note"); + $action = $("action"); + $preview = $("preview"); + $plain_password = $("plain-password"); + $input_elems = $("input-elems"); + $dashed_line = $("dashed-line"); + updatePreview = function(){ + clearTimeout(timer); + var content = $note.value; + var delay = Math.min(timerDelay, timerDelay * (content.length / 400)); + timer = setTimeout(function(){ + show($dashed_line); + show($input_elems); + $preview.innerHTML = md2html(content); + }, delay); + }; + if($action){ + if($action.value == "update") updatePreview(); else $note.value = ""; + $note.onkeyup = updatePreview; + $("publish-button").onclick = function(e) { + if($plain_password.value != "") $("password").value = md5($plain_password.value); + $plain_password.value = null; + $("signature").value = md5($("session").value + $note.value); } + if(iosDetected) $note.className += " ui-border"; else $note.focus(); + } - var mdDocs = document.getElementsByClassName("markdown"); - for(var i = 0; i < mdDocs.length; i++){ - mdDocs[i].innerHTML = md2html(mdDocs[i].innerHTML); - show(mdDocs[i]); - } + var mdDocs = document.getElementsByClassName("markdown"); + for(var i = 0; i < mdDocs.length; i++){ + mdDocs[i].innerHTML = md2html(mdDocs[i].innerText); + show(mdDocs[i]); + } }