|
|
@ -45,14 +45,30 @@
|
|
|
|
initWaterMark();
|
|
|
|
initWaterMark();
|
|
|
|
loadMarkdown();
|
|
|
|
loadMarkdown();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function htmlEscape(str){
|
|
|
|
|
|
|
|
var s = "";
|
|
|
|
|
|
|
|
if(str.length == 0) return "";
|
|
|
|
|
|
|
|
s = str.replace(/&/g,"&");
|
|
|
|
|
|
|
|
s = str.replace(/&/g,"&");
|
|
|
|
|
|
|
|
s = s.replace(/</g,"<");
|
|
|
|
|
|
|
|
s = s.replace(/>/g,">");
|
|
|
|
|
|
|
|
s = s.replace(/ /g," ");
|
|
|
|
|
|
|
|
s = s.replace(/'/g,"\'");
|
|
|
|
|
|
|
|
s = s.replace(/"/g,"\"");
|
|
|
|
|
|
|
|
s = s.replace(/<script.*?>.*?<\/script>/ig, '');
|
|
|
|
|
|
|
|
s = s.replace(/<script/gi, "<script ");
|
|
|
|
|
|
|
|
s = s.replace(/<iframe/gi, "<iframe ");
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 加载markdown
|
|
|
|
* 加载markdown
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function loadMarkdown() {
|
|
|
|
function loadMarkdown() {
|
|
|
|
var textData = Base64.decode($("#textData").val())
|
|
|
|
var textData = Base64.decode($("#textData").val())
|
|
|
|
|
|
|
|
textData = htmlEscape(textData);
|
|
|
|
window.textPreData = "<pre style='background-color: #FFFFFF;border:none'>" + textData + "</pre>";
|
|
|
|
window.textPreData = "<pre style='background-color: #FFFFFF;border:none'>" + textData + "</pre>";
|
|
|
|
window.textMarkdownData = marked(textData);
|
|
|
|
window.textMarkdownData = marked.parse(textData);
|
|
|
|
$("#markdown").html(window.textMarkdownData);
|
|
|
|
$("#markdown").html(window.textMarkdownData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|