escaping bug
This commit is contained in:
+33
-33
@@ -6,45 +6,45 @@ var show = function(elem) { elem.style.display = "block" }
|
|||||||
var $note, $action, $preview, $plain_password, $input_elems, $dashed_line, updatePreview;
|
var $note, $action, $preview, $plain_password, $input_elems, $dashed_line, updatePreview;
|
||||||
|
|
||||||
var md5 = function (input) {
|
var md5 = function (input) {
|
||||||
return hex_md5(input.replace(/[\n\r]/g, ""));
|
return hex_md5(input.replace(/[\n\r]/g, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
function md2html(input){
|
function md2html(input){
|
||||||
return marked(input);
|
return marked(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLoad() {
|
function onLoad() {
|
||||||
applyTheme();
|
applyTheme();
|
||||||
$note = $("note");
|
$note = $("note");
|
||||||
$action = $("action");
|
$action = $("action");
|
||||||
$preview = $("preview");
|
$preview = $("preview");
|
||||||
$plain_password = $("plain-password");
|
$plain_password = $("plain-password");
|
||||||
$input_elems = $("input-elems");
|
$input_elems = $("input-elems");
|
||||||
$dashed_line = $("dashed-line");
|
$dashed_line = $("dashed-line");
|
||||||
updatePreview = function(){
|
updatePreview = function(){
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
var content = $note.value;
|
var content = $note.value;
|
||||||
var delay = Math.min(timerDelay, timerDelay * (content.length / 400));
|
var delay = Math.min(timerDelay, timerDelay * (content.length / 400));
|
||||||
timer = setTimeout(function(){
|
timer = setTimeout(function(){
|
||||||
show($dashed_line);
|
show($dashed_line);
|
||||||
show($input_elems);
|
show($input_elems);
|
||||||
$preview.innerHTML = md2html(content);
|
$preview.innerHTML = md2html(content);
|
||||||
}, delay);
|
}, delay);
|
||||||
};
|
};
|
||||||
if($action){
|
if($action){
|
||||||
if($action.value == "update") updatePreview(); else $note.value = "";
|
if($action.value == "update") updatePreview(); else $note.value = "";
|
||||||
$note.onkeyup = updatePreview;
|
$note.onkeyup = updatePreview;
|
||||||
$("publish-button").onclick = function(e) {
|
$("publish-button").onclick = function(e) {
|
||||||
if($plain_password.value != "") $("password").value = md5($plain_password.value);
|
if($plain_password.value != "") $("password").value = md5($plain_password.value);
|
||||||
$plain_password.value = null;
|
$plain_password.value = null;
|
||||||
$("signature").value = md5($("session").value + $note.value);
|
$("signature").value = md5($("session").value + $note.value);
|
||||||
}
|
|
||||||
if(iosDetected) $note.className += " ui-border"; else $note.focus();
|
|
||||||
}
|
}
|
||||||
|
if(iosDetected) $note.className += " ui-border"; else $note.focus();
|
||||||
|
}
|
||||||
|
|
||||||
var mdDocs = document.getElementsByClassName("markdown");
|
var mdDocs = document.getElementsByClassName("markdown");
|
||||||
for(var i = 0; i < mdDocs.length; i++){
|
for(var i = 0; i < mdDocs.length; i++){
|
||||||
mdDocs[i].innerHTML = md2html(mdDocs[i].innerHTML);
|
mdDocs[i].innerHTML = md2html(mdDocs[i].innerText);
|
||||||
show(mdDocs[i]);
|
show(mdDocs[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user