|
|
|
@ -45,14 +45,30 @@
|
|
|
|
|
initWaterMark();
|
|
|
|
|
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
|
|
|
|
|
*/
|
|
|
|
|
function loadMarkdown() {
|
|
|
|
|
var textData = Base64.decode($("#textData").val())
|
|
|
|
|
textData = htmlEscape(textData);
|
|
|
|
|
window.textPreData = "<pre style='background-color: #FFFFFF;border:none'>" + textData + "</pre>";
|
|
|
|
|
window.textMarkdownData = marked(textData);
|
|
|
|
|
window.textMarkdownData = marked.parse(textData);
|
|
|
|
|
$("#markdown").html(window.textMarkdownData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|