markdown editor inited

This commit is contained in:
lealife committed 2015-12-06 15:48:05 +08:00
1 parent dd9952c453
commit 43e8f2e701
3 files changed
+4 -2

No files matched your search

+1 -1
View File
@@ -4,4 +4,4 @@ var requirejs,require,define;!function(ba){function G(e){return"[object Function
if("("===u)++c;else if("\\"===u.charAt(0)){var d=+u.substring(1);d&&(c>=d?s[d]=-1:n[l]=t(d))}}for(var l=1;l<s.length;++l)-1===s[l]&&(s[l]=++i);for(var l=0,c=0;a>l;++l){var u=n[l];if("("===u)++c,s[c]||(n[l]="(?:");else if("\\"===u.charAt(0)){var d=+u.substring(1);d&&c>=d&&(n[l]="\\"+s[d])}}for(var l=0;a>l;++l)"^"===n[l]&&"^"!==n[l+1]&&(n[l]="");if(e.ignoreCase&&o)for(var l=0;a>l;++l){var u=n[l],p=u.charAt(0);u.length>=2&&"["===p?n[l]=r(u):"\\"!==p&&(n[l]=u.replace(/[a-zA-Z]/g,function(e){var n=e.charCodeAt(0);return"["+String.fromCharCode(-33&n,32|n)+"]"}))}return n.join("")}for(var i=0,o=!1,s=!1,l=0,c=e.length;c>l;++l){var u=e[l];if(u.ignoreCase)s=!0;else if(/[a-z]/i.test(u.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){o=!0,s=!1;break}}for(var d={b:8,t:9,n:10,v:11,f:12,r:13},p=[],l=0,c=e.length;c>l;++l){var u=e[l];if(u.global||u.multiline)throw new Error(""+u);p.push("(?:"+a(u)+")")}return new RegExp(p.join("|"),s?"gi":"g")}function n(e,n){function t(e){var l=e.nodeType;if(1==l){if(r.test(e.className))return;for(var c=e.firstChild;c;c=c.nextSibling)t(c);var u=e.nodeName.toLowerCase();("br"===u||"li"===u)&&(a[s]="\n",o[s<<1]=i++,o[s++<<1|1]=e)}else if(3==l||4==l){var d=e.nodeValue;d.length&&(d=n?d.replace(/\r\n?/g,"\n"):d.replace(/[ \t\r\n]+/g," "),a[s]=d,o[s<<1]=i,i+=d.length,o[s++<<1|1]=e)}}var r=/(?:^|\s)nocode(?:\s|$)/,a=[],i=0,o=[],s=0;return t(e),{sourceCode:a.join("").replace(/\n$/,""),spans:o}}function t(e,n,t,r){if(n){var a={sourceCode:n,basePos:e};t(a),r.push.apply(r,a.decorations)}}function r(e){for(var n=void 0,t=e.firstChild;t;t=t.nextSibling){var r=t.nodeType;n=1===r?n?e:t:3===r&&U.test(t.nodeValue)?e:n}return n===e?void 0:n}function a(n,r){var a,i={};!function(){for(var t=n.concat(r),o=[],s={},l=0,c=t.length;c>l;++l){var u=t[l],d=u[3];if(d)for(var p=d.length;--p>=0;)i[d.charAt(p)]=u;var f=u[1],m=""+f;s.hasOwnProperty(m)||(o.push(f),s[m]=null)}o.push(/[\0-\uffff]/),a=e(o)}();var o=r.length,s=function(e){for(var n=e.sourceCode,l=e.basePos,u=[l,P],d=0,p=n.match(a)||[],f={},m=0,g=p.length;g>m;++m){var h,v=p[m],b=f[v],w=void 0;if("string"==typeof b)h=!1;else{var x=i[v.charAt(0)];if(x)w=v.match(x[1]),b=x[0];else{for(var y=0;o>y;++y)if(x=r[y],w=v.match(x[1])){b=x[0];break}w||(b=P)}h=b.length>=5&&"lang-"===b.substring(0,5),!h||w&&"string"==typeof w[1]||(h=!1,b=O),h||(f[v]=b)}var C=d;if(d+=v.length,h){var k=w[1],S=v.indexOf(k),_=S+k.length;w[2]&&(_=v.length-w[2].length,S=_-k.length);var E=b.substring(5);t(l+C,v.substring(0,S),s,u),t(l+C+S,k,c(E,k),u),t(l+C+_,v.substring(_),s,u)}else u.push(l+C,b)}e.decorations=u};return s}function i(e){var n=[],t=[];n.push(e.tripleQuotedStrings?[M,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]:e.multiLineStrings?[M,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]:[M,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),e.verbatimStrings&&t.push([M,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var r=e.hashComments;r&&(e.cStyleComments?(n.push(r>1?[L,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]:[L,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),t.push([M,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):n.push([L,/^#[^\r\n]*/,null,"#"])),e.cStyleComments&&(t.push([L,/^\/\/[^\r\n]*/,null]),t.push([L,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var i=e.regexLiterals;if(i){var o=i>1?"":"\n\r",s=o?".":"[\\S\\s]",l="/(?=[^/*"+o+"])(?:[^/\\x5B\\x5C"+o+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+o+"]|\\x5C"+s+")*(?:\\x5D|$))+/";t.push(["lang-regex",RegExp("^"+q+"("+l+")")])}var c=e.types;c&&t.push([A,c]);var u=(""+e.keywords).replace(/^ | $/g,"");u.length&&t.push([$,new RegExp("^(?:"+u.replace(/[\s,]+/g,"|")+")\\b"),null]),n.push([P,/^\s+/,null," \r\n  "]);var d="^.[^\\s\\w.$@'\"`/\\\\]*";return e.regexLiterals&&(d+="(?!s*/)"),t.push([R,/^@[a-z_$][a-z_$@0-9]*/i,null],[A,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[P,/^[a-z_$][a-z_$@0-9]*/i,null],[R,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[P,/^\\[\s\S]?/,null],[N,new RegExp(d),null]),a(n,t)}function o(e,n,t){function r(e){var n=e.nodeType;if(1!=n||i.test(e.className)){if((3==n||4==n)&&t){var l=e.nodeValue,c=l.match(o);if(c){var u=l.substring(0,c.index);e.nodeValue=u;var d=l.substring(c.index+c[0].length);if(d){var p=e.parentNode;p.insertBefore(s.createTextNode(d),e.nextSibling)}a(e),u||e.parentNode.removeChild(e)}}}else if("br"===e.nodeName)a(e),e.parentNode&&e.parentNode.removeChild(e);else for(var f=e.firstChild;f;f=f.nextSibling)r(f)}function a(e){function n(e,t){var r=t?e.cloneNode(!1):e,a=e.parentNode;if(a){var i=n(a,1),o=e.nextSibling;i.appendChild(r);for(var s=o;s;s=o)o=s.nextSibling,i.appendChild(Line truncated
var l=function(e){return o.strings[e]||g[e]};t=t||"";var c=this.hooks=new Markdown.HookCollection;c.addNoop("onPreviewRefresh"),c.addNoop("postBlockquoteCreation"),c.addFalse("insertImageDialog"),c.addFalse("insertLinkDialog"),this.getConverter=function(){return e};var u,d,p=this;this.run=function(s,f){if(!u){u=new n(t,s);var m,g=new i(c,l),v=new r(e,u,function(){c.onPreviewRefresh()},f),b=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),w="mac"==b,x=function(e){var n=h[e][w?"mac":"win"],t=n.indexOf("|");return n.substring(0,t>0?t:n.length)};m=new a(t,u,d,v,g,o.helpButton,l,x),m.setUndoRedoButtonStates();var y=p.refreshPreview=function(){v.refresh(!0)};y(),p.uiManager=m}}},e.prototype.findTags=function(e,n){var t,r=this;e&&(t=s.extendRegExp(e,"","$"),this.before=this.before.replace(t,function(e){return r.startTag=r.startTag+e,""}),t=s.extendRegExp(e,"^",""),this.selection=this.selection.replace(t,function(e){return r.startTag=r.startTag+e,""})),n&&(t=s.extendRegExp(n,"","$"),this.selection=this.selection.replace(t,function(e){return r.endTag=e+r.endTag,""}),t=s.extendRegExp(n,"^",""),this.after=this.after.replace(t,function(e){return r.endTag=e+r.endTag,""}))},e.prototype.trimWhitespace=function(e){var n,t,r=this;e?n=t="":(n=function(e){return r.before+=e,""},t=function(e){return r.after=e+r.after,""}),this.selection=this.selection.replace(/^(\s*)/,n).replace(/(\s*)$/,t)},e.prototype.skipLines=function(e,n,t){void 0===e&&(e=1),void 0===n&&(n=1),e++,n++;var r,a;if(navigator.userAgent.match(/Chrome/)&&"X".match(/()./),this.selection=this.selection.replace(/(^\n*)/,""),this.startTag=this.startTag+d.$1,this.selection=this.selection.replace(/(\n*$)/,""),this.endTag=this.endTag+d.$1,this.startTag=this.startTag.replace(/(^\n*)/,""),this.before=this.before+d.$1,this.endTag=this.endTag.replace(/(\n*$)/,""),this.after=this.after+d.$1,this.before){for(r=a="";e--;)r+="\\n?",a+="\n";t&&(r="\\n*"),this.before=this.before.replace(new d(r+"$",""),a)}if(this.after){for(r=a="";n--;)r+="\\n?",a+="\n";t&&(r="\\n*"),this.after=this.after.replace(new d(r,""),a)}},s.isVisible=function(e){return window.getComputedStyle?"none"!==window.getComputedStyle(e,null).getPropertyValue("display"):e.currentStyle?"none"!==e.currentStyle.display:void 0},s.addEvent=function(e,n,t){e.attachEvent?e.attachEvent("on"+n,t):e.addEventListener(n,t,!1)},s.removeEvent=function(e,n,t){e.detachEvent?e.detachEvent("on"+n,t):e.removeEventListener(n,t,!1)},s.fixEolChars=function(e){return e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n")},s.extendRegExp=function(e,n,t){(null===n||void 0===n)&&(n=""),(null===t||void 0===t)&&(t="");var r,a=e.toString();return a=a.replace(/\/([gim]*)$/,function(e,n){return r=n,""}),a=a.replace(/(^\/|\/$)/g,""),a=n+a+t,new d(a,r)},l.getTop=function(e,n){var t=e.offsetTop;if(!n)for(;e=e.offsetParent;)t+=e.offsetTop;return t},l.getHeight=function(e){return e.offsetHeight||e.scrollHeight},l.getWidth=function(e){return e.offsetWidth||e.scrollWidth},l.getPageSize=function(){var e,n,t,r;self.innerHeight&&self.scrollMaxY?(e=u.body.scrollWidth,n=self.innerHeight+self.scrollMaxY):u.body.scrollHeight>u.body.offsetHeight?(e=u.body.scrollWidth,n=u.body.scrollHeight):(e=u.body.offsetWidth,n=u.body.offsetHeight),self.innerHeight?(t=self.innerWidth,r=self.innerHeight):u.documentElement&&u.documentElement.clientHeight?(t=u.documentElement.clientWidth,r=u.documentElement.clientHeight):u.body&&(t=u.body.clientWidth,r=u.body.clientHeight);var a=Math.max(e,t),i=Math.max(n,r);return[a,i,t,r]},c.createBackground=function(){var e=u.createElement("div"),n=e.style;e.className="wmd-prompt-background",n.position="absolute",n.top="0",n.zIndex="1000",m.isIE?n.filter="alpha(opacity=50)":n.opacity="0.5";var t=l.getPageSize();return n.height=t[1]+"px",m.isIE?(n.left=u.documentElement.scrollLeft,n.width=u.documentElement.clientWidth):(n.left="0",n.width="100%"),u.body.appendChild(e),e},c.prompt=function(e,n,t){var r,a;void 0===n&&(n="");var i=function(e){var n=e.charCode||e.keyCode;27===n&&o(!0)},o=function(e){s.removeEvent(u.body,"keydown",i);var n=a.value;return e?n=null:(n=n.replace(/^http:\/\/(https?|ftp):\/\//,"$1://"),/^(?:https?|ftp):\/\//.test(n)||(n="http://"+n)),r.parentNode.removeChild(r),t(n),!1},c=function(){r=u.createElement("div"),r.className="wmd-prompt-dialog",r.style.padding="10px;",r.style.position="fixed",r.style.width="400px",r.style.zIndex="1001";var t=u.createElement("div");t.innerHTML=e,t.style.padding="5px",r.appendChild(t);var c=u.createElement("form"),d=c.style;c.onsubmit=function(){return o(!1)},d.padding="0",d.margin="0",d.cssFloat="left",d.width="100%",d.textAlign="center",d.position="relative",r.appendChild(c),a=u.createElement("input"),a.type="text",a.value=n,d=a.style,d.display="block",d.width="80%",d.marginLeft=d.marginRight="auto",c.appendChild(a);var p=u.createElement("input");p.type="button",p.onclick=function(){return o(!1)},p.value="OK",d=p.style,d.margin="10px",d.display="inline",d.width="7em";varLine truncated
return"fenced_code_gfm"==e})&&(i="^```.*\\n[\\s\\S]*?\\n```|"+i),t.enabled&&(i="^[ \\t]*\\n\\$\\$[\\s\\S]*?\\$\\$|"+i,i="^[ \\t]*\\n\\\\\\\\[[\\s\\S]*?\\\\\\\\]|"+i,i="^[ \\t]*\\n\\\\?\\\\begin\\{[a-z]*\\*?\\}[\\s\\S]*?\\\\end\\{[a-z]*\\*?\\}|"+i),i=new RegExp(i,"gm");var o=r.getConverter();o.hooks.chain("preConversion",function(n){function t(e,n){var t=r.substring(s,n);o.push({text:t,textWithDelimiter:'\n<div class="se-section-delimiter"></div>\n\n'+t+"\n"})}a.previewStartTime=new Date;var r=n+"\n\n",o=[],s=0;return r.replace(i,function(e,n){t(s,n),s=n}),t(s,n.length),a.onSectionsCreated(o),e.reduce(o,function(e,n){return e+n.textWithDelimiter},"")})},i}),define("extensions/partialRendering",["underscore","crel","extensions/markdownExtra","classes/Extension"],function(e,n,t,r){function a(n,t){if(g=[],m=[],u=void 0,h===!0||c!=t)return h=!1,c=t,m=f,f=n,void(g=n);var r=f.length;e.some(f,function(e,t){return t>=n.length||e.text!=n[t].text?(r=t,!0):void 0});var a=-f.length;e.some(f.slice().reverse(),function(e,t){return t>=n.length||e.text!=n[n.length-t-1].text?(a=-t,!0):void 0}),r-a>f.length&&(a=r-f.length);var i=f.slice(0,r);g=n.slice(r,n.length+a);var o=f.slice(f.length+a,f.length);u=e.first(o),m=f.slice(r,f.length+a),f=i.concat(g).concat(o)}function i(e){var n=e.id.substring(3);y[n]=e}function o(){function t(t){for(var r=n("div",{id:"wmd-preview-section-"+t.id,"class":"wmd-preview-section preview-content"}),o=!1;a;){var s=a.nextSibling;if(o===!0&&"DIV"==a.tagName&&"se-section-delimiter"==a.className)break;o=!0,"DIV"==a.tagName&&"footnotes"==a.className?e.each(a.querySelectorAll("ol > li"),i):r.appendChild(a),a=s}return r}e.each(m,function(e){var n=document.getElementById("wmd-preview-section-"+e.id);x.removeChild(n)});var r=document.getElementById("wmd-preview"),a=r.firstChild,o=document.createDocumentFragment();e.each(g,function(e){o.appendChild(t(e))}),r.innerHTML="";var s=w;void 0!==u&&(s=document.getElementById("wmd-preview-section-"+u.id)),x.insertBefore(o,s),w.innerHTML="";var l=[];if(b===!0){var c=n("ol");e.each(x.querySelectorAll("a.footnote"),function(e,n){e.textContent=n+1;var t=e.id.substring(6);l.push(t),c.appendChild(y[t].cloneNode(!0))}),l.length>0&&w.appendChild(n("div",{"class":"footnotes"},n("hr"),c)),y=e.pick(y,l)}}function s(n){l=n.getConverter(),l.hooks.chain("preConversion",function(){var n=e.map(g,function(e){return e.text});return n.push(c+"\n\n"),n.join("")}),n.hooks.chain("onPreviewRefresh",function(){o()})}var l,c,u,d=new r("partialRendering","Partial Rendering",!0),p=0,f=[],m=[],g=[],h=!1,v=!1,b=!1;d.onSectionsCreated=function(n){var t=[],r="\n";b=!1,e.each(n,function(e){var n=e.textWithDelimiter+"\n";v&&(n=n.replace(/^```.*\n[\s\S]*?\n```|\n[ ]{0,3}\[\^(.+?)\]\:[ \t]*\n?([\s\S]*?)\n{1,2}((?=\n[ ]{0,3}\S)|$)/gm,function(e,n){return n?(b=!0,r+=e.replace(/^\s*\n/gm,"")+"\n",""):e})),n=n.replace(/^```.*\n[\s\S]*?\n```|^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm,function(e,n){return n?(r+=e.replace(/^\s*\n/gm,"")+"\n",""):e}),t.push({id:++p,text:n+"\n"})}),a(t,r)};var w,x,y={};return d.onPagedownConfigure=s,d.onToggleMode=s,d.onInit=function(){t.enabled&&e.some(t.config.extensions,function(e){return"footnotes"==e})&&(v=!0)},d.onReady=function(){w=n("div",{id:"wmd-preview-section-footnotes","class":"preview-content"}),x=document.getElementById("preview-contents"),x.appendChild(w)},d.onFileSelected=function(){h=!0},d}),define("extensions/umlDiagrams",["require","underscore","utils","classes/Extension","crel"],function(e,n,t,r,a){function i(){var t=c.querySelectorAll(".prettyprint > .language-flow");t&&0!=t.length&&e(["flow-chart"],function(e){n.each(t,function(n){try{var t=e.parse(n.textContent),r=n.parentNode,i=a("div",{"class":"flow-chart"});r.parentNode.replaceChild(i,r),t.drawSVG(i,JSON.parse(l.config.flowchartOptions))}catch(o){console.error(o)}})})}function o(){var t=c.querySelectorAll(".prettyprint > .language-sequence");t&&0!=t.length&&e(["Diagram"],function(e){n.each(t,function(n){try{var t=e.parse(n.textContent),r=n.parentNode,i=a("div",{"class":"sequence-diagram"});r.parentNode.replaceChild(i,r),t.drawSVG(i,{theme:"simple"})}catch(o){console.error(o)}})})}function i(){var t=c.querySelectorAll(".prettyprint > .language-flow");t&&0!=t.length&&e(["flow-chart"],function(e){n.each(t,function(n){try{var t=e.parse(n.textContent),r=n.parentNode,i=a("div",{"class":"flow-chart"});r.parentNode.replaceChild(i,r),t.drawSVG(i,JSON.parse(l.config.flowchartOptions))}catch(o){console.error(o)}})})}function s(e){e.hooks.chain("onPreviewRefresh",function(){o(),i()})}var l=new r("umlDiagrams","UML Diagrams",!0);l.defaultConfig={flowchartOptions:["{",' "line-width": 2,',' "font-family": "sans-serif",',' "font-weight": "normal"',"}"].join("\n")};var c=document.getElementById("preview-contents");return l.onPagedownConfigure=s,l.onToggleMode=s,l}),define("extensions/toc",["underscore","utils","classes/Extension"],function(e,n,t){funcLine truncated
void 0===e&&(e=1),void 0===n&&(n=1),e++,n++;var r,a;if(navigator.userAgent.match(/Chrome/)&&"X".match(/()./),this.selection=this.selection.replace(/(^\n*)/,""),this.startTag=this.startTag+p.$1,this.selection=this.selection.replace(/(\n*$)/,""),this.endTag=this.endTag+p.$1,this.startTag=this.startTag.replace(/(^\n*)/,""),this.before=this.before+p.$1,this.endTag=this.endTag.replace(/(\n*$)/,""),this.after=this.after+p.$1,this.before){for(r=a="";e--;)r+="\\n?",a+="\n";t&&(r="\\n*"),this.before=this.before.replace(new p(r+"$",""),a)}if(this.after){for(r=a="";n--;)r+="\\n?",a+="\n";t&&(r="\\n*"),this.after=this.after.replace(new p(r,""),a)}},l.isVisible=function(e){return window.getComputedStyle?"none"!==window.getComputedStyle(e,null).getPropertyValue("display"):e.currentStyle?"none"!==e.currentStyle.display:void 0},l.addEvent=function(e,n,t){e.attachEvent?e.attachEvent("on"+n,t):e.addEventListener(n,t,!1)},l.removeEvent=function(e,n,t){e.detachEvent?e.detachEvent("on"+n,t):e.removeEventListener(n,t,!1)},l.fixEolChars=function(e){return e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n")},l.extendRegExp=function(e,n,t){(null===n||void 0===n)&&(n=""),(null===t||void 0===t)&&(t="");var r,a=e.toString();return a=a.replace(/\/([gim]*)$/,function(e,n){return r=n,""}),a=a.replace(/(^\/|\/$)/g,""),a=n+a+t,new p(a,r)},c.getTop=function(e,n){var t=e.offsetTop;if(!n)for(;e=e.offsetParent;)t+=e.offsetTop;return t},c.getHeight=function(e){return e.offsetHeight||e.scrollHeight},c.getWidth=function(e){return e.offsetWidth||e.scrollWidth},c.getPageSize=function(){var e,n,t,r;self.innerHeight&&self.scrollMaxY?(e=d.body.scrollWidth,n=self.innerHeight+self.scrollMaxY):d.body.scrollHeight>d.body.offsetHeight?(e=d.body.scrollWidth,n=d.body.scrollHeight):(e=d.body.offsetWidth,n=d.body.offsetHeight),self.innerHeight?(t=self.innerWidth,r=self.innerHeight):d.documentElement&&d.documentElement.clientHeight?(t=d.documentElement.clientWidth,r=d.documentElement.clientHeight):d.body&&(t=d.body.clientWidth,r=d.body.clientHeight);var a=Math.max(e,t),i=Math.max(n,r);return[a,i,t,r]},u.createBackground=function(){var e=d.createElement("div"),n=e.style;e.className="wmd-prompt-background",n.position="absolute",n.top="0",n.zIndex="1000",g.isIE?n.filter="alpha(opacity=50)":n.opacity="0.5";var t=c.getPageSize();return n.height=t[1]+"px",g.isIE?(n.left=d.documentElement.scrollLeft,n.width=d.documentElement.clientWidth):(n.left="0",n.width="100%"),d.body.appendChild(e),e},u.prompt=function(e,n,t){var r,a;void 0===n&&(n="");var i=function(e){var n=e.charCode||e.keyCode;27===n&&o(!0)},o=function(e){l.removeEvent(d.body,"keydown",i);var n=a.value;return e?n=null:(n=n.replace(/^http:\/\/(https?|ftp):\/\//,"$1://"),/^(?:https?|ftp):\/\//.test(n)||(n="http://"+n)),r.parentNode.removeChild(r),t(n),!1},s=function(){r=d.createElement("div"),r.className="wmd-prompt-dialog",r.style.padding="10px;",r.style.position="fixed",r.style.width="400px",r.style.zIndex="1001";var t=d.createElement("div");t.innerHTML=e,t.style.padding="5px",r.appendChild(t);var s=d.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),a=d.createElement("input"),a.type="text",a.value=n,u=a.style,u.display="block",u.width="80%",u.marginLeft=u.marginRight="auto",s.appendChild(a);var p=d.createElement("input");p.type="button",p.onclick=function(){return o(!1)},p.value="OK",u=p.style,u.margin="10px",u.display="inline",u.width="7em";var f=d.createElement("input");f.type="button",f.onclick=function(){return o(!0)},f.value="Cancel",u=f.style,u.margin="10px",u.display="inline",u.width="7em",s.appendChild(p),s.appendChild(f),l.addEvent(d.body,"keydown",i),r.style.top="50%",r.style.left="50%",r.style.display="block",g.isIE_5or6&&(r.style.position="absolute",r.style.top=d.documentElement.scrollTop+200+"px",r.style.left="50%"),d.body.appendChild(r),r.style.marginTop=-(c.getHeight(r)/2)+"px",r.style.marginLeft=-(c.getWidth(r)/2)+"px"};setTimeout(function(){s();var e=n.length;if(void 0!==a.selectionStart)a.selectionStart=0,a.selectionEnd=e;else if(a.createTextRange){var t=a.createTextRange();t.collapse(!1),t.moveStart("character",-e),t.moveEnd("character",e),t.select()}a.focus()},0)};var w=o.prototype;w.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)",w.unwrap=function(e){var n=new p("([^\\n])\\n(?!(\\n|"+this.prefixes+"))","g");e.selection=e.selection.replace(n,"$1 $2")},w.wrap=function(e,n){this.unwrap(e);var t=new p("(.{1,"+n+"})( +|$\\n?)","gm"),r=this;e.selection=e.selection.replace(t,function(e,n){return new p("^"+r.prefixes,"").test(e)?e:n+"\n"}),e.selection=e.selection.replace(/\s+$/,"")},w.doBold=function(e,n){return this.doBorI(e,n,2,this.getString("boldexample"))},w.doItalic=function(e,n){return this.doBorI(e,n,1,this.getString("italicexample"))},w.doBorI=function(e,n,t,r){e.trimWhitespace(),e.selection=e.selection.replace(/\nLine truncated
void 0===e&&(e=1),void 0===n&&(n=1),e++,n++;var r,a;if(navigator.userAgent.match(/Chrome/)&&"X".match(/()./),this.selection=this.selection.replace(/(^\n*)/,""),this.startTag=this.startTag+p.$1,this.selection=this.selection.replace(/(\n*$)/,""),this.endTag=this.endTag+p.$1,this.startTag=this.startTag.replace(/(^\n*)/,""),this.before=this.before+p.$1,this.endTag=this.endTag.replace(/(\n*$)/,""),this.after=this.after+p.$1,this.before){for(r=a="";e--;)r+="\\n?",a+="\n";t&&(r="\\n*"),this.before=this.before.replace(new p(r+"$",""),a)}if(this.after){for(r=a="";n--;)r+="\\n?",a+="\n";t&&(r="\\n*"),this.after=this.after.replace(new p(r,""),a)}},l.isVisible=function(e){return window.getComputedStyle?"none"!==window.getComputedStyle(e,null).getPropertyValue("display"):e.currentStyle?"none"!==e.currentStyle.display:void 0},l.addEvent=function(e,n,t){e.attachEvent?e.attachEvent("on"+n,t):e.addEventListener(n,t,!1)},l.removeEvent=function(e,n,t){e.detachEvent?e.detachEvent("on"+n,t):e.removeEventListener(n,t,!1)},l.fixEolChars=function(e){return e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n")},l.extendRegExp=function(e,n,t){(null===n||void 0===n)&&(n=""),(null===t||void 0===t)&&(t="");var r,a=e.toString();return a=a.replace(/\/([gim]*)$/,function(e,n){return r=n,""}),a=a.replace(/(^\/|\/$)/g,""),a=n+a+t,new p(a,r)},c.getTop=function(e,n){var t=e.offsetTop;if(!n)for(;e=e.offsetParent;)t+=e.offsetTop;return t},c.getHeight=function(e){return e.offsetHeight||e.scrollHeight},c.getWidth=function(e){return e.offsetWidth||e.scrollWidth},c.getPageSize=function(){var e,n,t,r;self.innerHeight&&self.scrollMaxY?(e=d.body.scrollWidth,n=self.innerHeight+self.scrollMaxY):d.body.scrollHeight>d.body.offsetHeight?(e=d.body.scrollWidth,n=d.body.scrollHeight):(e=d.body.offsetWidth,n=d.body.offsetHeight),self.innerHeight?(t=self.innerWidth,r=self.innerHeight):d.documentElement&&d.documentElement.clientHeight?(t=d.documentElement.clientWidth,r=d.documentElement.clientHeight):d.body&&(t=d.body.clientWidth,r=d.body.clientHeight);var a=Math.max(e,t),i=Math.max(n,r);return[a,i,t,r]},u.createBackground=function(){var e=d.createElement("div"),n=e.style;e.className="wmd-prompt-background",n.position="absolute",n.top="0",n.zIndex="1000",g.isIE?n.filter="alpha(opacity=50)":n.opacity="0.5";var t=c.getPageSize();return n.height=t[1]+"px",g.isIE?(n.left=d.documentElement.scrollLeft,n.width=d.documentElement.clientWidth):(n.left="0",n.width="100%"),d.body.appendChild(e),e},u.prompt=function(e,n,t){var r,a;void 0===n&&(n="");var i=function(e){var n=e.charCode||e.keyCode;27===n&&o(!0)},o=function(e){l.removeEvent(d.body,"keydown",i);var n=a.value;return e?n=null:(n=n.replace(/^http:\/\/(https?|ftp):\/\//,"$1://"),/^(?:https?|ftp):\/\//.test(n)||(n="http://"+n)),r.parentNode.removeChild(r),t(n),!1},s=function(){r=d.createElement("div"),r.className="wmd-prompt-dialog",r.style.padding="10px;",r.style.position="fixed",r.style.width="400px",r.style.zIndex="1001";var t=d.createElement("div");t.innerHTML=e,t.style.padding="5px",r.appendChild(t);var s=d.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),a=d.createElement("input"),a.type="text",a.value=n,u=a.style,u.display="block",u.width="80%",u.marginLeft=u.marginRight="auto",s.appendChild(a);var p=d.createElement("input");p.type="button",p.onclick=function(){return o(!1)},p.value="OK",u=p.style,u.margin="10px",u.display="inline",u.width="7em";var f=d.createElement("input");f.type="button",f.onclick=function(){return o(!0)},f.value="Cancel",u=f.style,u.margin="10px",u.display="inline",u.width="7em",s.appendChild(p),s.appendChild(f),l.addEvent(d.body,"keydown",i),r.style.top="50%",r.style.left="50%",r.style.display="block",g.isIE_5or6&&(r.style.position="absolute",r.style.top=d.documentElement.scrollTop+200+"px",r.style.left="50%"),d.body.appendChild(r),r.style.marginTop=-(c.getHeight(r)/2)+"px",r.style.marginLeft=-(c.getWidth(r)/2)+"px"};setTimeout(function(){s();var e=n.length;if(void 0!==a.selectionStart)a.selectionStart=0,a.selectionEnd=e;else if(a.createTextRange){var t=a.createTextRange();t.collapse(!1),t.moveStart("character",-e),t.moveEnd("character",e),t.select()}a.focus()},0)};var w=o.prototype;w.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)",w.unwrap=function(e){var n=new p("([^\\n])\\n(?!(\\n|"+this.prefixes+"))","g");e.selection=e.selection.replace(n,"$1 $2")},w.wrap=function(e,n){this.unwrap(e);var t=new p("(.{1,"+n+"})( +|$\\n?)","gm"),r=this;e.selection=e.selection.replace(t,function(e,n){return new p("^"+r.prefixes,"").test(e)?e:n+"\n"}),e.selection=e.selection.replace(/\s+$/,"")},w.doBold=function(e,n){return this.doBorI(e,n,2,this.getString("boldexample"))},w.doItalic=function(e,n){return this.doBorI(e,n,1,this.getString("italicexample"))},w.doBorI=function(e,n,t,r){e.trimWhitespace(),e.selection=e.selection.replace(/\nLine truncated