Insert Hyperlink
http://example.com/ "optional title"
',quote:"BlockquoteCtrl/Cmd+Q",quoteexample:"Blockquote",code:"Code SampleCtrl/Cmd+K",codeexample:"enter code here",image:"ImageCtrl/Cmd+G",imagedescription:"enter image description here",imagedialog:"
Insert Image
http://example.com/images/diagram.jpg \"optional title\"
",olist:"Numbered List
Need free image hosting?Ctrl/Cmd+O",ulist:"Bulleted List
Ctrl/Cmd+U",litem:"List item",heading:"Heading
/
Ctrl/Cmd+H",headingexample:"Heading",hr:"Horizontal Rule
Ctrl/Cmd+R",undo:"Undo - Ctrl/Cmd+Z",redo:"Redo - Ctrl/Cmd+Y",help:"Markdown Editing Help"},v="http://",y="http://";Markdown.Editor=function(t,r,s){s=s||{},"function"==typeof s.handler&&(s={helpButton:s}),s.strings=s.strings||{},s.helpButton&&(s.strings.help=s.strings.help||s.helpButton.title);var l=function(t){return s.strings[t]||m[t]};MD.getString=l,r=r||"";var c=this.hooks=new Markdown.HookCollection;c.addNoop("onPreviewRefresh"),c.addNoop("postBlockquoteCreation"),c.addFalse("insertImageDialog"),c.addFalse("insertLinkDialog"),this.getConverter=function(){return t};var u,f,d=this;this.run=function(){if(!u){u=new e(r);var p=new o(c,l);MD.commandManager=p;var g,m=new i(t,u,function(){c.onPreviewRefresh()});s.undoManager?(f=s.undoManager,f.onButtonStateChange=function(){g.setUndoRedoButtonStates()},g&&g.setUndoRedoButtonStates()):/\?noundo/.test(h.location.href)||(f=new n(function(){m.refresh(),g&&g.setUndoRedoButtonStates()},u),this.textOperation=function(t){f.setCommandMode(),t(),d.refreshPreview()}),g=new a(r,u,f,m,p,s.helpButton,l),g.setUndoRedoButtonStates();{d.refreshPreview=function(){m.refresh(!0)}}d.undoManager=f,d.uiManager=g}}},t.prototype.findTags=function(t,e){var n,r=this;t&&(n=l.extendRegExp(t,"","$"),this.before=this.before.replace(n,function(t){return r.startTag=r.startTag+t,""}),n=l.extendRegExp(t,"^",""),this.selection=this.selection.replace(n,function(t){return r.startTag=r.startTag+t,""})),e&&(n=l.extendRegExp(e,"","$"),this.selection=this.selection.replace(n,function(t){return r.endTag=t+r.endTag,""}),n=l.extendRegExp(e,"^",""),this.after=this.after.replace(n,function(t){return r.endTag=t+r.endTag,""}))},t.prototype.trimWhitespace=function(t){var e,n,r=this;t?e=n="":(e=function(t){return r.before+=t,""},n=function(t){return r.after=t+r.after,""}),this.selection=this.selection.replace(/^(\s*)/,e).replace(/(\s*)$/,n)},t.prototype.skipLines=function(t,e,n){void 0===t&&(t=1),void 0===e&&(e=1),t++,e++;var r,i;if(navigator.userAgent.match(/Chrome/)&&"X".match(/()./),this.selection=this.selection.replace(/(^\n*)/,""),this.startTag=this.startTag+f.$1,this.selection=this.selection.replace(/(\n*$)/,""),this.endTag=this.endTag+f.$1,this.startTag=this.startTag.replace(/(^\n*)/,""),this.before=this.before+f.$1,this.endTag=this.endTag.replace(/(\n*$)/,""),this.after=this.after+f.$1,this.before){for(r=i="";t--;)r+="\\n?",i+="\n";n&&(r="\\n*"),this.before=this.before.replace(new f(r+"$",""),i)}if(this.after){for(r=i="";e--;)r+="\\n?",i+="\n";n&&(r="\\n*"),this.after=this.after.replace(new f(r,""),i)}},l.isVisible=function(t){return window.getComputedStyle?"none"!==window.getComputedStyle(t,null).getPropertyValue("display"):t.currentStyle?"none"!==t.currentStyle.display:void 0},l.addEvent=function(t,e,n){t.attachEvent?t.attachEvent("on"+e,n):t.addEventListener(e,n,!1)},l.removeEvent=function(t,e,n){t.detachEvent?t.detachEvent("on"+e,n):t.removeEventListener(e,n,!1)},l.fixEolChars=function(t){return t=t.replace(/\r\n/g,"\n"),t=t.replace(/\r/g,"\n")},l.extendRegExp=function(t,e,n){(null===e||void 0===e)&&(e=""),(null===n||void 0===n)&&(n="");var r,i=t.toString();return i=i.replace(/\/([gim]*)$/,function(t,e){return r=e,""}),i=i.replace(/(^\/|\/$)/g,""),i=e+i+n,new f(i,r)},c.getTop=function(t,e){var n=t.offsetTop;if(!e)for(;t=t.offsetParent;)n+=t.offsetTop;return n},c.getHeight=function(t){return t.offsetHeight||t.scrollHeight},c.getWidth=function(t){return t.offsetWidth||t.scrollWidth},c.getPageSize=function(){var t,e,n,r;self.innerHeight&&self.scrollMaxY?(t=h.body.scrollWidth,e=self.innerHeight+self.scrollMaxY):h.body.scrollHeight>h.body.offsetHeight?(t=h.body.scrollWidth,e=h.body.scrollHeight):(t=h.body.offsetWidth,e=h.body.offsetHeight),self.innerHeight?(n=self.innerWidth,r=self.innerHeight):h.documentElement&&h.documentElement.clientHeight?(n=h.documentElement.clientWidth,r=h.documentElement.clientHeight):h.body&&(n=h.body.clientWidth,r=h.body.clientHeight);var i=Math.max(t,n),a=Math.max(e,r);return[i,a,n,r]},u.createBackground=function(){var t=h.createElement("div"),e=t.style;t.className="wmd-prompt-background",e.position="absolute",e.top="0",e.zIndex="1000",g.isIE?e.filter="alpha(opacity=50)":e.opacity="0.5";var n=c.getPageSize();return e.height=n[1]+"px",g.isIE?(e.left=h.documentElement.scrollLeft,e.width=h.documentElement.clientWidth):(e.left="0",e.width="100%"),h.body.appendChild(t),t},u.prompt=function(t,e,n){var r,i;void 0===e&&(e="");var a=function(t){var e=t.charCode||t.keyCode;27===e&&o(!0)},o=function(t){l.removeEvent(h.body,"keydown",a);var e=i.value;return t?e=null:(e=e.replace(/^http:\/\/(https?|ftp):\/\//,"$1://"),/^(?:https?|ftp):\/\//.test(e)||(e="http://"+e)),r.parentNode.removeChild(r),n(e),!1},s=function(){r=h.createElement("div"),r.className="wmd-prompt-dialog",r.style.padding="10px;",r.style.position="fixed",r.style.width="400px",r.style.zIndex="1001";var n=h.createElement("div");n.innerHTML=t,n.style.padding="5px",r.appendChild(n);var s=h.createElement("form"),u=s.style;s.onsubmit=function(){return o(!1)},u.padding="0",u.margin="0",u.cssFloat="left",u.width="100%",u.textAlign="center",u.position="relative",r.appendChild(s),i=h.createElement("input"),i.type="text",i.value=e,u=i.style,u.display="block",u.width="80%",u.marginLeft=u.marginRight="auto",s.appendChild(i);var f=h.createElement("input");f.type="button",f.onclick=function(){return o(!1)},f.value="OK",u=f.style,u.margin="10px",u.display="inline",u.width="7em";var d=h.createElement("input");d.type="button",d.onclick=function(){return o(!0)},d.value="Cancel",u=d.style,u.margin="10px",u.display="inline",u.width="7em",s.appendChild(f),s.appendChild(d),l.addEvent(h.body,"keydown",a),r.style.top="50%",r.style.left="50%",r.style.display="block",g.isIE_5or6&&(r.style.position="absolute",r.style.top=h.documentElement.scrollTop+200+"px",r.style.left="50%"),h.body.appendChild(r),r.style.marginTop=-(c.getHeight(r)/2)+"px",r.style.marginLeft=-(c.getWidth(r)/2)+"px"};setTimeout(function(){s();var t=e.length;if(void 0!==i.selectionStart)i.selectionStart=0,i.selectionEnd=t;else if(i.createTextRange){var n=i.createTextRange();n.collapse(!1),n.moveStart("character",-t),n.moveEnd("character",t),n.select()}i.focus()},0)};var x=o.prototype;x.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)",x.unwrap=function(t){var e=new f("([^\\n])\\n(?!(\\n|"+this.prefixes+"))","g");t.selection=t.selection.replace(e,"$1 $2")},x.wrap=function(t,e){this.unwrap(t);var n=new f("(.{1,"+e+"})( +|$\\n?)","gm"),r=this;t.selection=t.selection.replace(n,function(t,e){return new f("^"+r.prefixes,"").test(t)?t:e+"\n"}),t.selection=t.selection.replace(/\s+$/,"")},x.doBold=function(t,e){return this.doBorI(t,e,2,this.getString("boldexample"))},x.doItalic=function(t,e){return this.doBorI(t,e,1,this.getString("italicexample"))},x.doBorI=function(t,e,n,r){t.trimWhitespace(),t.selection=t.selection.replace(/\n{2,}/g,"\n");var i=/(\**$)/.exec(t.before)[0],a=/(^\**)/.exec(t.after)[0],o=Math.min(i.length,a.length);if(o>=n&&(2!=o||1!=n))t.before=t.before.replace(f("[*]{"+n+"}$",""),""),t.after=t.after.replace(f("^[*]{"+n+"}",""),"");else if(!t.selection&&a){t.after=t.after.replace(/^([*_]*)/,""),t.before=t.before.replace(/(\s?)$/,"");var s=f.$1;t.before=t.before+a+s}else{t.selection||a||(t.selection=r);var l=1>=n?"*":"**";t.before=t.before+l,t.after=l+t.after}},x.stripLinkDefs=function(t,e){return t=t.replace(/^[ ]{0,3}\[(\d+)\]:[ \t]*\n?[ \t]*(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|$)/gm,function(t,n,r,i,a){return e[n]=t.replace(/\s*$/,""),i?(e[n]=t.replace(/["(](.+?)[")]$/,""),i+a):""})},x.addLinkDef=function(t,e){var n=0,r={};t.before=this.stripLinkDefs(t.before,r),t.selection=this.stripLinkDefs(t.selection,r),t.after=this.stripLinkDefs(t.after,r);var i="",a=/(\[)((?:\[[^\]]*\]|[^\[\]])*)(\][ ]?(?:\n[ ]*)?\[)(\d+)(\])/g,o=function(t){n++,t=t.replace(/^[ ]{0,3}\[(\d+)\]:/," ["+n+"]:"),i+="\n"+t},s=function(t,e,i,l,c,u){return i=i.replace(a,s),r[c]?(o(r[c]),e+i+l+n+u):t};t.before=t.before.replace(a,s),e?o(e):t.selection=t.selection.replace(a,s);var l=n;return t.after=t.after.replace(a,s),t.after&&(t.after=t.after.replace(/\n*$/,"")),t.after||(t.selection=t.selection.replace(/\n*$/,"")),t.after+="\n\n"+i,l},x.insertLink=function(t,e,n,r,i){t.trimWhitespace(),t.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\[.*?\])?/);var a;if(!(t.endTag.length>1&&t.startTag.length>0)){if(t.selection=t.startTag+t.selection+t.endTag,t.startTag=t.endTag="",/\n\n/.test(t.selection))return void this.addLinkDef(t,null);var o=function(n){if(a.parentNode.removeChild(a),"string"==typeof n&&(n=[n]),r||(r="title"),1==n.length){var o=n[0];o&&(t.selection=(" "+t.selection).replace(/([^\\](?:\\\\)*)(?=[[\]])/g,"$1\\").substr(1),t.startTag=i?"+")",t.selection=r)}else{t.selection="",t.startTag="",t.endTag="";for(var l=0;l1&&t.startTag.length>0)){if(t.selection=t.startTag+t.selection+t.endTag,t.startTag=t.endTag="",/\n\n/.test(t.selection))return void this.addLinkDef(t,null);var i=this,a=function(a){r.parentNode.removeChild(r),null!==a&&(t.selection=(" "+t.selection).replace(/([^\\](?:\\\\)*)(?=[[\]])/g,"$1\\").substr(1),t.startTag=n?"+")",t.selection||(t.selection=i.getString(n?"imagedescription":"linkdescription"))),e()};return r=u.createBackground(),n?this.hooks.insertImageDialog(a)||u.prompt(this.getString("imagedialog"),v,a):this.hooks.insertLinkDialog(a)||u.prompt(this.getString("linkdialog"),y,a),!0}t.startTag=t.startTag.replace(/!?\[/,""),t.endTag="",this.addLinkDef(t,null)},x.doAutoindent=function(t){var e=this,n=!1;t.before=t.before.replace(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]*\n$/,"\n\n"),t.before=t.before.replace(/(\n|^)[ ]{0,3}>[ \t]*\n$/,"\n\n"),t.before=t.before.replace(/(\n|^)[ \t]+\n$/,"\n\n"),t.selection||/^[ \t]*(?:\n|$)/.test(t.after)||(t.after=t.after.replace(/^[^\n]*/,function(e){return t.selection=e,""}),n=!0),/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]+.*\n$/.test(t.before)&&e.doList&&e.doList(t),/(\n|^)[ ]{0,3}>[ \t]+.*\n$/.test(t.before)&&e.doBlockquote&&e.doBlockquote(t),/(\n|^)(\t|[ ]{4,}).*\n$/.test(t.before)&&e.doCode&&e.doCode(t),n&&(t.after=t.selection+t.after,t.selection="")},x.doBlockquote=function(t){t.selection=t.selection.replace(/^(\n*)([^\r]+?)(\n*)$/,function(e,n,r,i){return t.before+=n,t.after=i+t.after,r}),t.before=t.before.replace(/(>[ \t]*)$/,function(e,n){return t.selection=n+t.selection,""}),t.selection=t.selection.replace(/^(\s|>)+$/,""),t.selection=t.selection||this.getString("quoteexample");var e,n="",r="";if(t.before){for(var i=t.before.replace(/\n$/,"").split("\n"),a=!1,o=0;o 0,/^>/.test(e)?(s=!0,!a&&e.length>1&&(a=!0)):s=/^[ \t]*$/.test(e)?!0:a,s?n+=e+"\n":(r+=n+e,n="\n")}/(^|\n)>/.test(n)||(r+=n,n="")}t.startTag=n,t.before=r,t.after&&(t.after=t.after.replace(/^\n?/,"\n")),t.after=t.after.replace(/^(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*)/,function(e){return t.endTag=e,""});var l=function(e){var n=e?"> ":"";t.startTag&&(t.startTag=t.startTag.replace(/\n((>|\s)*)\n$/,function(t,e){return"\n"+e.replace(/^[ ]{0,3}>?[ \t]*$/gm,n)+"\n"})),t.endTag&&(t.endTag=t.endTag.replace(/^\n((>|\s)*)\n/,function(t,e){return"\n"+e.replace(/^[ ]{0,3}>?[ \t]*$/gm,n)+"\n"}))};/^(?![ ]{0,3}>)/m.test(t.selection)?(this.wrap(t,p.lineLength-2),t.selection=t.selection.replace(/^/gm,"> "),l(!0),t.skipLines()):(t.selection=t.selection.replace(/^[ ]{0,3}> ?/gm,""),this.unwrap(t),l(!1),!/^(\n|^)[ ]{0,3}>/.test(t.selection)&&t.startTag&&(t.startTag=t.startTag.replace(/\n{0,2}$/,"\n\n")),!/(\n|^)[ ]{0,3}>.*$/.test(t.selection)&&t.endTag&&(t.endTag=t.endTag.replace(/^\n{0,2}/,"\n\n"))),t.selection=this.hooks.postBlockquoteCreation(t.selection),/\n/.test(t.selection)||(t.selection=t.selection.replace(/^(> *)/,function(e,n){return t.startTag+=n,""}))},x.doCode=function(t){var e=/\S[ ]*$/.test(t.before),n=/^[ ]*\S/.test(t.after);if(!n&&!e||/\n/.test(t.selection)){t.before=t.before.replace(/[ ]{4}$/,function(e){return t.selection=e+t.selection,""});var r=1,i=1;/(\n|^)(\t|[ ]{4,}).*\n$/.test(t.before)&&(r=0),/^\n(\t|[ ]{4,})/.test(t.after)&&(i=0),t.skipLines(r,i),t.selection?/^[ ]{0,3}\S/m.test(t.selection)?/\n/.test(t.selection)?t.selection=t.selection.replace(/^/gm," "):t.before+=" ":t.selection=t.selection.replace(/^(?:[ ]{4}|[ ]{0,3}\t)/gm,""):(t.startTag=" ",t.selection=this.getString("codeexample"))}else t.trimWhitespace(),t.findTags(/`/,/`/),t.startTag||t.endTag?t.endTag&&!t.startTag?(t.before+=t.endTag,t.endTag=""):t.startTag=t.endTag="":(t.startTag=t.endTag="`",t.selection||(t.selection=this.getString("codeexample")))},x.doList=function(t,e,n){var r=/(\n|^)(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*$/,i=/^\n*(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*/,a="-",o=1,s=function(){var t;return n?(t=" "+o+". ",o++):t=" "+a+" ",t},l=function(t){return void 0===n&&(n=/^\s*\d/.test(t)),t=t.replace(/^[ ]{0,3}([*+-]|\d+[.])\s/gm,function(){return s()})};if(t.findTags(/(\n|^)*[ ]{0,3}([*+-]|\d+[.])\s+/,null),!t.before||/\n$/.test(t.before)||/^\n/.test(t.startTag)||(t.before+=t.startTag,t.startTag=""),t.startTag){var c=/\d+[.]/.test(t.startTag);if(t.startTag="",t.selection=t.selection.replace(/\n[ ]{4}/g,"\n"),this.unwrap(t),t.skipLines(),c&&(t.after=t.after.replace(i,l)),n==c)return}var u=1;t.before=t.before.replace(r,function(t){return/^\s*([*+-])/.test(t)&&(a=f.$1),u=/[^\n]\n\n[^\n]/.test(t)?1:0,l(t)}),t.selection||(t.selection=this.getString("litem"));var h=s(),d=1;t.after=t.after.replace(i,function(t){return d=/[^\n]\n\n[^\n]/.test(t)?1:0,l(t)}),t.trimWhitespace(!0),t.skipLines(u,d,!0),t.startTag=h;var g=h.replace(/./g," ");this.wrap(t,p.lineLength-g.length),t.selection=t.selection.replace(/\n/g,"\n"+g)},x.doHeading=function(t){if(t.selection=t.selection.replace(/\s+/g," "),t.selection=t.selection.replace(/(^\s+|\s+$)/g,""),!t.selection)return t.before&&"\n"!=t.before[t.before.length-1]&&t.skipLines(1,1),t.startTag="# ",t.selection=this.getString("headingexample"),void(t.endTag="");t.findTags(/#+[ ]*/,/[ ]*#+/),t.before&&"\n"!=t.before[t.before.length-1]&&t.skipLines(1,1);var e=0,n=t.startTag;/^#+[ ]*$/.test(n)&&(n=n.replace(/ /g,""),e=n.length);var r=0;if(e>=0&&3>=e&&(r=e+1),e>=4&&(r=0,t.startTag=""),r>0){for(var i="";r--;)i+="#";i+=" ",t.startTag=i}},x.doHorizontalRule=function(t){t.startTag="----------\n",t.selection="",t.skipLines(1,1,!0)}}(),define("pagedown",function(){}),define("core",["underscore","crel","editor","constants","utils","storage","settings","eventMgr","pagedown"],function(t,e,n,r,i,a,o,s){function l(){f=!0,d=!0;var t=i.currentTime;t>p+1e3&&(p=t,s.onUserActive())}var c={};MD=n;var u,h,f=!1,d=!1,p=0;return c.initEditorFirst=function(){var t=new Markdown.Converter,e={_DoItalicsAndBold:function(t){return t=t.replace(/(\*\*|__)(?=\S)(.+?[*_]*)(?=\S)\1/g,"$2"),t=t.replace(/(\*|_)(?=\S)(.+?)(?=\S)\1/g,"$2")}};t.setOptions(e),u=new Markdown.Editor(t,void 0,{undoManager:n.undoMgr}),MD.insertLink2=u.insertLink,u.hooks.set("insertLinkDialog",function(t){return c.insertLinkCallback=t,i.resetModalInputs(),$(".modal-insert-link").modal(),!0}),u.hooks.set("insertImageDialog",function(t){if(c.insertLinkCallback=t,c.catchModal)return!0;i.resetModalInputs();var e=$("#leauiIfrForMD");return e.attr("src")||e.attr("src","/tinymce/plugins/leaui_image/index.html?md=1"),$(".modal-insert-image").modal(),!0}),s.onPagedownConfigure(u),u.hooks.chain("onPreviewRefresh",s.onAsyncPreview),u.run(),$(".wmd-button-row li").addClass("btn btn-success").css("left",0).find("span").hide();var r=$(".wmd-button-group1");$("#wmd-bold-button").append($('')).appendTo(r),$("#wmd-italic-button").append($('')).appendTo(r),r=$(".wmd-button-group2"),$("#wmd-link-button").append($('')).appendTo(r),$("#wmd-quote-button").append($('')).appendTo(r),$("#wmd-code-button").append($('')).appendTo(r),$("#wmd-image-button").append($('')).appendTo(r),r=$(".wmd-button-group3"),$("#wmd-olist-button").append($('')).appendTo(r),$("#wmd-ulist-button").append($('')).appendTo(r),$("#wmd-heading-button").append($('')).appendTo(r),$("#wmd-hr-button").append($('')).appendTo(r),r=$(".wmd-button-group5"),$("#wmd-undo-button").append($('')).appendTo(r),$("#wmd-redo-button").append($('')).appendTo(r),$("#wmd-help-button").show()},c.initEditor=function(t){return void 0!==h&&s.onFileClosed(h),h=t,void 0!==u?(n.undoMgr.init(),u.uiManager.setUndoRedoButtonStates()):(c.initEditorFirst(),void n.undoMgr.init())},c.onReady=function(){document.body.className+=" "+o.editMode,i.init(),$(document).mousemove(l).keypress(l),s.onReady(),c.initEditorFirst(),n.init()},s.addListener("onReady",function(){$(document.body).on("shown.bs.modal",".modal",function(){var t=$(this);setTimeout(function(){t.find(".btn:first").focus(),t.find("button:first").focus(),t.find("input:enabled:visible:first").focus()},50)}).on("hidden.bs.modal",".modal",function(){n.focus()}).on("keypress",".modal",function(t){13!=t.which||$(t.target).is("textarea")||$(this).find(".modal-footer a:last").click()}),$(".action-insert-link").click(function(t){var e=i.getInputTextValue($("#input-insert-link"),t);void 0!==e&&(c.insertLinkCallback(e),c.insertLinkCallback=void 0)}),$(".action-insert-image").click(function(){var t=document.mdImageManager.mdGetImgSrc();t&&(c.insertLinkCallback(t),c.insertLinkCallback=void 0)}),$(".modal-insert-link, .modal-insert-image").on("hidden.bs.modal",function(){void 0!==c.insertLinkCallback&&(c.insertLinkCallback(null),c.insertLinkCallback=void 0)}),$("div.dropdown-menu").click(function(t){t.stopPropagation()}),$("#wmd-help-button").click(function(){window.open("http://leanote.com/blog/view/531b263bdfeb2c0ea9000002")}),t.each(document.querySelectorAll("img"),function(t){var e=$(t),n=e.data("stackeditSrc");n&&e.attr("src",window.baseDir+"/img/"+n)})}),c}),define("css/css",[],function(){if("undefined"==typeof window)return{load:function(t,e,n){n()}};var t=document.getElementsByTagName("head")[0],e=window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)/)||0,n=!1,r=!0;e[1]||e[7]?n=parseInt(e[1])<6||parseInt(e[7])<=9:e[2]?r=!1:e[4]&&(n=parseInt(e[4])<18);var i={};i.pluginBuilder="./css-builder";var a,o,s,l=function(){a=document.createElement("style"),t.appendChild(a),o=a.styleSheet||a.sheet},c=0,u=[],h=function(t){c++,32==c&&(l(),c=0),o.addImport(t),a.onload=function(){f()}},f=function(){s();var t=u.shift();return t?(s=t[1],void h(t[0])):void(s=null)},d=function(t,e){if(o&&o.addImport||l(),o&&o.addImport)s?u.push([t,e]):(h(t),s=e);else{a.textContent='@import "'+t+'";';var n=setInterval(function(){try{a.sheet.cssRules,clearInterval(n),e()}catch(t){}},10)}},p=function(e,n){var i=document.createElement("link");if(i.type="text/css",i.rel="stylesheet",r)i.onload=function(){i.onload=function(){},setTimeout(n,7)};else var a=setInterval(function(){for(var t=0;t a;++a)if(n=t.attributes[a],i=n.name,"class"!=i){if(r=e.attributes.getNamedItem(i),n.specified!=r.specified)return!1;if(n.specified&&n.nodeValue!==r.nodeValue)return!1}return!0}function f(t,e){for(var n,r=0,i=t.attributes.length;i>r;++r)if(n=t.attributes[r].name,(!e||!E.arrayContains(e,n))&&t.attributes[r].specified&&"class"!=n)return!0;return!1}function d(t,e){for(var n in e)if(e.hasOwnProperty(n)&&t[n]!==e[n])return!1;return!0}function p(t){var e;return t&&1==t.nodeType&&((e=t.parentNode)&&9==e.nodeType&&"on"==e.designMode||N(t)&&!N(t.parentNode))}function g(t){return(N(t)||1!=t.nodeType&&N(t.parentNode))&&!p(t)}function m(t){return t&&1==t.nodeType&&!R.test(k(t,"display"))}function v(t){if(0==t.data.length)return!0;if(A.test(t.data))return!1;var e=k(t.parentNode,"whiteSpace");switch(e){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(t.data))return!1}return m(t.previousSibling)||m(t.nextSibling)}function y(t,e){return E.isCharacterDataNode(t)?0==e?!!t.previousSibling:e==t.length?!!t.nextSibling:!0:e>0&&e o;++o)"*"==r[o]?this.applyToAnyTagName=!0:this.tagNames.push(r[o].toLowerCase());else this.tagNames=[this.elementTagName]}function C(t,e,n){return new S(t,e,n)}t.requireModules(["WrappedSelection","WrappedRange"]);var k,E=t.dom,T="span",I=function(){function t(t,e,n){return e&&n?" ":""}return function(e,n){e.className&&(e.className=e.className.replace(new RegExp("(?:^|\\s)"+n+"(?:\\s|$)"),t))}}();"undefined"!=typeof window.getComputedStyle?k=function(t,e){return E.getWindow(t).getComputedStyle(t,null)[e]}:"undefined"!=typeof document.documentElement.currentStyle?k=function(t,e){return t.currentStyle[e]}:e.fail("No means of obtaining computed style properties found");var N;!function(){var t=document.createElement("div");N="boolean"==typeof t.isContentEditable?function(t){return t&&1==t.nodeType&&t.isContentEditable}:function(t){return t&&1==t.nodeType&&"false"!=t.contentEditable?"true"==t.contentEditable||N(t.parentNode):!1}}();var R=/^inline(-block|-table)?$/i,A=/[^\r\n\t\f \u200B]/,M=w(!1),L=w(!0);_.prototype={doMerge:function(){for(var t,e,n,r=[],i=0,a=this.textNodes.length;a>i;++i)t=this.textNodes[i],e=t.parentNode,r[i]=t.data,i&&(e.removeChild(t),e.hasChildNodes()||e.parentNode.removeChild(e));return this.firstTextNode.data=n=r.join(""),n},getLength:function(){for(var t=this.textNodes.length,e=0;t--;)e+=this.textNodes[t].length;return e},toString:function(){for(var t=[],e=0,n=this.textNodes.length;n>e;++e)t[e]="'"+this.textNodes[e].data+"'";return"[Merge("+t.join(",")+")]"}};var O=["elementTagName","ignoreWhiteSpace","applyToEditableOnly"],D={"class":"className"};S.prototype={elementTagName:T,elementProperties:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,hasClass:function(t){return 1==t.nodeType&&E.arrayContains(this.tagNames,t.tagName.toLowerCase())&&r(t,this.cssClass)},getSelfOrAncestorWithClass:function(t){for(;t;){if(this.hasClass(t,this.cssClass))return t;t=t.parentNode}return null},isModifiable:function(t){return!this.applyToEditableOnly||g(t)},isIgnorableWhiteSpaceNode:function(t){return this.ignoreWhiteSpace&&t&&3==t.nodeType&&v(t)},postApply:function(t,e,n){for(var r,i,a,o=t[0],s=t[t.length-1],l=[],c=o,u=s,h=0,f=s.length,d=0,p=t.length;p>d;++d)i=t[d],a=M(i,!n),a?(r||(r=new _(a),l.push(r)),r.textNodes.push(i),i===o&&(c=r.firstTextNode,h=c.length),i===s&&(u=r.firstTextNode,f=r.getLength())):r=null;var g=L(s,!n);if(g&&(r||(r=new _(s),l.push(r)),r.textNodes.push(g)),l.length){for(d=0,p=l.length;p>d;++d)l[d].doMerge();e.setStart(c,h),e.setEnd(u,f)}},createContainer:function(e){var n=e.createElement(this.elementTagName);return t.util.extend(n,this.elementProperties),i(n,this.cssClass),n},applyToTextNode:function(t){var e=t.parentNode;if(1==e.childNodes.length&&E.arrayContains(this.tagNames,e.tagName.toLowerCase()))i(e,this.cssClass);else{var n=this.createContainer(E.getDocument(t));t.parentNode.insertBefore(n,t),n.appendChild(t)}},isRemovable:function(t){return t.tagName.toLowerCase()==this.elementTagName&&o(t)==this.elementSortedClassName&&d(t,this.elementProperties)&&!f(t,this.attrExceptions)&&this.isModifiable(t)},undoToTextNode:function(t,e,n){if(!e.containsNode(n)){var r=e.cloneRange();r.selectNode(n),r.isPointInRange(e.endContainer,e.endOffset)&&(x(n,e.endContainer,e.endOffset,[e]),e.setEndAfter(n)),r.isPointInRange(e.startContainer,e.startOffset)&&(n=x(n,e.startContainer,e.startOffset,[e]))}this.isRemovable(n)?l(n):I(n,this.cssClass)},applyToRange:function(t){t.splitBoundaries();var e=u(t);if(e.length){for(var n,r=0,i=e.length;i>r;++r)n=e[r],this.isIgnorableWhiteSpaceNode(n)||this.getSelfOrAncestorWithClass(n)||!this.isModifiable(n)||this.applyToTextNode(n);t.setStart(e[0],0),n=e[e.length-1],t.setEnd(n,n.length),this.normalize&&this.postApply(e,t,!1)}},applyToSelection:function(e){e=e||window;var n,r=t.getSelection(e),i=r.getAllRanges();r.removeAllRanges();for(var a=i.length;a--;)n=i[a],this.applyToRange(n),r.addRange(n)},undoToRange:function(t){t.splitBoundaries();var e,n,r=u(t),i=r[r.length-1];if(r.length){for(var a=0,o=r.length;o>a;++a)e=r[a],n=this.getSelfOrAncestorWithClass(e),n&&this.isModifiable(e)&&this.undoToTextNode(e,t,n),t.setStart(r[0],0),t.setEnd(i,i.length);this.normalize&&this.postApply(r,t,!0)}},undoToSelection:function(e){e=e||window;var n,r=t.getSelection(e),i=r.getAllRanges();r.removeAllRanges();for(var a=0,o=i.length;o>a;++a)n=i[a],this.undoToRange(n),r.addRange(n)},getTextSelectedByRange:function(t,e){var n=e.cloneRange();n.selectNodeContents(t);var r=n.intersection(e),i=r?r.toString():"";return n.detach(),i},isAppliedToRange:function(t){if(t.collapsed)return!!this.getSelfOrAncestorWithClass(t.commonAncestorContainer);for(var e,n=t.getNodes([3]),r=0;e=n[r++];)if(!this.isIgnorableWhiteSpaceNode(e)&&c(t,e)&&this.isModifiable(e)&&!this.getSelfOrAncestorWithClass(e))return!1;return!0},isAppliedToSelection:function(e){e=e||window;for(var n=t.getSelection(e),r=n.getAllRanges(),i=r.length;i--;)if(!this.isAppliedToRange(r[i]))return!1;return!0},toggleRange:function(t){this.isAppliedToRange(t)?this.undoToRange(t):this.applyToRange(t)},toggleSelection:function(t){this.isAppliedToSelection(t)?this.undoToSelection(t):this.applyToSelection(t)},detach:function(){}},S.util={hasClass:r,addClass:i,removeClass:I,hasSameClasses:s,replaceWithOwnChildren:l,elementsHaveSameNonClassAttributes:h,elementHasNonClassAttributes:f,splitNodeAt:x,isEditableElement:N,isEditingHost:p,isEditable:g},t.CssClassApplier=S,t.createCssClassApplier=C}),define("rangy-cssclassapplier",function(){}),requirejs.config({waitSeconds:0,packages:[{name:"css",location:"bower-libs/require-css",main:"css"},{name:"less",location:"bower-libs/require-less",main:"less"}],paths:{underscore:"bower-libs/underscore/underscore",crel:"bower-libs/crel/crel",jgrowl:"bower-libs/jgrowl/jquery.jgrowl",mousetrap:"bower-libs/mousetrap/mousetrap","mousetrap-record":"bower-libs/mousetrap/plugins/record/mousetrap-record",toMarkdown:"bower-libs/to-markdown/src/to-markdown",text:"bower-libs/requirejs-text/text",mathjax:"libs/MathJax/MathJax.js?config=TeX-AMS_HTML",bootstrap:"bower-libs/bootstrap/dist/js/bootstrap",requirejs:"bower-libs/requirejs/require","google-code-prettify":"bower-libs/google-code-prettify/src/prettify",highlightjs:"libs/highlight/highlight.pack","jquery-waitforimages":"bower-libs/waitForImages/src/jquery.waitforimages","jquery-ui":"bower-libs/jquery-ui/ui/jquery-ui","jquery-ui-core":"bower-libs/jquery-ui/ui/jquery.ui.core","jquery-ui-widget":"bower-libs/jquery-ui/ui/jquery.ui.widget","jquery-ui-mouse":"bower-libs/jquery-ui/ui/jquery.ui.mouse","jquery-ui-draggable":"bower-libs/jquery-ui/ui/jquery.ui.draggable","jquery-ui-effect":"bower-libs/jquery-ui/ui/jquery.ui.effect","jquery-ui-effect-slide":"bower-libs/jquery-ui/ui/jquery.ui.effect-slide",FileSaver:"bower-libs/FileSaver/FileSaver",stacktrace:"bower-libs/stacktrace/stacktrace","requirejs-text":"bower-libs/requirejs-text/text","bootstrap-tour":"bower-libs/bootstrap-tour/build/js/bootstrap-tour",css_browser_selector:"bower-libs/css_browser_selector/css_browser_selector","pagedown-extra":"bower-libs/pagedown-extra/node-pagedown-extra",pagedownExtra:"bower-libs/pagedown-extra/Markdown.Extra",pagedown:"libs/Markdown.Editor","require-css":"bower-libs/require-css/css",xregexp:"bower-libs/xregexp/xregexp-all",yaml:"bower-libs/yaml.js/bin/yaml","yaml.js":"bower-libs/yaml.js","yaml-js":"bower-libs/yaml.js/bin/yaml",css:"bower-libs/require-css/css","css-builder":"bower-libs/require-css/css-builder",normalize:"bower-libs/require-css/normalize",prism:"bower-libs/prism/prism","prism-core":"bower-libs/prism/components/prism-core",MutationObservers:"bower-libs/MutationObservers/MutationObserver",WeakMap:"bower-libs/WeakMap/weakmap",rangy:"bower-libs/rangy/rangy-core","rangy-cssclassapplier":"bower-libs/rangy/rangy-cssclassapplier",diff_match_patch:"bower-libs/google-diff-match-patch-js/diff_match_patch",diff_match_patch_uncompressed:"bower-libs/google-diff-match-patch-js/diff_match_patch_uncompressed",jsondiffpatch:"bower-libs/jsondiffpatch/build/bundle",hammerjs:"bower-libs/hammerjs/hammer",Diagram:"bower-libs/js-sequence-diagrams/src/sequence-diagram","diagram-grammar":"bower-libs/js-sequence-diagrams/build/diagram-grammar",raphael:"bower-libs/raphael/raphael","flow-chart":"bower-libs/flowchart/release/flowchart.amd-1.3.4.min",flowchart:"bower-libs/flowchart/release/flowchart-1.3.4.min",monetizejs:"bower-libs/monetizejs/src/monetize","to-markdown":"bower-libs/to-markdown/src/to-markdown",waitForImages:"bower-libs/waitForImages/dist/jquery.waitforimages",MathJax:"../libs/MathJax/MathJax",alertify:"bower-libs/alertify.js/lib/alertify"},shim:{underscore:{exports:"_"},mathjax:["libs/mathjax_init"],jgrowl:{deps:[],exports:"jQuery.jGrowl"},diff_match_patch_uncompressed:{exports:"diff_match_patch"},jsondiffpatch:["diff_match_patch_uncompressed"],rangy:{exports:"rangy"},"rangy-cssclassapplier":["rangy"],mousetrap:{exports:"Mousetrap"},"yaml-js":{exports:"YAML"},"prism-core":{exports:"Prism"},"bower-libs/prism/components/prism-markup":["prism-core"],"libs/prism-latex":["prism-core"],"libs/prism-markdown":["bower-libs/prism/components/prism-markup","libs/prism-latex"],"bootstrap-record":["mousetrap"],toMarkdown:{deps:[],exports:"toMarkdown"},stacktrace:{exports:"printStackTrace"},FileSaver:{exports:"saveAs"},MutationObservers:["WeakMap"],highlightjs:{exports:"hljs"},"bootstrap-tour":{deps:["bootstrap"],exports:"Tour"},bootstrap:[],"jquery-waitforimages":[],pagedown:["libs/Markdown.Converter"],pagedownExtra:["libs/Markdown.Converter"],"flow-chart":["raphael"],"diagram-grammar":["underscore"],Diagram:["raphael","diagram-grammar"]}}),window.viewerMode=!1,window.theme="default";var themeModule="less!themes/"+window.theme;require(["rangy","core","eventMgr","css","rangy-cssclassapplier"],function(t,e){window.noStart||$(function(){t.init(),e.onReady()})}),define("main",function(){}); -function setEditorContent(e){MD&&e?(MD.setContent(e),MDInited=!0):clearIntervalForSetContent=setTimeout(function(){setEditorContent(e,!0)},100)}function ZSSField(e,t){this.wrappedObject=e,this.isTitle=t,this.bodyPlaceholderColor="#000000"}var MDInited=!1;ZSSField.prototype.enableEditing=function(){this.isTitle?this.wrappedObject.attr("contenteditable",!0):LEAMD.toggleWrite()},ZSSField.prototype.disableEditing=function(){this.isTitle?(this.blur(),this.wrappedObject.attr("contenteditable",!1)):LEAMD.togglePreview()},ZSSField.prototype.setHTML=function(e){this.isTitle?this.wrappedObject.html(e):setEditorContent(e)},ZSSField.prototype.setPlainText=function(e){this.wrappedObject.text(e)},ZSSField.prototype.strippedHTML=function(){return this.wrappedObject.text()},ZSSField.prototype.getHTML=function(){return this.isTitle?this.wrappedObject.html():MD?MD.getContent():""},ZSSField.prototype.isFocused=function(){return this.wrappedObject.is(":focus")},ZSSField.prototype.focus=function(){this.isFocused()||this.wrappedObject.focus()},ZSSField.prototype.blur=function(){this.isFocused()&&this.wrappedObject.blur()},ZSSField.prototype.hasPlaceholderText=function(){return null!=this.wrappedObject.attr("placeholderText")},ZSSField.prototype.setPlaceholderText=function(e){this.wrappedObject.attr("placeholderText",e)},ZSSField.prototype.setPlaceholderColor=function(e){this.bodyPlaceholderColor=e,this.refreshPlaceholderColor()},ZSSField.prototype.refreshPlaceholderColor=function(){this.refreshPlaceholderColorForAttributes(this.hasPlaceholderText(),this.isFocused(),this.isEmpty())},ZSSField.prototype.refreshPlaceholderColorAboutToGainFocus=function(e){this.refreshPlaceholderColorForAttributes(this.hasPlaceholderText(),e,this.isEmpty())},ZSSField.prototype.refreshPlaceholderColorForAttributes=function(e,t,o){var i=e&&o;i?t?this.wrappedObject.css("color",this.bodyPlaceholderColor):this.wrappedObject.css("color",this.bodyPlaceholderColor):this.wrappedObject.css("color","")};var titleField=new ZSSField($($title),!0),contentField=new ZSSField($content),LEAMD={mdEditorO:$("#mdEditor"),init:function(){tapLea("#preview-contents","img, a",function(){if($(this).is("img")){var e=$(this).attr("src");if(!e)return;var t=[];$("#preview-contents img").each(function(){var e=$(this).attr("src");e&&t.push(e)}),t.push(e),callObjc("callback-image-tap:id=0~url="+t.join(","))}else{var o=$(this).attr("href");callObjc("callback-link-tap:id=zss_field_content~url="+o)}})},togglePreview:function(){$content.blur(),$content.attr("contenteditable",!1),$title.attr("contenteditable",!1),this.mdEditorO.removeClass("write"),$("body").scrollTop(0)},toggleWrite:function(){this.mdEditorO.addClass("write"),$content.attr("contenteditable",!0),$title.attr("contenteditable",!0),setTimeout(function(){$title.focus()})},keyboardShow:function(e,t){window.keyboardHeight=e,window.windowHeight=t},lastTime:11,lastTop:0,keyboardHide:function(){},insertLocalImage:function(e,t){MD.insertLink(t,"",!0)},insertImage:function(e,t){MD.insertLink(e,t,!0)},insertLink:function(e,t){MD.insertLink(e,t,!1)},setBold:function(){MD.execCommand("bold")},setItalic:function(){MD.execCommand("italic")},setHorizontalRule:function(){MD.execCommand("hr")},setHeading:function(){MD.execCommand("heading")},setBlockquote:function(){MD.execCommand("blockquote")},setUnorderedList:function(){MD.execCommand("list")},setOrderedList:function(){MD.execCommand("numberList")},getField:function(e){return"zss_field_title"===e?titleField:contentField},newline:function(){MD.selectionMgr.saveSelectionState(),$(".editor-content").trigger("newline")},_range:{},backupRange:function(){log("backupRange11"),MD.selectionMgr.saveSelectionState()},restoreRange:function(){log("restoreRange22"),MD.execCommand("blank")}};LEAMD.init();var ZSSEditor=LEAMD;if(ZSSEditor.refreshVisibleViewportSize=function(){},ZSSEditor.closerParentNodeWithName=function(e){var t=window.getSelection(),o=t.getRangeAt(0).cloneRange(),i=o.commonAncestorContainer;return this.closerParentNodeWithNameRelativeToNode(e,i)},ZSSEditor.closerParentNodeWithNameRelativeToNode=function(e,t){e=e.toUpperCase();for(var o=null,i=t;i&&i.nodeName!=document.body.nodeName;){if(i.nodeName==e&&i.nodeType==document.ELEMENT_NODE){o=i;break}i=i.parentElement}return o},ZSSEditor.closerParentNode=function(){for(var e=null,t=window.getSelection(),o=t.getRangeAt(0).cloneRange(),i=o.commonAncestorContainer;i;){if(i.nodeType==document.ELEMENT_NODE){e=i;break}i=i.parentElement}return e},ZSSEditor._getCaretYPosition=function(){var e=window.getSelection(),t=e.getRangeAt(0),o=document.createElement("span");o.appendChild(document.createTextNode("")),t.insertNode(o);var i=o.offsetTop,n=o.parentNode;return n.removeChild(o),n.normalize(),i},ZSSEditor.getCaretYPosition=function(){var e=window.getSelection(),t=0==e.rangeCount;if(t)return null;var o=0,i=0,n=e.getRangeAt(0),r=0==n.getClientRects().length;if(r){var l=ZSSEditor.closerParentNode(),c=(ZSSEditor.closerParentNodeWithName("div"),$(l).css("font-size")),a=Math.floor(1.5*parseInt(c.replace("px","")));o=this._getCaretYPosition(),i=a}else if(n.getClientRects){var d=n.getClientRects();if(d.length>0){var s=document.body.getClientRects()[0].top<0;s&&(o=document.body.scrollTop),o+=d[0].top,i=d[0].height}}return log("getCaretYPosition: "+o),o},ZSSEditor.getSelectedText=function(){var e=window.getSelection();return e?e.toString():""},ZSSEditor.logMainElementSizes=function(){},isDebug){titleField.enableEditing(),contentField.enableEditing();var content=$("#life").val();setEditorContent(content)} \ No newline at end of file +function setEditorContent(e){MD&&e?(MD.setContent(e),MDInited=!0):clearIntervalForSetContent=setTimeout(function(){setEditorContent(e,!0)},100)}function ZSSField(e,t){this.wrappedObject=e,this.isTitle=t,this.bodyPlaceholderColor="#000000"}var MDInited=!1;ZSSField.prototype.enableEditing=function(){this.isTitle?this.wrappedObject.attr("contenteditable",!0):LEAMD.toggleWrite()},ZSSField.prototype.disableEditing=function(){this.isTitle?(this.blur(),this.wrappedObject.attr("contenteditable",!1)):LEAMD.togglePreview()},ZSSField.prototype.setHTML=function(e){this.isTitle?this.wrappedObject.html(e):setEditorContent(e)},ZSSField.prototype.setPlainText=function(e){this.wrappedObject.text(e)},ZSSField.prototype.strippedHTML=function(){return this.wrappedObject.text()},ZSSField.prototype.getHTML=function(){return this.isTitle?this.wrappedObject.html():MD?MD.getContent():""},ZSSField.prototype.isFocused=function(){return this.wrappedObject.is(":focus")},ZSSField.prototype.focus=function(){this.isFocused()||this.wrappedObject.focus()},ZSSField.prototype.blur=function(){this.isFocused()&&this.wrappedObject.blur()},ZSSField.prototype.hasPlaceholderText=function(){return null!=this.wrappedObject.attr("placeholderText")},ZSSField.prototype.setPlaceholderText=function(e){this.wrappedObject.attr("placeholderText",e)},ZSSField.prototype.setPlaceholderColor=function(e){this.bodyPlaceholderColor=e,this.refreshPlaceholderColor()},ZSSField.prototype.refreshPlaceholderColor=function(){this.refreshPlaceholderColorForAttributes(this.hasPlaceholderText(),this.isFocused(),this.isEmpty())},ZSSField.prototype.refreshPlaceholderColorAboutToGainFocus=function(e){this.refreshPlaceholderColorForAttributes(this.hasPlaceholderText(),e,this.isEmpty())},ZSSField.prototype.refreshPlaceholderColorForAttributes=function(e,t,o){var i=e&&o;i?t?this.wrappedObject.css("color",this.bodyPlaceholderColor):this.wrappedObject.css("color",this.bodyPlaceholderColor):this.wrappedObject.css("color","")};var titleField=new ZSSField($($title),!0),contentField=new ZSSField($content),LEAMD={mdEditorO:$("#mdEditor"),init:function(){this.isiPad=null!=navigator.userAgent.match(/iPad/i),this.isiPad&&$(document.body).addClass("ipad_body"),tapLea("#preview-contents","img, a",function(){if($(this).is("img")){var e=$(this).attr("src");if(!e)return;var t=[];$("#preview-contents img").each(function(){var e=$(this).attr("src");e&&t.push(e)}),t.push(e),callObjc("callback-image-tap:id=0~url="+t.join(","))}else{var o=$(this).attr("href");callObjc("callback-link-tap:id=zss_field_content~url="+o)}})},togglePreview:function(){$content.blur(),$content.attr("contenteditable",!1),$title.attr("contenteditable",!1),this.mdEditorO.removeClass("write"),$("body").scrollTop(0)},toggleWrite:function(){this.mdEditorO.addClass("write"),$content.attr("contenteditable",!0),$title.attr("contenteditable",!0),setTimeout(function(){$title.focus()})},keyboardShow:function(e,t){window.keyboardHeight=e,window.windowHeight=t},lastTime:11,lastTop:0,keyboardHide:function(){},insertLocalImage:function(e,t){MD.insertLink(t,"",!0)},insertImage:function(e,t){MD.insertLink(e,t,!0)},insertLink:function(e,t){MD.insertLink(e,t,!1)},setBold:function(){MD.execCommand("bold")},setItalic:function(){MD.execCommand("italic")},setHorizontalRule:function(){MD.execCommand("hr")},setHeading:function(){MD.execCommand("heading")},setBlockquote:function(){MD.execCommand("blockquote")},setUnorderedList:function(){MD.execCommand("list")},setOrderedList:function(){MD.execCommand("numberList")},getField:function(e){return"zss_field_title"===e?titleField:contentField},newline:function(){MD.selectionMgr.saveSelectionState(),$(".editor-content").trigger("newline")},_range:{},backupRange:function(){log("backupRange11"),MD.selectionMgr.saveSelectionState()},restoreRange:function(){log("restoreRange22"),MD.execCommand("blank")}};LEAMD.init();var ZSSEditor=LEAMD;if(ZSSEditor.refreshVisibleViewportSize=function(){},ZSSEditor.closerParentNodeWithName=function(e){var t=window.getSelection(),o=t.getRangeAt(0).cloneRange(),i=o.commonAncestorContainer;return this.closerParentNodeWithNameRelativeToNode(e,i)},ZSSEditor.closerParentNodeWithNameRelativeToNode=function(e,t){e=e.toUpperCase();for(var o=null,i=t;i&&i.nodeName!=document.body.nodeName;){if(i.nodeName==e&&i.nodeType==document.ELEMENT_NODE){o=i;break}i=i.parentElement}return o},ZSSEditor.closerParentNode=function(){for(var e=null,t=window.getSelection(),o=t.getRangeAt(0).cloneRange(),i=o.commonAncestorContainer;i;){if(i.nodeType==document.ELEMENT_NODE){e=i;break}i=i.parentElement}return e},ZSSEditor._getCaretYPosition=function(){var e=window.getSelection(),t=e.getRangeAt(0),o=document.createElement("span");o.appendChild(document.createTextNode("")),t.insertNode(o);var i=o.offsetTop,n=o.parentNode;return n.removeChild(o),n.normalize(),i},ZSSEditor.getCaretYPosition=function(){var e=window.getSelection(),t=0==e.rangeCount;if(t)return null;var o=0,i=0,n=e.getRangeAt(0),r=0==n.getClientRects().length;if(r){var l=ZSSEditor.closerParentNode(),a=(ZSSEditor.closerParentNodeWithName("div"),$(l).css("font-size")),c=Math.floor(1.5*parseInt(a.replace("px","")));o=this._getCaretYPosition(),i=c}else if(n.getClientRects){var d=n.getClientRects();if(d.length>0){var s=document.body.getClientRects()[0].top<0;s&&(o=document.body.scrollTop),o+=d[0].top,i=d[0].height}}return log("getCaretYPosition: "+o),o},ZSSEditor.getSelectedText=function(){var e=window.getSelection();return e?e.toString():""},ZSSEditor.logMainElementSizes=function(){},isDebug){titleField.enableEditing(),contentField.enableEditing();var content=$("#life").val();setEditorContent(content)} \ No newline at end of file diff --git a/Leanote/editor/MarkdownAssetsRaw/css/default.css b/Leanote/editor/MarkdownAssetsRaw/css/default.css index d147e4d..8a5ddab 100644 --- a/Leanote/editor/MarkdownAssetsRaw/css/default.css +++ b/Leanote/editor/MarkdownAssetsRaw/css/default.css @@ -24,6 +24,11 @@ font-style: italic; } +html, body { + margin:0; + padding:0; +} + * { outline: 0px solid transparent; /*点击没有高亮focus*/ @@ -37,7 +42,14 @@ body { font-size: 14px; font-family:OpenSans, sans-serif; overflow-x: hidden; + padding-left:5px; + padding-right:5px; } +.ipad_body { + padding-left: 80px; + padding-right: 80px; +} + h1, h2, h3 { @@ -91,10 +103,6 @@ h3 { right: 0; bottom: 0; } -#left-column, -#right-column -{ -} #wmd-input, #wmd-input-sub { @@ -284,4 +292,4 @@ span.token.p { { display: inline-block; margin-bottom: 10px; -} \ No newline at end of file +} diff --git a/Leanote/editor/MarkdownAssetsRaw/res-min/editor.js b/Leanote/editor/MarkdownAssetsRaw/res-min/editor.js index 3ff3064..c3030ac 100644 --- a/Leanote/editor/MarkdownAssetsRaw/res-min/editor.js +++ b/Leanote/editor/MarkdownAssetsRaw/res-min/editor.js @@ -133,6 +133,11 @@ var LEAMD = { // 绑定事件 init: function() { + this.isiPad = (navigator.userAgent.match(/iPad/i) != null); + if (this.isiPad) { + $(document.body).addClass('ipad_body'); + } + // tap事件 tapLea('#preview-contents', 'img, a', function() { if($(this).is('img')) {