From ab36c1f9cd4818778f0d93358608aaa83744241a Mon Sep 17 00:00:00 2001 From: life Date: Mon, 2 Nov 2015 19:45:49 +0800 Subject: [PATCH] =?UTF-8?q?markdown=E7=BC=96=E8=BE=91=E5=99=A8=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=E4=B8=8E=E5=AF=8C=E6=96=87=E6=9C=AC=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #18 --- Leanote/Leanote-Info.plist | 2 +- Leanote/Settings.bundle/Root.plist | 2 +- Leanote/editor/MarkdownAssets/all.css | 17 +++++++++++++---- Leanote/editor/MarkdownAssets/all.js | 2 +- .../editor/MarkdownAssetsRaw/css/default.css | 18 +++++++++++++----- .../editor/MarkdownAssetsRaw/res-min/editor.js | 5 +++++ 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Leanote/Leanote-Info.plist b/Leanote/Leanote-Info.plist index 01d6268..4e3b939 100755 --- a/Leanote/Leanote-Info.plist +++ b/Leanote/Leanote-Info.plist @@ -38,7 +38,7 @@ CFBundleVersion - 95B + 95C LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/Leanote/Settings.bundle/Root.plist b/Leanote/Settings.bundle/Root.plist index e108b7f..7374e82 100755 --- a/Leanote/Settings.bundle/Root.plist +++ b/Leanote/Settings.bundle/Root.plist @@ -18,7 +18,7 @@ AutocorrectionType No DefaultValue - 1.0 (95B) + 1.0 (95C) IsSecure Key diff --git a/Leanote/editor/MarkdownAssets/all.css b/Leanote/editor/MarkdownAssets/all.css index 4e73df6..43d04a5 100644 --- a/Leanote/editor/MarkdownAssets/all.css +++ b/Leanote/editor/MarkdownAssets/all.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 { @@ -285,6 +293,7 @@ span.token.p { display: inline-block; margin-bottom: 10px; } + .form-control:focus { border-color: #f0f0f0; outline: 0; diff --git a/Leanote/editor/MarkdownAssets/all.js b/Leanote/editor/MarkdownAssets/all.js index 13e96bd..6f935aa 100644 --- a/Leanote/editor/MarkdownAssets/all.js +++ b/Leanote/editor/MarkdownAssets/all.js @@ -19,4 +19,4 @@ t=t.substring(0,t.length-o),e=e.substring(0,e.length-o);var c=this.diff_compute_ if("undefined"!=typeof diff_match_patch)e=new diff_match_patch;else if("function"==typeof t){var n=t("../../external/diff_match_patch_uncompressed");e=new n.diff_match_patch}if(!e){var r=new Error("text diff_match_patch library not found");throw r.diff_match_patch_not_found=!0,r}a={diff:function(t,n){return e.patch_toText(e.patch_make(t,n))},patch:function(t,n){for(var r=e.patch_apply(e.patch_fromText(n),t),i=0;ie;e++){i=r[e];var h=i.slice(0,1);"@"===h?(c=u.exec(i),o=e,s=null,l=null,r[o]="@@ -"+c[3]+","+c[4]+" +"+c[1]+","+c[2]+" @@"):"+"===h?(s=e,r[e]="-"+r[e].slice(1),"+"===r[e-1].slice(0,1)&&(a=r[e],r[e]=r[e-1],r[e-1]=a)):"-"===h&&(l=e,r[e]="+"+r[e].slice(1))}return r.join("\n")},u=function(t){t.nested||t.delta[2]===r&&t.setResult([c(t.delta[0]),0,r]).exit()};u.filterName="texts",n.diffFilter=s,n.patchFilter=l,n.reverseFilter=u},{}],14:[function(t,e,n){var r="function"==typeof Array.isArray?Array.isArray:function(t){return t instanceof Array},i=function(t){if(t.left===t.right)return void t.setResult(void 0).exit();if("undefined"==typeof t.left){if("function"==typeof t.right)throw new Error("functions are not supported");return void t.setResult([t.right]).exit()}if("undefined"==typeof t.right)return void t.setResult([t.left,0,0]).exit();if("function"==typeof t.left||"function"==typeof t.right)throw new Error("functions are not supported");return t.leftType=null===t.left?"null":typeof t.left,t.rightType=null===t.right?"null":typeof t.right,t.leftType!==t.rightType?void t.setResult([t.left,t.right]).exit():"boolean"===t.leftType||"number"===t.leftType?void t.setResult([t.left,t.right]).exit():("object"===t.leftType&&(t.leftIsArray=r(t.left)),"object"===t.rightType&&(t.rightIsArray=r(t.right)),t.leftIsArray!==t.rightIsArray?void t.setResult([t.left,t.right]).exit():void 0)};i.filterName="trivial";var a=function(t){return"undefined"==typeof t.delta?void t.setResult(t.left).exit():(t.nested=!r(t.delta),t.nested?void 0:1===t.delta.length?void t.setResult(t.delta[0]).exit():2===t.delta.length?void t.setResult(t.delta[1]).exit():3===t.delta.length&&0===t.delta[2]?void t.setResult(void 0).exit():void 0)};a.filterName="trivial";var o=function(t){return"undefined"==typeof t.delta?void t.setResult(t.delta).exit():(t.nested=!r(t.delta),t.nested?void 0:1===t.delta.length?void t.setResult([t.delta[0],0,0]).exit():2===t.delta.length?void t.setResult([t.delta[1],t.delta[0]]).exit():3===t.delta.length&&0===t.delta[2]?void t.setResult([t.delta[0]]).exit():void 0)};o.filterName="trivial",n.diffFilter=i,n.patchFilter=a,n.reverseFilter=o},{}],15:[function(t,e,n){var r=function(t){this.name=t,this.filters=[]};r.prototype.process=function(t){if(!this.processor)throw new Error("add this pipe to a processor before using it");for(var e=this.debug,n=this.filters.length,r=t,i=0;n>i;i++){var a=this.filters[i];if(e&&this.log("filter: "+a.filterName),a(r),"object"==typeof r&&r.exiting){r.exiting=!1;break}}!r.next&&this.resultCheck&&this.resultCheck(r)},r.prototype.log=function(t){console.log("[jsondiffpatch] "+this.name+" pipe, "+t)},r.prototype.append=function(){return this.filters.push.apply(this.filters,arguments),this},r.prototype.prepend=function(){return this.filters.unshift.apply(this.filters,arguments),this},r.prototype.indexOf=function(t){if(!t)throw new Error("a filter name is required");for(var e=0;e>>0)+(e++ +"__")};n.prototype={set:function(e,n){var r=e[this.name];r&&r[0]===e?r[1]=n:t(e,this.name,{value:[e,n],writable:!0})},get:function(t){var e;return(e=t[this.name])&&e[0]===t?e[1]:void 0},"delete":function(t){this.set(t,void 0)}},window.WeakMap=n}(),define("WeakMap",function(){}),function(t){function e(t){b.push(t),x||(x=!0,m(r))}function n(t){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(t)||t}function r(){x=!1;var t=b;b=[],t.sort(function(t,e){return t.uid_-e.uid_});var e=!1;t.forEach(function(t){var n=t.takeRecords();i(t),n.length&&(t.callback_(n,t),e=!0)}),e&&r()}function i(t){t.nodes_.forEach(function(e){var n=g.get(e);n&&n.forEach(function(e){e.observer===t&&e.removeTransientObservers()})})}function a(t,e){for(var n=t;n;n=n.parentNode){var r=g.get(n);if(r)for(var i=0;i0){var i=n[r-1],a=d(i,t);if(a)return void(n[r-1]=a)}else e(this.observer);n[r]=t},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(t){var e=this.options;e.attributes&&t.addEventListener("DOMAttrModified",this,!0),e.characterData&&t.addEventListener("DOMCharacterDataModified",this,!0),e.childList&&t.addEventListener("DOMNodeInserted",this,!0),(e.childList||e.subtree)&&t.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(t){var e=this.options;e.attributes&&t.removeEventListener("DOMAttrModified",this,!0),e.characterData&&t.removeEventListener("DOMCharacterDataModified",this,!0),e.childList&&t.removeEventListener("DOMNodeInserted",this,!0),(e.childList||e.subtree)&&t.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(t){if(t!==this.target){this.addListeners_(t),this.transientObservedNodes.push(t);var e=g.get(t);e||g.set(t,e=[]),e.push(this)}},removeTransientObservers:function(){var t=this.transientObservedNodes;this.transientObservedNodes=[],t.forEach(function(t){this.removeListeners_(t);for(var e=g.get(t),n=0;n/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi},Prism.hooks.add("wrap",function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))}),define("bower-libs/prism/components/prism-markup",function(){}),Prism.languages.latex={keyword:/\\(?:[^a-zA-Z]|[a-zA-Z]+)/g,lparen:/[[({]/g,rparen:/[\])}]/g,comment:/%.*/g},define("libs/prism-latex",function(){}),Prism.languages.md=function(){var t="(&|[-A-Z0-9+@#/%?=~_|[\\]()!:,.;])",e="(&|[-A-Z0-9+@#/%=~_|[\\])])",n=new RegExp("(https?|ftp)(://"+t+"*"+e+")(?=$|\\W)","gi"),r=/(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)/gi,i=Prism.languages.latex,a=/\n/gm,o={};o["pre gfm"]={pattern:/^`{3}.*\n(?:[\s\S]*?)\n`{3} *$/gm,inside:{"md md-pre":/`{3}/,lf:a}},o["h1 alt"]={pattern:/^(.+)[ \t]*\n=+[ \t]*$/gm,inside:{}},o["h2 alt"]={pattern:/^(.+)[ \t]*\n-+[ \t]*$/gm,inside:{}};for(var s=6;s>=1;s--)o["h"+s]={pattern:new RegExp("^#{"+s+"}.+$","gm"),inside:{"md md-hash":new RegExp("^#{"+s+"}")}};o.li={pattern:/^[ \t]*([*+\-]|\d+\.)[ \t].+(?:\n|[ \t].*\n)*/gm,inside:{"md md-li":/^[ \t]*([*+\-]|\d+\.)[ \t]/m,"pre gfm":{pattern:/^((?: {4}|\t)+)`{3}.*\n(?:[\s\S]*?)\n\1`{3} *$/gm,inside:{"md md-pre":/`{3}/,lf:a}},lf:a}},o.pre={pattern:/(^|(?:^|(?:^|\n)(?![ \t]*([*+\-]|\d+\.)[ \t]).*\n)\s*?\n)(\s*(?: {4}|\t).*(?:\n|$))+/g,lookbehind:!0,inside:{lf:a}},o.table={pattern:new RegExp(["^","[ ]{0,3}","[|]","(.+)\\n","[ ]{0,3}","[|]([ ]*[-:]+[-| :]*)\\n","(","(?:[ ]*[|].*\\n?)*",")","(?:\\n|$)"].join(""),"gm"),inside:{lf:a}},o["table alt"]={pattern:new RegExp(["^","[ ]{0,3}","(\\S.*[|].*)\\n","[ ]{0,3}","([-:]+[ ]*[|][-| :]*)\\n","(","(?:.*[|].*\\n?)*",")","(?:\\n|$)"].join(""),"gm"),inside:{lf:a}},o.hr={pattern:/^([*\-_] *){3,}$/gm},o.blockquote={pattern:/^ {0,3}> *[^\n]+$/gm,inside:{"md md-gt":/^ {0,3}> */,li:o.li}},o["math block"]={pattern:/(\$\$|\\\\\[|\\\\\\\\\()[\s\S]*?(\$\$|\\\\\]|\\\\\\\\\))/g,inside:{"md md-bracket-start":/^(\$\$|\\\\\[|\\\\\\\\\()/,"md md-bracket-end":/(\$\$|\\\\\]|\\\\\\\\\))/,lf:a,rest:i}},o["latex block"]={pattern:/\\?\\begin\{([a-z]*\*?)\}[\s\S]*?\\?\\end\{\1\}/g,inside:{keyword:/\\?\\(begin|end)/,lf:a,rest:i}},o.fndef={pattern:/^ {0,3}\[\^.*?\]:[ \t]+.*$/gm,inside:{"ref-id":{pattern:/\[\^.*?\]/,inside:{"md md-bracket-start":/\[/,"md md-bracket-end":/\]/}}}},o.linkdef={pattern:/^ {0,3}\[.*?\]:[ \t]+.*$/gm,inside:{"link-id":{pattern:/\[.*?\]/,inside:{"md md-bracket-start":/\[/,"md md-bracket-end":/\]/}},url:n,linktitle:/['\"\(][^\'\"\)]*['\"\)]/}},o.p={pattern:/.+/g,inside:{"md md-toc":/^\s*\[(toc|TOC)\]\s*$/g}},o.lf=/^\n$/gm,o.img={pattern:/!\[[^\]]*\]\([^\)]+\)/g,inside:{"md md-bang":/^!/,"md md-bracket-start":/\[/,"md md-alt":/[^\[]+(?=\])/,"md md-bracket-end":/\](?=\()/,"md img-parens":{pattern:/\([^\)]+\)/,inside:{"md md-paren-start":/^\(/,"md md-title":/(['‘][^'’]*['’]|["“][^"”]*["”])(?=\)$)/,"md md-src":/[^\('" \t]+(?=[\)'" \t])/,"md md-paren-end":/\)$/}}}},o.link={pattern:/\[(?:(\\.)|[^\[\]])*\]\([^\(\)\s]+(\(\S*?\))??[^\(\)\s]*?(\s(['‘][^'’]*['’]|["“][^"”]*["”]))?\)/gm,inside:{"md md-bracket-start":{pattern:/(^|[^\\])\[/,lookbehind:!0},"md md-underlined-text":{pattern:/(?:(\\.)|[^\[\]])+(?=\])/},"md md-bracket-end":/\]\s?\(/,"md md-paren-end":/\)$/,"md md-href":/.*/}},o.fn={pattern:/\[\^(.*?)\]/g,inside:{ref:{pattern:/^\[[^\[\]]+\] ?/,inside:{"md md-bracket-start":/\[/,"md md-ref":/^[^\[\]]+/,"md md-bracket-end":/\]/}}}},o.imgref={pattern:/!\[(.*?)\] ?\[(.*?)\]/g,inside:{"md md-bang":/^!/,"ref-end":{pattern:/\[[^\[\]]+\]$/,inside:{"md md-bracket-start":/\[/,"md md-href":/[^\[\]]+(?=]$)/,"md md-bracket-end":/\]/}},"ref-start":{pattern:/^\[[^\[\]]+\] ?/,inside:{"md md-bracket-start":/\[/,"md md-alt":/^[^\[\]]+/,"md md-bracket-end":/\]/}}}},o.linkref={pattern:/\[(.*?)\] ?\[(.*?)\]/g,inside:{"ref-end":{pattern:/\[[^\[\]]+\]$/,inside:{"md md-bracket-start":/\[/,"md md-href":/[^\[\]]+(?=]$)/,"md md-bracket-end":/\]/}},"ref-start":{pattern:/^\[[^\[\]]+\] ?/,inside:{"md md-bracket-start":/\[/,"md md-underlined-text":/^[^\[\]]+/,"md md-bracket-end":/\]/}}}},o.code={pattern:/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/g,lookbehind:!0,inside:{"md md-code":/`/}},o.math={pattern:/\$.*?\$/g,inside:{"md md-bracket-start":/^\$/,"md md-bracket-end":/\$$/,rest:i}},o.strong={pattern:/([_\*])\1((?!\1{2}).)*\1{2}/g,inside:{"md md-strong":/([_\*])\1/g}},o.em={pattern:/(^|[^\\])(\*|_)(\S[^\2]*?)??[^\s\\]+?\2/g,lookbehind:!0,inside:{"md md-em md-start":/^(\*|_)/,"md md-em md-close":/(\*|_)$/}},o.strike={pattern:/(^|\n|\W)(~~)(?=\S)([^\r]*?\S)\2/gm,lookbehind:!0,inside:{"md md-s":/(~~)/,"md-strike-text":/[^~]+/}};for(var l={code:o.code,math:o.math,fn:o.fn,img:o.img,link:o.link,imgref:o.imgref,linkref:o.linkref,url:n,email:r,strong:o.strong,em:o.em,strike:o.strike,conflict:/⧸⧸/g,comment:Prism.languages.markup.comment,tag:Prism.languages.markup.tag,entity:Prism.languages.markup.entity},c=6;c>=1;c--)o["h"+c].inside.rest=l;o["h1 alt"].inside.rest=l,o["h2 alt"].inside.rest=l,o.table.inside.rest=l,o["table alt"].inside.rest=l,o.p.inside.rest=l,o.blockquote.inside.rest=l,o.li.inside.rest=l,o.fndef.inside.rest=l,l={code:o.code,fn:o.fn,link:o.link,linkref:o.linkref,conflict:/⧸⧸/g},o.strong.inside.rest=l,o.em.inside.rest=l,o.strike.inside.rest=l;var u={code:o.code,strong:o.strong,em:o.em,strike:o.strike,conflict:/⧸⧸/g,comment:Prism.languages.markup.comment,tag:Prism.languages.markup.tag,entity:Prism.languages.markup.entity};return o.link.inside["md md-underlined-text"].inside=u,o.linkref.inside["ref-start"].inside["md md-underlined-text"].inside=u,o}(),define("libs/prism-markdown",function(){}),define("editor",["underscore","utils","settings","eventMgr","prism-core","diff_match_patch_uncompressed","jsondiffpatch","crel","rangy","MutationObservers","libs/prism-markdown"],function(t,e,n,r,i,a,o,s,l){function c(){this.isWatching=!1;var t;this.startWatching=function(){this.isWatching=!0,t=t||new MutationObserver(w),t.observe(N,{childList:!0,subtree:!0,characterData:!0})},this.stopWatching=function(){t.disconnect(),this.isWatching=!1},this.noWatch=function(t){this.isWatching===!0?(this.stopWatching(),t(),this.startWatching()):t()}}function u(){var n=this,i=0,a=0;this.selectionStart=0,this.selectionEnd=0,this.cursorY=0,this.adjustTop=0,this.adjustBottom=0,this.findOffsets=function(t){var e=[];if(!t.length)return e;for(var n=t.shift(),r=document.createTreeWalker(N,4,null,!1),i="",a=0;r.nextNode();){i=r.currentNode.nodeValue||"";for(var o=a+i.length;o>n;){if(e.push({container:r.currentNode,offsetInContainer:n-a,offset:n}),!t.length)return e;n=t.shift()}a=o}do e.push({container:r.currentNode,offsetInContainer:i.length,offset:n}),n=t.shift();while(n);return e},this.createRange=function(e,n){e=0>e?0:e,n=0>n?0:n;var r,i,a=document.createRange(),o=[];t.isNumber(e)&&(o.push(e),r=o.length-1),t.isNumber(n)&&(o.push(n),i=o.length-1),o=this.findOffsets(o);var s=t.isObject(e)?e:o[r];a.setStart(s.container,s.offsetInContainer);var l=s;return n&&n!=e&&(l=t.isObject(n)?n:o[i]),a.setEnd(l.container,l.offsetInContainer),a};var o,s=$("body"),c=e.debounce(function(){I.toggleClass("has-selection",this.selectionStart!==this.selectionEnd);var t=this.getCoordinates(this.selectionEnd,this.selectionEndContainer,this.selectionEndOffset);if(this.cursorY!==t.y&&(this.cursorY=t.y,r.onCursorCoordinates(t.x,t.y)),o){this.cursorY=ZSSEditor.getCaretYPosition(),log("adjustScroll: "+this.cursorY);var e,n=$(window).height();e=windowHeight>n&&windowHeight>n+50?n:windowHeight-keyboardHeight;var i=s.scrollTop();return void(this.cursorY-i+55>e&&s.scrollTop(i+55+this.cursorY-i-e))}o=!1},this);this.updateCursorCoordinates=function(t){o=o||t,c()},this.updateSelectionRange=function(){var t=Math.min(this.selectionStart,this.selectionEnd),e=Math.max(this.selectionStart,this.selectionEnd),n=this.createRange(t,e),r=l.getSelection();r.removeAllRanges(),r.addRange(n,this.selectionStart>this.selectionEnd)};var u=t.debounce(function(){i=n.selectionStart,a=n.selectionEnd},50);this.setSelectionStartEnd=function(t,e){void 0===t&&(t=this.selectionStart),0>t&&(t=0),void 0===e&&(e=this.selectionEnd),0>e&&(e=0),this.selectionStart=t,this.selectionEnd=e,H.editorStart=t,H.editorEnd=e,u()},this.saveSelectionState=function(){function t(){if(log("save saveSelectionState"),U===!1){var t=n.selectionStart,e=n.selectionEnd,r=l.getSelection();if(r.rangeCount>0){var i=r.getRangeAt(0),a=i.startContainer;if(N.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_CONTAINED_BY||N===a){var o=i.startOffset;a.hasChildNodes()&&o>0&&(a=a.childNodes[o-1],o=a.textContent.length);for(var s=a;a!=N;){for(;a=a.previousSibling;)a.textContent&&(o+=a.textContent.length);a=s=s.parentNode}r.isBackwards()?(t=o+i.toString().length,e=o):(t=o,e=o+i.toString().length),t===e&&"\n"==i.startContainer.textContent&&1==i.startOffset&&(t=--e,n.setSelectionStartEnd(t,e),n.updateSelectionRange())}}n.setSelectionStartEnd(t,e)}J.saveSelectionState()}var r=!1,o=e.debounce(function(){t(),n.updateCursorCoordinates(r),s()}),s=e.debounce(function(){t(),i===n.selectionStart&&a===n.selectionEnd&&(r=!1),n.updateCursorCoordinates(r),r=!1},10);return function(e,n,s){return s&&(i=void 0,a=void 0),e?(r=r||n,o()):void t()}}(),this.getSelectedText=function(){var t=Math.min(this.selectionStart,this.selectionEnd),e=Math.max(this.selectionStart,this.selectionEnd);return V.substring(t,e)},this.getCoordinates=function(t,e,n){if(!e){var r=this.findOffsets([t])[0];e=r.container,n=r.offsetInContainer}var i=0,a=0;if("\n"==e.textContent)a=e.parentNode.offsetTop+e.parentNode.offsetHeight/2;else{var o=V[t],s={container:e,offsetInContainer:n,offset:t},l={container:e,offsetInContainer:n,offset:t};t>0&&(void 0===o||"\n"==o)?0===s.offset?s=t-1:s.offsetInContainer-=1:l.offset===e.textContent.length?l=t+1:l.offsetInContainer+=1;var c=this.createRange(s,l),u=c.getBoundingClientRect();a=u.top+u.height/2-T.getBoundingClientRect().top+T.scrollTop}return{x:i,y:a}},this.getClosestWordOffset=function(t){var e=0,n=0,r=0;return V.split(/\s/).some(function(i){return i&&(e=r,n=r+i.length,n>t)?!0:void(r+=i.length+1)}),{start:e,end:n}}}function h(t){void 0!==T&&W.saveSelectionState(!0,!0,t)}function f(t){var e=G.diff_commonPrefix(V,t);e===V.length&&e--;var n=Math.min(G.diff_commonSuffix(V,t),V.length-e,t.length-e),r=t.substring(e,t.length-n),i=W.createRange(e,V.length-n);return i.deleteContents(),i.insertNode(document.createTextNode(r)),{start:e,end:t.length-n}}function d(t,e,n){J.currentMode=J.currentMode||"replace";var r=W.createRange(Math.min(t,e),Math.max(t,e));""+r!=n&&(r.deleteContents(),r.insertNode(document.createTextNode(n)));var i=t+n.length;W.setSelectionStartEnd(i,i),W.updateSelectionRange(),W.updateCursorCoordinates(!0)}function p(t,e){J.currentMode=J.currentMode||"replace";var n=V.replace(t,e);if(n!=V){var r=F.setValue(n);W.setSelectionStartEnd(r.end,r.end),W.updateSelectionRange(),W.updateCursorCoordinates(!0)}}function g(t,e){var n=W.selectionStart;if(n!==W.selectionEnd)return!1;var r=W.createRange(n-t.length,n);return""+r!=t?!1:(r.deleteContents(),r.insertNode(document.createTextNode(e)),n=n-t.length+e.length,W.setSelectionStartEnd(n,n),W.updateSelectionRange(),W.updateCursorCoordinates(!0),!0)}function m(t){f(t),V=t}function v(){return V}function y(){R.focus(),W.updateSelectionRange(),T.scrollTop=P}function x(){function n(e,n,i){q.noWatch(function(){V!=e.content&&(m(e.content),H.content=e.content,r.onContentChanged(H,e.content)),W.setSelectionStartEnd(n,i),W.updateSelectionRange(),W.updateCursorCoordinates(!0);var a=H.discussionListJSON;if(a!=e.discussionListJSON){var o=H.discussionList;H.discussionListJSON=e.discussionListJSON;var s=H.discussionList,l=z.diff(o,s),c=!1;t.each(l,function(e,n){t.isArray(e)?1===e.length?r.onDiscussionCreated(H,s[n]):r.onDiscussionRemoved(H,o[n]):c=!0}),c&&r.onCommentsChanged(H)}}),s=n,l=i,o=e,this.currentMode=void 0,a=void 0,this.onButtonStateChange(),h()}var i,a,o,s,l,c=[],u=[];this.setCommandMode=function(){this.currentMode="command"},this.setMode=function(){},this.onButtonStateChange=function(){},this.saveState=e.debounce(function(){u=[];var t=Date.now();if("comment"==this.currentMode||"replace"==this.currentMode||"newlines"==a||this.currentMode!=a||t-i>1e3)for(c.push(o);c.length>100;)c.shift();else s=o.selectionStartBefore,l=o.selectionEndBefore;o={selectionStartBefore:s,selectionEndBefore:l,selectionStartAfter:W.selectionStart,selectionEndAfter:W.selectionEnd,content:V,discussionListJSON:H.discussionListJSON},i=t,a=this.currentMode,this.currentMode=void 0,this.onButtonStateChange()},this),this.saveSelectionState=t.debounce(function(){void 0===this.currentMode&&(s=W.selectionStart,l=W.selectionEnd)},50),this.canUndo=function(){return c.length},this.canRedo=function(){return u.length},this.undo=function(){var t=c.pop();t&&(u.push(o),n.call(this,t,o.selectionStartBefore,o.selectionEndBefore))},this.redo=function(){var t=u.pop();t&&(c.push(o),n.call(this,t,t.selectionStartAfter,t.selectionEndAfter))},this.init=function(){var t=H.content;c=[],u=[],i=0,o={selectionStartAfter:H.selectionStart,selectionEndAfter:H.selectionEnd,content:t,discussionListJSON:H.discussionListJSON},this.currentMode=void 0,a=void 0,N.textContent=t,w()}}function b(){q.isWatching===!0&&(J.currentMode=J.currentMode||"comment",J.saveState())}function w(){var e=T.textContent;if(N.lastChild===D&&"\n"==D.textContent.slice(-1)&&(e=e.slice(0,-1)),e=e.replace(/\r\n?/g,"\n"),U===!1){if(e==V)return void(0===N.children.length&&(N.innerHTML="",Z.forEach(function(t){N.appendChild(t.elt)}),k()));J.currentMode=J.currentMode||"typing";var n=t.values(H.discussionList);H.newDiscussion&&n.push(H.newDiscussion);var i=_(V,e,n);V=e,i===!0&&(H.discussionList=H.discussionList),H.content=V,W.saveSelectionState(),r.onContentChanged(H,V),i&&r.onCommentsChanged(H),J.saveState(),Q()}else V=e,H.content=V,W.setSelectionStartEnd(H.editorStart,H.editorEnd),W.updateSelectionRange(),W.updateCursorCoordinates(),J.saveSelectionState(),r.onFileOpen(H,V),L.scrollTop=H.previewScrollTop,P=H.editorScrollTop,T.scrollTop=P,U=!1}function _(t,e,n){if(n.length){var r=G.diff_main(t,e),i=!1,a=0;return r.forEach(function(t){var e=t[0],r=t[1];if(0===e)return void(a+=r.length);var o=a,s=r.length;-1===e&&(o+=s,s=-s),n.forEach(function(t){t.selectionEnd>o?(t.selectionEnd+=s,t.discussionIndex&&(i=!0)):t.selectionEnd>a&&(t.selectionEnd=a,t.discussionIndex&&(i=!0)),t.selectionStart>=o?(t.selectionStart+=s,t.discussionIndex&&(i=!0)):t.selectionStart>a&&(t.selectionStart=a,t.discussionIndex&&(i=!0))}),1===e&&(a+=r.length)}),i}}function S(e){if(ee=[],te=[],K=void 0,U===!0)return te=Z,Z=e,void(ee=e);var n=Z.length;t.some(Z,function(t,r){var i=e[r];return r>=e.length||t.textWithFrontMatter!=i.textWithFrontMatter||t.elt.parentNode!==N||t.elt.textContent!=i.textWithFrontMatter?(n=r,!0):void 0});var r=-Z.length;t.some(Z.slice().reverse(),function(t,n){var i=e[e.length-n-1];return n>=e.length||t.textWithFrontMatter!=i.textWithFrontMatter||t.elt.parentNode!==N||t.elt.textContent!=i.textWithFrontMatter?(r=-n,!0):void 0}),n-r>Z.length&&(r=n-Z.length);var i=Z.slice(0,n);ee=e.slice(n,e.length+r);var a=Z.slice(Z.length+r,Z.length);K=t.first(a),te=Z.slice(n,Z.length+r),Z=i.concat(ee).concat(a)}function C(){var t=document.createDocumentFragment();ee.forEach(function(e){E(e),t.appendChild(e.elt)}),q.noWatch(function(){if(U===!0)N.innerHTML="",N.appendChild(t);else{te.forEach(function(t){t.elt.parentNode===N&&N.removeChild(t.elt),t.elt.generated=!1}),void 0!==K?N.insertBefore(t,K.elt):N.appendChild(t);for(var e=N.firstChild;e;){var n=e.nextSibling;e.generated||N.removeChild(e),e=n}}k(),W.updateSelectionRange(),W.updateCursorCoordinates()})}function k(){D=s("span",{"class":"token lf life"}),D.textContent="\n",N.appendChild(D)}function E(t){var e=ne(t.text);window.viewerMode||(e=i.highlight(e,i.languages.md));var n=t.textWithFrontMatter.substring(0,t.textWithFrontMatter.length-t.text.length);n.length&&(n=ne(n),n=n.replace(/\n/g,'\n'),e=''+n+""+e);var r=s("span",{id:"wmd-input-section-"+t.id,"class":"wmd-input-section"});r.generated=!0,r.innerHTML=e,t.elt=r}var T,I,N,R,A,M,L,O,D,F={},P=0,B=function(){var e,r=0,i=function(){var t=Date.now();O.refreshPreview(),r=Date.now()-t};return n.lazyRendering===!0?t.debounce(i,500):function(){clearTimeout(e),e=setTimeout(i,2e3>r?r:2e3)}}();r.addListener("onPagedownConfigure",function(t){O=t});var j=0;r.addListener("onSectionsCreated",function(t){j||(S(t),C()),U===!0?O.refreshPreview():B()});var H,U=!0;r.addListener("onFileSelected",function(t){U=!0,H=t});var q=new c;F.watcher=q;var G=new a,z=o.create({objectHash:function(t){return JSON.stringify(t)},arrays:{detectMove:!1},textDiff:{minLength:9999999}}),W=new u;F.selectionMgr=W;var X=t.bind(W.saveSelectionState,W,!0,!1);$(document).on("selectionchange",".editor-content",X),$(document).on("input ",".editor-content",function(){}),F.adjustCursorPosition=h;var V;F.setValue=f,F.onResize=function(){r.onLayoutResize()};var Y=!1;F.setContent=function(t){H||(H={content:t}),N?(H={content:t},N.textContent=t,r.onFileSelected(H),w(),Y=!1):Y=t},window.we=F,F.setContent(""),F.replace=d,F.replaceAll=p,F.replacePreviousText=g,F.setValueNoWatch=m,F.getValue=v,F.getContent=v,F.focus=y;var J=new x;F.undoMgr=J,r.addListener("onDiscussionCreated",b),r.addListener("onDiscussionRemoved",b),r.addListener("onCommentsChanged",b);var Q=t.debounce(function(){var t=window.getSelection();W.hasFocus&&!j&&W.selectionStart===W.selectionEnd&&t.modify&&(W.selectionStart?(t.modify("move","backward","character"),t.modify("move","forward","character")):(t.modify("move","forward","character"),t.modify("move","backward","character")))},10);F.adjustCommentOffsets=_,F.init=function(){if(T=document.getElementById("wmd-input"),I=$(T),N=T.querySelector(".editor-content"),R=$(N),A=T.querySelector(".editor-margin"),M=$(A),L=document.querySelector(".preview-container"),I.addClass(n.editorFontClass),q.startWatching(),$(T).scroll(function(){P=T.scrollTop,U===!1&&(H.editorScrollTop=P)}),$(L).scroll(function(){U===!1&&(H.previewScrollTop=L.scrollTop)}),/AppleWebKit\/([\d.]+)/.exec(navigator.userAgent)){var e=$('').appendTo("html");R.blur(function(){e[0].setSelectionRange(0,0),e.blur()})}T.focus=y,T.adjustCursorPosition=h,Object.defineProperty(T,"value",{get:function(){return V},set:f}),Object.defineProperty(T,"selectionStart",{get:function(){return Math.min(W.selectionStart,W.selectionEnd)},set:function(t){W.setSelectionStartEnd(t),W.updateSelectionRange(),W.updateCursorCoordinates()},enumerable:!0,configurable:!0}),Object.defineProperty(T,"selectionEnd",{get:function(){return Math.max(W.selectionStart,W.selectionEnd)},set:function(t){W.setSelectionStartEnd(void 0,t),W.updateSelectionRange(),W.updateCursorCoordinates()},enumerable:!0,configurable:!0});var r=!1;R.on("keydown",function(t){if(17!==t.which&&91!==t.which&&18!==t.which&&16!==t.which){W.saveSelectionState(),h();var e=t.metaKey||t.ctrlKey;switch(t.which){case 9:e||(i("indent",{inverse:t.shiftKey}),t.preventDefault());break;case 13:i("newline"),t.preventDefault()}13!==t.which&&(r=!1)}}).on("newline",function(){i("newline"),W.updateCursorCoordinates(!0)}).on("compositionstart",function(){j++}).on("compositionend",function(){setTimeout(function(){j--},0)}).on("mouseup",t.bind(W.saveSelectionState,W,!0,!1)).on("paste",function(t){J.currentMode="paste",t.preventDefault();var e,n=(t.originalEvent||t).clipboardData;n?e=n.getData("text/plain"):(n=window.clipboardData,e=n&&n.getData("Text")),e&&(d(W.selectionStart,W.selectionEnd,e),h())}).on("cut",function(){J.currentMode="cut",h()}).on("focus",function(){W.hasFocus=!0}).on("blur",function(){W.hasFocus=!1});var i=function(t,e){var n=v(),r=Math.min(W.selectionStart,W.selectionEnd),i=Math.max(W.selectionStart,W.selectionEnd),a={selectionStart:r,selectionEnd:i,before:n.slice(0,r),after:n.slice(i),selection:n.slice(r,i)};o[t](a,e||{}),f(a.before+a.selection+a.after),W.setSelectionStartEnd(a.selectionStart,a.selectionEnd),W.updateSelectionRange()},a=/^ {0,3}>[ ]*|^[ \t]*(?:[*+\-]|(\d+)\.)[ \t]|^\s+/,o={indent:function(t,e){function n(t,e,n,r){return n=+n||0,r=r||"",t.slice(0,e)+r+t.slice(e+n)}var r=t.before.lastIndexOf("\n")+1;if(e.inverse)/\s/.test(t.before.charAt(r))&&(t.before=n(t.before,r,1),t.selectionStart--,t.selectionEnd--),t.selection=t.selection.replace(/^[ \t]/gm,"");else{var i=t.before.slice(r);if(!t.selection&&!i.match(a))return t.before+=" ",t.selectionStart++,void t.selectionEnd++;t.before=n(t.before,r,0," "),t.selection=t.selection.replace(/\r?\n(?=[\s\S])/g,"\n "),t.selectionStart++,t.selectionEnd++ }t.selectionEnd=t.selectionStart+t.selection.length},newline:function(t){var e=t.before.lastIndexOf("\n")+1;if(r)return t.before=t.before.substring(0,e),t.selection="",t.selectionStart=e,t.selectionEnd=e,void(r=!1);r=!1;var n=t.before.slice(e),i=n.match(a),o=(i||[""])[0];if(i&&i[1]){var s=parseInt(i[1],10);o=o.replace(/\d+/,s+1)}o.length&&(r=!0),J.currentMode="newlines",t.before+="\n"+o,t.selection="",t.selectionStart+=o.length+1,t.selectionEnd=t.selectionStart}};Y!==!1&&F.setContent(Y)};var K,Z=[],te=[],ee=[],ne=function(){var t={"&":"&","<":"<"," ":" "};return function(e){return e.replace(/[&<\u00a0]/g,function(e){return t[e]})}}();return r.onEditorCreated(F),F}),function(){function t(){}function e(t){this.buttonBar=h.getElementById("wmd-button-bar"+t),this.preview=h.getElementById("wmd-preview"+t),this.input=h.getElementById("wmd-input"+t)}function n(t,e){var n,i,a,o=this,s=[],c=0,u="none",h=function(t,e){u!=t&&(u=t,e||d()),g.isIE&&"moving"==u?a=null:i=setTimeout(f,1)},f=function(t){a=new r(e,t),i=void 0};this.setCommandMode=function(){u="command",d(),i=setTimeout(f,0)},this.canUndo=function(){return c>1},this.canRedo=function(){return s[c+1]?!0:!1},this.undo=function(){o.canUndo()&&(n?(n.restore(),n=null):(s[c]=new r(e),s[--c].restore(),t&&t())),u="none",e.input.focus(),f()},this.redo=function(){o.canRedo()&&(s[++c].restore(),t&&t()),u="none",e.input.focus(),f()};var d=function(){var i=a||new r(e);return i?"moving"==u?void(n||(n=i)):(n&&(s[c-1].text!=n.text&&(s[c++]=n),n=null),s[c++]=i,s[c+1]=null,void(t&&t())):!1},p=function(t){if(!t.ctrlKey&&!t.metaKey){var e=t.keyCode;e>=33&&40>=e||e>=63232&&63235>=e?h("moving"):8==e||46==e||127==e?h("deleting"):13==e?h("newlines"):27==e?h("escape"):(16>e||e>20)&&91!=e&&h("typing")}},m=function(){l.addEvent(e.input,"keypress",function(t){!t.ctrlKey&&!t.metaKey||t.altKey||89!=t.keyCode&&90!=t.keyCode||t.preventDefault()});var t=function(){(g.isIE||a&&a.text!=e.input.value)&&void 0==i&&(u="paste",d(),f())};l.addEvent(e.input,"keydown",p),l.addEvent(e.input,"mousedown",function(){h("moving")}),e.input.onpaste=t,e.input.ondrop=t},v=function(){m(),f(!0)};this.reinit=function(t,e,r,o){s=[],c=0,u="none",n=void 0,i=void 0,f(),a.text=t,a.start=e,a.end=r,a.scrollTop=o,a.setInputAreaSelection(),d()},this.setMode=h,v()}function r(e){var n=this,r=e.input;this.init=function(){l.isVisible(r)&&(this.setInputAreaSelectionStartEnd(),this.scrollTop=r.scrollTop,(!this.text&&r.selectionStart||0===r.selectionStart)&&(this.text=r.value))},this.setInputAreaSelection=function(){l.isVisible(r)&&(r.focus(),r.selectionStart=n.start,r.selectionEnd=n.end)},this.setInputAreaSelectionStartEnd=function(){n.start=r.selectionStart,n.end=r.selectionEnd},this.restore=function(){void 0!=n.text&&n.text!=r.value&&(r.value=n.text),this.setInputAreaSelection()},this.getChunks=function(){var e=new t;return e.before=l.fixEolChars(n.text.substring(0,n.start)),e.startTag="",e.selection=l.fixEolChars(n.text.substring(n.start,n.end)),e.endTag="",e.after=l.fixEolChars(n.text.substring(n.end)),e.scrollTop=n.scrollTop,e},this.setChunks=function(t){t.before=t.before+t.startTag,t.after=t.endTag+t.after,this.start=t.before.length,this.end=t.before.length+t.selection.length,this.text=t.before+t.selection+t.after,this.scrollTop=t.scrollTop},this.init()}function i(t,e,n){var r,i,a,o=3e3,s="manual",c=function(t,e){l.addEvent(t,"input",e),t.onpaste=e,t.ondrop=e,l.addEvent(t,"keypress",e),l.addEvent(t,"keydown",e)},u=function(){if(e.preview){var n=e.input.value;if(!n||n!=a){a=n;var r=(new Date).getTime();n=t.makeHtml(n);var o=(new Date).getTime();i=o-r,m(n)}}},h=function(){if(r&&(clearTimeout(r),r=void 0),"manual"!==s){var t=0;"delayed"===s&&(t=i),t>o&&(t=o),r=setTimeout(u,t)}};this.refresh=function(t){t?(a="",u()):h()},this.processingTime=function(){return i};var f,d=function(t){var n=e.preview,r=n.parentNode,i=n.nextSibling;r.removeChild(n),n.innerHTML=t,i?r.insertBefore(n,i):r.appendChild(n)},p=function(t){e.preview.innerHTML=t},g=function(t){if(f)return f(t);try{p(t),f=p}catch(e){f=d,f(t)}},m=function(t){e.preview&&(g(t),n())},v=function(){c(e.input,h),e.preview&&(e.preview.scrollTop=0)};v()}function a(t,e,n,i,a,o,s){function l(){m.focus(),n&&n.setCommandMode();var t=new r(e);if(t){var a=t.getChunks(),o=function(){m.focus(),a&&t.setChunks(a),t.restore(),i.refresh()};return[o,a]}}function c(t,e,n){var r=l();if(r){var i=x.insertLink(r[1],r[0],t,e,n);i||r[0]()}}function u(t){m.focus();var a="wmd-link-button"==t.id||"wmd-image-button"==t.id;if(t.textOp){n&&!a&&n.setCommandMode();var o=new r(e);if(!o)return;var s=o.getChunks(),l=function(){m.focus(),s&&o.setChunks(s),o.restore(),i.refresh()},c=t.textOp(s,l);c||(l(),a||m.adjustCursorPosition())}t.execute&&t.execute(n)}function h(t,n){var r="0px",i="-20px",a="-40px",o=t.getElementsByTagName("span")[0];t.className=t.className.replace(/ disabled/g,""),n?(o.style.backgroundPosition=t.XShift+" "+r,t.onmouseover=function(){o.style.backgroundPosition=this.XShift+" "+a},t.onmouseout=function(){o.style.backgroundPosition=this.XShift+" "+r},g.isIE&&(t.onmousedown=function(){e.ieCachedRange=document.selection.createRange(),e.ieCachedScrollTop=e.input.scrollTop}),t.isHelp||(t.onclick=function(){return this.onmouseout&&this.onmouseout(),u(this),!1})):(o.style.backgroundPosition=t.XShift+" "+i,t.onmouseover=t.onmouseout=t.onclick=function(){},t.className+=" disabled")}function f(t){return"string"==typeof t&&(t=a[t]),function(){t.apply(a,arguments)}}function d(){var n=e.buttonBar,r=document.createElement("ul");r.id="wmd-button-row"+t,r.className="wmd-button-row",r=n.appendChild(r);var i=0,a=function(e,n,a,o){var s=document.createElement("li");s.className="wmd-button",s.style.left=i+"px",i+=25;var l=document.createElement("span");return s.id=e+t,s.appendChild(l),s.title=n,s.XShift=a,o&&(s.textOp=o),h(s,!0),r.appendChild(s),s},l=function(e){var n=document.createElement("li");n.className="wmd-spacer wmd-spacer"+e,n.id="wmd-spacer"+e+t,r.appendChild(n),i+=25};if(v.bold=a("wmd-bold-button",s("bold"),"0px",f("doBold")),v.italic=a("wmd-italic-button",s("italic"),"-20px",f("doItalic")),l(1),v.link=a("wmd-link-button",s("link"),"-40px",f(function(t,e){return this.doLinkOrImage(t,e,!1)})),v.quote=a("wmd-quote-button",s("quote"),"-60px",f("doBlockquote")),v.code=a("wmd-code-button",s("code"),"-80px",f("doCode")),v.image=a("wmd-image-button",s("image"),"-100px",f(function(t,e){return this.doLinkOrImage(t,e,!0)})),l(2),v.olist=a("wmd-olist-button",s("olist"),"-120px",f(function(t,e){this.doList(t,e,!0)})),v.ulist=a("wmd-ulist-button",s("ulist"),"-140px",f(function(t,e){this.doList(t,e,!1)})),v.heading=a("wmd-heading-button",s("heading"),"-160px",f("doHeading")),v.hr=a("wmd-hr-button",s("hr"),"-180px",f("doHorizontalRule")),l(3),v.undo=a("wmd-undo-button",s("undo"),"-200px",null),v.undo.execute=function(t){t&&t.undo()},v.redo=a("wmd-redo-button",s("redo"),"-220px",null),v.redo.execute=function(t){t&&t.redo()},o){var c=document.createElement("li"),u=document.createElement("span");c.appendChild(u),c.className="wmd-button wmd-help-button",c.id="wmd-help-button"+t,c.XShift="-240px",c.isHelp=!0,c.style.right="0px",c.title=s("help"),c.onclick=o.handler,h(c,!0),r.appendChild(c),v.help=c}p()}function p(){n&&(h(v.undo,n.canUndo()),h(v.redo,n.canRedo()))}var m=e.input,v={};d();var y="keydown";g.isOpera&&(y="keypress"),MD.insertLink=c,MD.execCommand=function(t){MD.selectionMgr.saveSelectionState();var e=l();if(e){var n;switch(t){case"bold":n=MD.commandManager.doBold(e[1],e[0]);break;case"italic":n=MD.commandManager.doItalic(e[1],e[0]);break;case"numberList":n=MD.commandManager.doList(e[1],e[0],!0);break;case"list":n=MD.commandManager.doList(e[1],e[0],!1);break;case"code":n=MD.commandManager.doCode(e[1],e[0]);break;case"blockquote":n=MD.commandManager.doBlockquote(e[1],e[0]);break;case"heading":n=MD.commandManager.doHeading(e[1],e[0]);break;case"hr":n=MD.commandManager.doHorizontalRule(e[1],e[0]);break;case"blank":n=!1}n||e[0]()}},this.setUndoRedoButtonStates=p,this.buttons=v,this.doClick=u}function o(t,e){this.hooks=t,this.getString=e}function s(t){return t.replace(/^\s*(.*?)(?:\s+"(.+)")?\s*$/,function(t,e,n){return e=e.replace(/\?.*$/,function(t){return t.replace(/\+/g," ")}),e=decodeURIComponent(e),e=encodeURI(e).replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29"),e=e.replace(/\?.*$/,function(t){return t.replace(/\+/g,"%2b")}),n&&(n=n.trim?n.trim():n.replace(/^\s*/,"").replace(/\s*$/,""),n=n.replace(/"/g,"quot;").replace(/\(/g,"(").replace(/\)/g,")").replace(//g,">")),n?e+' "'+n+'"':e})}var l={},c={},u={},h=window.document,f=window.RegExp,d=window.navigator,p={lineLength:72},g={isIE:/msie/.test(d.userAgent.toLowerCase()),isIE_5or6:/msie 6/.test(d.userAgent.toLowerCase())||/msie 5/.test(d.userAgent.toLowerCase()),isOpera:/opera/.test(d.userAgent.toLowerCase())},m={bold:"Strong Ctrl/Cmd+B",boldexample:"strong text",italic:"Emphasis Ctrl/Cmd+I",italicexample:"emphasized text",link:"Hyperlink Ctrl/Cmd+L",linkdescription:"enter link description here",linkdialog:'

Insert Hyperlink

http://example.com/ "optional title"

',quote:"Blockquote
Ctrl/Cmd+Q",quoteexample:"Blockquote",code:"Code Sample
 Ctrl/Cmd+K",codeexample:"enter code here",image:"Image  Ctrl/Cmd+G",imagedescription:"enter image description here",imagedialog:"

Insert Image

http://example.com/images/diagram.jpg \"optional title\"

Need
free image hosting?

",olist:"Numbered List
    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]*?[ \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.endTag="]("+s(o)+")",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.endTag="]("+s(a)+")",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;o0,/^>/.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;ta;++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&&eo;++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')) {