This commit is contained in:
lealife committed 2015-11-22 22:21:59 +08:00
1 parent a12b285a35
commit e4b847b731
2 files changed
+18 -8

No files matched your search

+16 -6
View File
@@ -30763,6 +30763,7 @@ define('editor',[
editor.focus = focus;
// 历史记录
function UndoMgr() {
var undoStack = [];
var redoStack = [];
@@ -31416,7 +31417,8 @@ define('editor',[
function highlight(section) {
var text = escape(section.text);
if(!window.viewerMode) {
// MDPureText 不用Prism
if(!window.LEAMDPureText) {
// log("pre")
// log(text);
// # lif
@@ -33858,6 +33860,14 @@ define('core',[
// strings: "Markdown syntax"
});
MD.pagedownEditor = pagedownEditor;
// 重置undo
// 11/12
MD.clearUndo = function () {
MD.undoMgr.init();
MD.pagedownEditor.uiManager.setUndoRedoButtonStates();
};
MD.insertLink2 = pagedownEditor.insertLink;
// Custom insert link dialog
@@ -33906,7 +33916,7 @@ define('core',[
$("#wmd-ulist-button").append($('<i class="fa fa-list-ul">')).appendTo($btnGroupElt);
$("#wmd-heading-button").append($('<i class="fa fa-header">')).appendTo($btnGroupElt);
$("#wmd-hr-button").append($('<i class="fa fa-ellipsis-h">')).appendTo($btnGroupElt);
$btnGroupElt = $('.wmd-button-group5');
$btnGroupElt = $('.wmd-button-group4');
$("#wmd-undo-button").append($('<i class="fa fa-undo">')).appendTo($btnGroupElt);
$("#wmd-redo-button").append($('<i class="fa fa-repeat">')).appendTo($btnGroupElt);
$("#wmd-help-button").show();
@@ -34803,7 +34813,7 @@ requirejs.config({
// 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',
// highlightjs: 'libs/highlight/highlight.pack',
'jquery-waitforimages': 'bower-libs/waitForImages/src/jquery.waitforimages',
// FileSaver: 'bower-libs/FileSaver/FileSaver',
// stacktrace: 'bower-libs/stacktrace/stacktrace',
@@ -34896,9 +34906,9 @@ requirejs.config({
MutationObservers: [
'WeakMap'
],
highlightjs: {
exports: 'hljs'
},
// highlightjs: {
// exports: 'hljs'
// },
'jquery-waitforimages': [
],
pagedown: [
+2 -2
View File
@@ -9,5 +9,5 @@ m(t,{width:e,height:n}),m(M,{width:e,height:n}),r.paper.safari()})}(k),r.paper.d
this.trace(t)},parse:function(t){function e(){var t;return t=n.lexer.lex()||f,"number"!=typeof t&&(t=n.symbols_[t]||t),t}var n=this,r=[0],i=[null],a=[],o=this.table,s="",l=0,c=0,u=0,h=2,f=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var d=this.lexer.yylloc;a.push(d);var p=this.lexer.options&&this.lexer.options.ranges;this.parseError="function"==typeof this.yy.parseError?this.yy.parseError:Object.getPrototypeOf(this).parseError;for(var g,m,v,y,x,b,_,w,C,E={};;){if(v=r[r.length-1],this.defaultActions[v]?y=this.defaultActions[v]:((null===g||"undefined"==typeof g)&&(g=e()),y=o[v]&&o[v][g]),"undefined"==typeof y||!y.length||!y[0]){var S="";C=[];for(b in o[v])this.terminals_[b]&&b>h&&C.push("'"+this.terminals_[b]+"'");S=this.lexer.showPosition?"Parse error on line "+(l+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(l+1)+": Unexpected "+(g==f?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(S,{text:this.lexer.match,token:this.terminals_[g]||g,line:this.lexer.yylineno,loc:d,expected:C})}if(y[0]instanceof Array&&y.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+g);switch(y[0]){case 1:r.push(g),i.push(this.lexer.yytext),a.push(this.lexer.yylloc),r.push(y[1]),g=null,m?(g=m,m=null):(c=this.lexer.yyleng,s=this.lexer.yytext,l=this.lexer.yylineno,d=this.lexer.yylloc,u>0&&u--);break;case 2:if(_=this.productions_[y[1]][1],E.$=i[i.length-_],E._$={first_line:a[a.length-(_||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(_||1)].first_column,last_column:a[a.length-1].last_column},p&&(E._$.range=[a[a.length-(_||1)].range[0],a[a.length-1].range[1]]),x=this.performAction.call(E,s,c,l,this.yy,y[1],i,a),"undefined"!=typeof x)return x;_&&(r=r.slice(0,-1*_*2),i=i.slice(0,-1*_),a=a.slice(0,-1*_)),r.push(this.productions_[y[1]][0]),i.push(E.$),a.push(E._$),w=o[r[r.length-2]][r[r.length-1]],r.push(w);break;case 3:return!0}}return!0}},r=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var e=t.match(/(?:\r\n?|\n).*/g);return e?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),r=t[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylinLine truncated
else a=this.leftEnd&&x?r(this.chart,c,[{x:c.x,y:c.y+C/2},{x:c.x+(c.x-d.x)/2,y:c.y+C/2},{x:c.x+(c.x-d.x)/2,y:d.y-C/2},{x:d.x,y:d.y-C/2},{x:d.x,y:d.y}],e):r(this.chart,c,[{x:c.x,y:d.y-C/2},{x:d.x,y:d.y-C/2},{x:d.x,y:d.y}],e),this.bottomStart=!0,t.topEnd=!0,w=c.x+(c.x-d.x)/2;else a=r(this.chart,l,[{x:l.x+C/2,y:l.y},{x:l.x+C/2,y:d.y-C/2},{x:d.x,y:d.y-C/2},{x:d.x,y:d.y}],e),this.rightStart=!0,t.topEnd=!0,w=l.x+C/2;else a=r(this.chart,l,[{x:l.x+C/2,y:l.y},{x:l.x+C/2,y:d.y-C/2},{x:d.x,y:d.y-C/2},{x:d.x,y:d.y}],e),this.rightStart=!0,t.topEnd=!0,w=l.x+C/2;else a=r(this.chart,u,p,e),this.leftStart=!0,t.rightEnd=!0,w=p.x;else a=r(this.chart,l,g,e),this.rightStart=!0,t.leftEnd=!0,w=g.x;else a=r(this.chart,c,d,e),this.bottomStart=!0,t.topEnd=!0,w=c.x;if(a){for(var k=0,T=this.chart.lines.length;T>k;k++)for(var I,N=this.chart.lines[k],R=N.attr("path"),M=a.attr("path"),A=0,D=R.length-1;D>A;A++){var O=[];O.push(["M",R[A][1],R[A][2]]),O.push(["L",R[A+1][1],R[A+1][2]]);for(var L=O[0][1],B=O[0][2],F=O[1][1],P=O[1][2],$=0,j=M.length-1;j>$;$++){var H=[];H.push(["M",M[$][1],M[$][2]]),H.push(["L",M[$+1][1],M[$+1][2]]);var z=H[0][1],U=H[0][2],q=H[1][1],W=H[1][2],V=i(L,B,F,P,z,U,q,W);if(V.onLine1&&V.onLine2){var G;U===W?z>q?(G=["L",V.x+2*E,U],M.splice($+1,0,G),G=["C",V.x+2*E,U,V.x,U-4*E,V.x-2*E,U],M.splice($+2,0,G),a.attr("path",M)):(G=["L",V.x-2*E,U],M.splice($+1,0,G),G=["C",V.x-2*E,U,V.x,U-4*E,V.x+2*E,U],M.splice($+2,0,G),a.attr("path",M)):U>W?(G=["L",z,V.y+2*E],M.splice($+1,0,G),G=["C",z,V.y+2*E,z+4*E,V.y,z,V.y-2*E],M.splice($+2,0,G),a.attr("path",M)):(G=["L",z,V.y-2*E],M.splice($+1,0,G),G=["C",z,V.y-2*E,z+4*E,V.y,z,V.y+2*E],M.splice($+2,0,G),a.attr("path",M)),$+=2,I+=2}}}this.chart.lines.push(a)}(!this.chart.maxXFromLine||this.chart.maxXFromLine&&w>this.chart.maxXFromLine)&&(this.chart.maxXFromLine=w)},m.inherits(s,o),m.inherits(l,o),m.inherits(c,o),m.inherits(u,o),m.inherits(h,o),h.prototype.getLeft=function(){var t=this.getY()+this.group.getBBox().height/2,e=this.getX()+this.textMargin;return{x:e,y:t}},h.prototype.getRight=function(){var t=this.getY()+this.group.getBBox().height/2,e=this.getX()+this.group.getBBox().width-this.textMargin;return{x:e,y:t}},m.inherits(f,o),f.prototype.render=function(){this.yes_direction&&(this[this.yes_direction+"_symbol"]=this.yes_symbol),this.no_direction&&(this[this.no_direction+"_symbol"]=this.no_symbol);var t=this.getAttr("line-length");if(this.bottom_symbol){var e=this.getBottom();this.bottom_symbol.getTop(),this.bottom_symbol.isPositioned||(this.bottom_symbol.shiftY(this.getY()+this.height+t),this.bottom_symbol.setX(e.x-this.bottom_symbol.width/2),this.bottom_symbol.isPositioned=!0,this.bottom_symbol.render())}if(this.right_symbol){var n=this.getRight();if(this.right_symbol.getLeft(),!this.right_symbol.isPositioned){this.right_symbol.setY(n.y-this.right_symbol.height/2),this.right_symbol.shiftX(this.group.getBBox().x+this.width+t);var r=this;!function i(){for(var e,n=!1,a=0,o=r.chart.symbols.length;o>a;a++){e=r.chart.symbols[a];var s=Math.abs(e.getCenter().x-r.right_symbol.getCenter().x);if(e.getCenter().y>r.right_symbol.getCenter().y&&s<=r.right_symbol.width/2){n=!0;break}}n&&(r.right_symbol.setX(e.getX()+e.width+t),i())}(),this.right_symbol.isPositioned=!0,this.right_symbol.render()}}},f.prototype.renderLines=function(){this.yes_symbol&&this.drawLineTo(this.yes_symbol,this.getAttr("yes-text"),this.yes_direction),this.no_symbol&&this.drawLineTo(this.no_symbol,this.getAttr("no-text"),this.no_direction)},p.parse=d,p}),define("extensions/umlDiagrams",["underscore","utils","logger","classes/Extension","crel","Diagram","flow-chart"],function(t,e,n,r,i,a,o){var s=new r("umlDiagrams","UML Diagrams",!0);return s.defaultConfig={flowchartOptions:["{",' "line-width": 2,',' "font-family": "sans-serif",',' "font-weight": "normal"',"}"].join("\n")},s.onPagedownConfigure=function(e){var n=document.getElementById("preview-contents");e.hooks.chain("onPreviewRefresh",function(){t.each(n.querySelectorAll(".prettyprint > .language-sequence"),function(t){try{var e=a.parse(t.textContent),n=t.parentNode,r=i("div",{"class":"sequence-diagram"});n.parentNode.replaceChild(r,n),e.drawSVG(r,{theme:"simple"})}catch(o){}}),t.each(n.querySelectorAll(".prettyprint > .language-flow"),function(t){try{var e=o.parse(t.textContent),n=t.parentNode,r=i("div",{"class":"flow-chart"});n.parentNode.replaceChild(r,n),e.drawSVG(r,JSON.parse(s.config.flowchartOptions))}catch(a){}})})},s}),define("extensions/toc",["underscore","utils","classes/Extension"],function(t,e,n){function r(t,e,n){this.tagName=t,this.anchor=e,this.text=n,this.children=[]}function i(e,n){function a(){void 0!==s&&(s.children.length>0&&(s.children=i(s.children,n+1)),c.push(s))}n=n||1;var s,l="H"+n,c=[];return t.each(e,function(t){t.tagName!=l?n!==o.config.maxDepth&&(void 0===s&&(s=new r),s.children.push(t)):(a(),s=t)}),a(),c}function a(){function n(n){for(var r=n.id||e.slugify(n.textContent)||"title",i=r,o=0;t.has(a,i);)i=r+"-"+ ++o;return a[i]=!0,n.id=i,i}Line truncated
for(var n=0,r=Math.min(t.length,e.length),i=r,a=0;i>n;)t.substring(a,i)==e.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},diff_match_patch.prototype.diff_commonSuffix=function(t,e){if(!t||!e||t.charAt(t.length-1)!=e.charAt(e.length-1))return 0;for(var n=0,r=Math.min(t.length,e.length),i=r,a=0;i>n;)t.substring(t.length-i,t.length-a)==e.substring(e.length-i,e.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},diff_match_patch.prototype.diff_commonOverlap_=function(t,e){var n=t.length,r=e.length;if(0==n||0==r)return 0;n>r?t=t.substring(n-r):r>n&&(e=e.substring(0,n));var i=Math.min(n,r);if(t==e)return i;for(var a=0,o=1;;){var s=t.substring(i-o),l=e.indexOf(s);if(-1==l)return a;o+=l,(0==l||t.substring(i-o)==e.substring(0,o))&&(a=o,o++)}},diff_match_patch.prototype.diff_halfMatch_=function(t,e){function n(t,e,n){for(var r,i,a,s,l=t.substring(n,n+Math.floor(t.length/4)),c=-1,u="";-1!=(c=e.indexOf(l,c+1));){var h=o.diff_commonPrefix(t.substring(n),e.substring(c)),f=o.diff_commonSuffix(t.substring(0,n),e.substring(0,c));u.length<f+h&&(u=e.substring(c-f,c)+e.substring(c,c+h),r=t.substring(0,n-f),i=t.substring(n+h),a=e.substring(0,c-f),s=e.substring(c+h))}return 2*u.length>=t.length?[r,i,a,s,u]:null}if(this.Diff_Timeout<=0)return null;var r=t.length>e.length?t:e,i=t.length>e.length?e:t;if(r.length<4||2*i.length<r.length)return null;var a,o=this,s=n(r,i,Math.ceil(r.length/4)),l=n(r,i,Math.ceil(r.length/2));if(!s&&!l)return null;a=l?s&&s[4].length>l[4].length?s:l:s;var c,u,h,f;t.length>e.length?(c=a[0],u=a[1],h=a[2],f=a[3]):(h=a[0],f=a[1],c=a[2],u=a[3]);var d=a[4];return[c,u,h,f,d]},diff_match_patch.prototype.diff_cleanupSemantic=function(t){for(var e=!1,n=[],r=0,i=null,a=0,o=0,s=0,l=0,c=0;a<t.length;)t[a][0]==DIFF_EQUAL?(n[r++]=a,o=l,s=c,l=0,c=0,i=t[a][1]):(t[a][0]==DIFF_INSERT?l+=t[a][1].length:c+=t[a][1].length,i&&i.length<=Math.max(o,s)&&i.length<=Math.max(l,c)&&(t.splice(n[r-1],0,[DIFF_DELETE,i]),t[n[r-1]+1][0]=DIFF_INSERT,r--,r--,a=r>0?n[r-1]:-1,o=0,s=0,l=0,c=0,i=null,e=!0)),a++;for(e&&this.diff_cleanupMerge(t),this.diff_cleanupSemanticLossless(t),a=1;a<t.length;){if(t[a-1][0]==DIFF_DELETE&&t[a][0]==DIFF_INSERT){var u=t[a-1][1],h=t[a][1],f=this.diff_commonOverlap_(u,h),d=this.diff_commonOverlap_(h,u);f>=d?(f>=u.length/2||f>=h.length/2)&&(t.splice(a,0,[DIFF_EQUAL,h.substring(0,f)]),t[a-1][1]=u.substring(0,u.length-f),t[a+1][1]=h.substring(f),a++):(d>=u.length/2||d>=h.length/2)&&(t.splice(a,0,[DIFF_EQUAL,u.substring(0,d)]),t[a-1][0]=DIFF_INSERT,t[a-1][1]=h.substring(0,h.length-d),t[a+1][0]=DIFF_DELETE,t[a+1][1]=u.substring(d),a++),a++}a++}},diff_match_patch.prototype.diff_cleanupSemanticLossless=function(t){function e(t,e){if(!t||!e)return 6;var n=t.charAt(t.length-1),r=e.charAt(0),i=n.match(diff_match_patch.nonAlphaNumericRegex_),a=r.match(diff_match_patch.nonAlphaNumericRegex_),o=i&&n.match(diff_match_patch.whitespaceRegex_),s=a&&r.match(diff_match_patch.whitespaceRegex_),l=o&&n.match(diff_match_patch.linebreakRegex_),c=s&&r.match(diff_match_patch.linebreakRegex_),u=l&&t.match(diff_match_patch.blanklineEndRegex_),h=c&&e.match(diff_match_patch.blanklineStartRegex_);return u||h?5:l||c?4:i&&!o&&s?3:o||s?2:i||a?1:0}for(var n=1;n<t.length-1;){if(t[n-1][0]==DIFF_EQUAL&&t[n+1][0]==DIFF_EQUAL){var r=t[n-1][1],i=t[n][1],a=t[n+1][1],o=this.diff_commonSuffix(r,i);if(o){var s=i.substring(i.length-o);r=r.substring(0,r.length-o),i=s+i.substring(0,i.length-o),a=s+a}for(var l=r,c=i,u=a,h=e(r,i)+e(i,a);i.charAt(0)===a.charAt(0);){r+=i.charAt(0),i=i.substring(1)+a.charAt(0),a=a.substring(1);var f=e(r,i)+e(i,a);f>=h&&(h=f,l=r,c=i,u=a)}t[n-1][1]!=l&&(l?t[n-1][1]=l:(t.splice(n-1,1),n--),t[n][1]=c,u?t[n+1][1]=u:(t.splice(n+1,1),n--))}n++}},diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,diff_match_patch.whitespaceRegex_=/\s/,diff_match_patch.linebreakRegex_=/[\r\n]/,diff_match_patch.blanklineEndRegex_=/\n\r?\n$/,diff_match_patch.blanklineStartRegex_=/^\r?\n\r?\n/,diff_match_patch.prototype.diff_cleanupEfficiency=function(t){for(var e=!1,n=[],r=0,i=null,a=0,o=!1,s=!1,l=!1,c=!1;a<t.length;)t[a][0]==DIFF_EQUAL?(t[a][1].length<this.Diff_EditCost&&(l||c)?(n[r++]=a,o=l,s=c,i=t[a][1]):(r=0,i=null),l=c=!1):(t[a][0]==DIFF_DELETE?c=!0:l=!0,i&&(o&&s&&l&&c||i.length<this.Diff_EditCost/2&&o+s+l+c==3)&&(t.splice(n[r-1],0,[DIFF_DELETE,i]),t[n[r-1]+1][0]=DIFF_INSERT,r--,i=null,o&&s?(l=c=!0,r=0):(r--,a=r>0?n[r-1]:-1,l=c=!1),e=!0)),a++;e&&this.diff_cleanupMerge(t)},diff_match_patch.prototype.diff_cleanupMerge=function(t){t.push([DIFF_EQUAL,""]);for(var e,n=0,r=0,i=0,a="",o="";n<t.length;)switch(t[n][0]){case DIFF_INSERT:i++,o+=t[n][1],n++;break;case DIFF_DELETE:r++,a+=t[n][1],n++;break;case DIFF_EQUAL:r+i>1?(0!==r&&0!==i&&(e=this.diff_commonPrefix(o,a),0!==e&&(n-r-i>0&&t[n-r-i-1][0]==DIFF_EQUAL?t[n-r-i-1][1]+=o.substring(0,e):(t.splice(0,0,[DIFF_EQUAL,o.substring(0,e)]),n++),o=o.substring(e),a=a.substring(e)),e=this.diff_commonSuffix(o,a),0!==e&&(t[n][1]=o.substring(o.length-e)+t[n][1],o=o.substring(0,o.length-e),a=a.substrLine truncated
}return{x:i,y:a}},this.getClosestWordOffset=function(t){var e=0,n=0,r=0;return q.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 u(t){void 0!==S&&U.saveSelectionState(!0,!0,t)}function h(t){var e=z.diff_commonPrefix(q,t);e===q.length&&e--;var n=Math.min(z.diff_commonSuffix(q,t),q.length-e,t.length-e),r=t.substring(e,t.length-n),i=U.createRange(e,q.length-n);return i.deleteContents(),i.insertNode(document.createTextNode(r)),{start:e,end:t.length-n}}function f(t,e,n){V.currentMode=V.currentMode||"replace";var r=U.createRange(Math.min(t,e),Math.max(t,e));""+r!=n&&(r.deleteContents(),r.insertNode(document.createTextNode(n)));var i=t+n.length;U.setSelectionStartEnd(i,i),U.updateSelectionRange(),U.updateCursorCoordinates(!0)}function d(t,e){V.currentMode=V.currentMode||"replace";var n=q.replace(t,e);if(n!=q){var r=O.setValue(n);U.setSelectionStartEnd(r.end,r.end),U.updateSelectionRange(),U.updateCursorCoordinates(!0)}}function p(t,e){var n=U.selectionStart;if(n!==U.selectionEnd)return!1;var r=U.createRange(n-t.length,n);return""+r!=t?!1:(r.deleteContents(),r.insertNode(document.createTextNode(e)),n=n-t.length+e.length,U.setSelectionStartEnd(n,n),U.updateSelectionRange(),U.updateCursorCoordinates(!0),!0)}function g(t){h(t),q=t}function m(){return q}function v(){I.focus(),U.updateSelectionRange(),S.scrollTop=L}function y(){function n(t,e,n){H.noWatch(function(){q!=t.content&&(g(t.content),P.content=t.content,r.onContentChanged(P,t.content)),U.setSelectionStartEnd(e,n),U.updateSelectionRange(),U.updateCursorCoordinates(!0)}),s=e,l=n,o=t,this.currentMode=void 0,a=void 0,this.onButtonStateChange(),u()}var i,a,o,s,l,c=[],h=[];this.setCommandMode=function(){this.currentMode="command"},this.setMode=function(){},this.onButtonStateChange=function(){},this.saveState=e.debounce(function(){h=[];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:U.selectionStart,selectionEndAfter:U.selectionEnd,content:q,discussionListJSON:P.discussionListJSON},i=t,a=this.currentMode,this.currentMode=void 0,this.onButtonStateChange()},this),this.saveSelectionState=t.debounce(function(){void 0===this.currentMode&&(s=U.selectionStart,l=U.selectionEnd)},50),this.canUndo=function(){return c.length},this.canRedo=function(){return h.length},this.undo=function(){var t=c.pop();t&&(h.push(o),n.call(this,t,o.selectionStartBefore,o.selectionEndBefore))},this.redo=function(){var t=h.pop();t&&(c.push(o),n.call(this,t,t.selectionStartAfter,t.selectionEndAfter))},this.init=function(){var t=P.content;c=[],h=[],i=0,o={selectionStartAfter:P.selectionStart,selectionEndAfter:P.selectionEnd,content:t,discussionListJSON:P.discussionListJSON},this.currentMode=void 0,a=void 0,T.textContent=t,b()}}function x(){H.isWatching===!0&&(V.currentMode=V.currentMode||"comment",V.saveState())}function b(){var e=S.textContent;if(T.lastChild===D&&"\n"==D.textContent.slice(-1)&&(e=e.slice(0,-1)),e=e.replace(/\r\n?/g,"\n"),j===!1){if(e==q)return void(0===T.children.length&&(T.innerHTML="",X.forEach(function(t){T.appendChild(t.elt)}),C()));V.currentMode=V.currentMode||"typing";var n=t.values(P.discussionList);P.newDiscussion&&n.push(P.newDiscussion),q=e,P.content=q,U.saveSelectionState(),r.onContentChanged(P,q),V.saveState(),G()}else q=e,P.content=q,U.setSelectionStartEnd(P.editorStart,P.editorEnd),U.updateSelectionRange(),U.updateCursorCoordinates(),V.saveSelectionState(),r.onFileOpen(P,q),M.scrollTop=P.previewScrollTop,L=P.editorScrollTop,S.scrollTop=L,j=!1}function _(e){if(Q=[],J=[],Y=void 0,j===!0)return J=X,X=e,void(Q=e);var n=X.length;t.some(X,function(t,r){var i=e[r];return r>=e.length||t.textWithFrontMatter!=i.textWithFrontMatter||t.elt.parentNode!==T||t.elt.textContent!=i.textWithFrontMatter?(n=r,!0):void 0});var r=-X.length;t.some(X.slice().reverse(),function(t,n){var i=e[e.length-n-1];return n>=e.length||t.textWithFrontMatter!=i.textWithFrontMatter||t.elt.parentNode!==T||t.elt.textContent!=i.textWithFrontMatter?(r=-n,!0):void 0}),n-r>X.length&&(r=n-X.length);var i=X.slice(0,n);Q=e.slice(n,e.length+r);var a=X.slice(X.length+r,X.length);Y=t.first(a),J=X.slice(n,X.length+r),X=i.concat(Q).concat(a)}function w(){var t=document.createDocumentFragment();Q.forEach(function(e){E(e),t.appendChild(e.elt)}),H.noWatch(function(){if(j===!0)T.innerHTML="",T.appendChild(t);else{J.forEach(function(t){t.elt.parentNode===T&&T.removeChild(t.elt),t.elt.generated=!1}),void 0!==Y?T.insertBefore(t,Y.elt):T.appendChild(t);for(var e=T.firstChild;e;){var n=e.nextSibling;e.generated||T.removeChild(e),e=n}}C(),U.updateSelectionRange(),U.updateCursorCoordinates()})}function C(){D=o("span",{"class":"token lf"}),D.textContent="\n",T.appendChild(D)}function E(t){var e=K(t.text);window.viewerMode||(e=i.highlight(e,iLine truncated
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","utils","settings","eventMgr","pagedown"],function(t,e,n,r,i,a){function o(){u=!0,h=!0;var t=r.currentTime;t>f+1e3&&(f=t,a.onUserActive())}var s={};MD=n;var l,c,u=!1,h=!1,f=0,d=$('<div class="modal fade modal-insert-link"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button><h4 class="modal-title">'+getMsg("Hyperlink")+'</h4></div><div class="modal-body"><p>'+getMsg("Please provide the link URL and an optional title")+':</p><div class="input-group"><span class="input-group-addon"><i class="fa fa-link"></i></span><input id="input-insert-link" type="text" class="col-sm-5 form-control" placeholder="http://example.com '+getMsg("optional title")+'"></div></div><div class="modal-footer"><a href="#" class="btn btn-default" data-dismiss="modal">'+getMsg("Cancel")+'</a> <a href="#" class="btn btn-primary action-insert-link" data-dismiss="modal">'+getMsg("OK")+"</a></div></div></div></div>"),p=d.find(".action-insert-link");return s.initEditorFirst=function(){var t=new Markdown.Converter,e={_DoItalicsAndBold:function(t){return t=t.replace(/(\*\*|__)(?=\S)(.+?[*_]*)(?=\S)\1/g,"<strong>$2</strong>"),t=t.replace(/(\*|_)(?=\S)(.+?)(?=\S)\1/g,"<em>$2</em>")}};t.setOptions(e),l=new Markdown.Editor(t,void 0,{undoManager:n.undoMgr}),MD.insertLink2=l.insertLink,l.hooks.set("insertLinkDialog",function(t){return s.insertLinkCallback=t,r.resetModalInputs(),d.modal(),!0}),l.hooks.set("insertImageDialog",function(t){if(s.insertLinkCallback=t,s.catchModal)return!0;r.resetModalInputs();var e=$("#leauiIfrForMD");return e.attr("src")||e.attr("src","/album/index?md=1"),$(".modal-insert-image").modal(),!0}),a.onPagedownConfigure(l),l.hooks.chain("onPreviewRefresh",a.onAsyncPreview),l.run(),$(".wmd-button-row li").addClass("btn btn-success").css("left",0).find("span").hide();var i=$(".wmd-button-group1");$("#wmd-bold-button").append($('<i class="fa fa-bold">')).appendTo(i),$("#wmd-italic-button").append($('<i class="fa fa-italic">')).appendTo(i),i=$(".wmd-button-group2"),$("#wmd-link-button").append($('<i class="fa fa-link">')).appendTo(i),$("#wmd-quote-button").append($('<i class="fa fa-quote-left">')).appendTo(i),$("#wmd-code-button").append($('<i class="fa fa-code">')).appendTo(i),$("#wmd-image-button").append($('<i class="fa fa-picture-o">')).appendTo(i),i=$(".wmd-button-group3"),$("#wmd-olist-button").append($('<i class="fa fa-list-ol">')).appendTo(i),$("#wmd-ulist-button").append($('<i class="fa fa-list-ul">')).appendTo(i),$("#wmd-heading-button").append($('<i class="fa fa-header">')).appendTo(i),$("#wmd-hr-button").append($('<i class="fa fa-ellipsis-h">')).appendTo(i),i=$(".wmd-button-group5"),$("#wmd-undo-button").append($('<i class="fa fa-undo">')).appendTo(i),$("#wmd-redo-button").append($('<i class="fa fa-repeat">')).appendTo(i),$("#wmd-help-button").show()},s.initEditor=function(t){return void 0!==c&&a.onFileClosed(c),c=t,void 0!==l?(n.undoMgr.init(),l.uiManager.setUndoRedoButtonStates()):(s.initEditorFirst(),void n.undoMgr.init())},s.onReady=function(){document.body.className+=" "+i.editMode,r.init(),$(document).mousemove(o).keypress(o),a.onReady(),s.initEditorFirst(),n.init()},a.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()}),p.click(function(t){var e=r.getInputTextLine truncated
}return{x:i,y:a}},this.getClosestWordOffset=function(t){var e=0,n=0,r=0;return q.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 u(t){void 0!==S&&U.saveSelectionState(!0,!0,t)}function h(t){var e=z.diff_commonPrefix(q,t);e===q.length&&e--;var n=Math.min(z.diff_commonSuffix(q,t),q.length-e,t.length-e),r=t.substring(e,t.length-n),i=U.createRange(e,q.length-n);return i.deleteContents(),i.insertNode(document.createTextNode(r)),{start:e,end:t.length-n}}function f(t,e,n){V.currentMode=V.currentMode||"replace";var r=U.createRange(Math.min(t,e),Math.max(t,e));""+r!=n&&(r.deleteContents(),r.insertNode(document.createTextNode(n)));var i=t+n.length;U.setSelectionStartEnd(i,i),U.updateSelectionRange(),U.updateCursorCoordinates(!0)}function d(t,e){V.currentMode=V.currentMode||"replace";var n=q.replace(t,e);if(n!=q){var r=O.setValue(n);U.setSelectionStartEnd(r.end,r.end),U.updateSelectionRange(),U.updateCursorCoordinates(!0)}}function p(t,e){var n=U.selectionStart;if(n!==U.selectionEnd)return!1;var r=U.createRange(n-t.length,n);return""+r!=t?!1:(r.deleteContents(),r.insertNode(document.createTextNode(e)),n=n-t.length+e.length,U.setSelectionStartEnd(n,n),U.updateSelectionRange(),U.updateCursorCoordinates(!0),!0)}function g(t){h(t),q=t}function m(){return q}function v(){I.focus(),U.updateSelectionRange(),S.scrollTop=L}function y(){function n(t,e,n){H.noWatch(function(){q!=t.content&&(g(t.content),P.content=t.content,r.onContentChanged(P,t.content)),U.setSelectionStartEnd(e,n),U.updateSelectionRange(),U.updateCursorCoordinates(!0)}),s=e,l=n,o=t,this.currentMode=void 0,a=void 0,this.onButtonStateChange(),u()}var i,a,o,s,l,c=[],h=[];this.setCommandMode=function(){this.currentMode="command"},this.setMode=function(){},this.onButtonStateChange=function(){},this.saveState=e.debounce(function(){h=[];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:U.selectionStart,selectionEndAfter:U.selectionEnd,content:q,discussionListJSON:P.discussionListJSON},i=t,a=this.currentMode,this.currentMode=void 0,this.onButtonStateChange()},this),this.saveSelectionState=t.debounce(function(){void 0===this.currentMode&&(s=U.selectionStart,l=U.selectionEnd)},50),this.canUndo=function(){return c.length},this.canRedo=function(){return h.length},this.undo=function(){var t=c.pop();t&&(h.push(o),n.call(this,t,o.selectionStartBefore,o.selectionEndBefore))},this.redo=function(){var t=h.pop();t&&(c.push(o),n.call(this,t,t.selectionStartAfter,t.selectionEndAfter))},this.init=function(){var t=P.content;c=[],h=[],i=0,o={selectionStartAfter:P.selectionStart,selectionEndAfter:P.selectionEnd,content:t,discussionListJSON:P.discussionListJSON},this.currentMode=void 0,a=void 0,T.textContent=t,b()}}function x(){H.isWatching===!0&&(V.currentMode=V.currentMode||"comment",V.saveState())}function b(){var e=S.textContent;if(T.lastChild===D&&"\n"==D.textContent.slice(-1)&&(e=e.slice(0,-1)),e=e.replace(/\r\n?/g,"\n"),j===!1){if(e==q)return void(0===T.children.length&&(T.innerHTML="",X.forEach(function(t){T.appendChild(t.elt)}),C()));V.currentMode=V.currentMode||"typing";var n=t.values(P.discussionList);P.newDiscussion&&n.push(P.newDiscussion),q=e,P.content=q,U.saveSelectionState(),r.onContentChanged(P,q),V.saveState(),G()}else q=e,P.content=q,U.setSelectionStartEnd(P.editorStart,P.editorEnd),U.updateSelectionRange(),U.updateCursorCoordinates(),V.saveSelectionState(),r.onFileOpen(P,q),M.scrollTop=P.previewScrollTop,L=P.editorScrollTop,S.scrollTop=L,j=!1}function _(e){if(Q=[],J=[],Y=void 0,j===!0)return J=X,X=e,void(Q=e);var n=X.length;t.some(X,function(t,r){var i=e[r];return r>=e.length||t.textWithFrontMatter!=i.textWithFrontMatter||t.elt.parentNode!==T||t.elt.textContent!=i.textWithFrontMatter?(n=r,!0):void 0});var r=-X.length;t.some(X.slice().reverse(),function(t,n){var i=e[e.length-n-1];return n>=e.length||t.textWithFrontMatter!=i.textWithFrontMatter||t.elt.parentNode!==T||t.elt.textContent!=i.textWithFrontMatter?(r=-n,!0):void 0}),n-r>X.length&&(r=n-X.length);var i=X.slice(0,n);Q=e.slice(n,e.length+r);var a=X.slice(X.length+r,X.length);Y=t.first(a),J=X.slice(n,X.length+r),X=i.concat(Q).concat(a)}function w(){var t=document.createDocumentFragment();Q.forEach(function(e){E(e),t.appendChild(e.elt)}),H.noWatch(function(){if(j===!0)T.innerHTML="",T.appendChild(t);else{J.forEach(function(t){t.elt.parentNode===T&&T.removeChild(t.elt),t.elt.generated=!1}),void 0!==Y?T.insertBefore(t,Y.elt):T.appendChild(t);for(var e=T.firstChild;e;){var n=e.nextSibling;e.generated||T.removeChild(e),e=n}}C(),U.updateSelectionRange(),U.updateCursorCoordinates()})}function C(){D=o("span",{"class":"token lf"}),D.textContent="\n",T.appendChild(D)}function E(t){var e=K(t.text);window.LEAMDPureText||(e=i.highlight(Line truncated
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","utils","settings","eventMgr","pagedown"],function(t,e,n,r,i,a){function o(){u=!0,h=!0;var t=r.currentTime;t>f+1e3&&(f=t,a.onUserActive())}var s={};MD=n;var l,c,u=!1,h=!1,f=0,d=$('<div class="modal fade modal-insert-link"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button><h4 class="modal-title">'+getMsg("Hyperlink")+'</h4></div><div class="modal-body"><p>'+getMsg("Please provide the link URL and an optional title")+':</p><div class="input-group"><span class="input-group-addon"><i class="fa fa-link"></i></span><input id="input-insert-link" type="text" class="col-sm-5 form-control" placeholder="http://example.com '+getMsg("optional title")+'"></div></div><div class="modal-footer"><a href="#" class="btn btn-default" data-dismiss="modal">'+getMsg("Cancel")+'</a> <a href="#" class="btn btn-primary action-insert-link" data-dismiss="modal">'+getMsg("OK")+"</a></div></div></div></div>"),p=d.find(".action-insert-link");return s.initEditorFirst=function(){var t=new Markdown.Converter,e={_DoItalicsAndBold:function(t){return t=t.replace(/(\*\*|__)(?=\S)(.+?[*_]*)(?=\S)\1/g,"<strong>$2</strong>"),t=t.replace(/(\*|_)(?=\S)(.+?)(?=\S)\1/g,"<em>$2</em>")}};t.setOptions(e),l=new Markdown.Editor(t,void 0,{undoManager:n.undoMgr}),MD.pagedownEditor=l,MD.clearUndo=function(){MD.undoMgr.init(),MD.pagedownEditor.uiManager.setUndoRedoButtonStates()},MD.insertLink2=l.insertLink,l.hooks.set("insertLinkDialog",function(t){return s.insertLinkCallback=t,r.resetModalInputs(),d.modal(),!0}),l.hooks.set("insertImageDialog",function(t){if(s.insertLinkCallback=t,s.catchModal)return!0;r.resetModalInputs();var e=$("#leauiIfrForMD");return e.attr("src")||e.attr("src","/album/index?md=1"),$(".modal-insert-image").modal(),!0}),a.onPagedownConfigure(l),l.hooks.chain("onPreviewRefresh",a.onAsyncPreview),l.run(),$(".wmd-button-row li").addClass("btn btn-success").css("left",0).find("span").hide();var i=$(".wmd-button-group1");$("#wmd-bold-button").append($('<i class="fa fa-bold">')).appendTo(i),$("#wmd-italic-button").append($('<i class="fa fa-italic">')).appendTo(i),i=$(".wmd-button-group2"),$("#wmd-link-button").append($('<i class="fa fa-link">')).appendTo(i),$("#wmd-quote-button").append($('<i class="fa fa-quote-left">')).appendTo(i),$("#wmd-code-button").append($('<i class="fa fa-code">')).appendTo(i),$("#wmd-image-button").append($('<i class="fa fa-picture-o">')).appendTo(i),i=$(".wmd-button-group3"),$("#wmd-olist-button").append($('<i class="fa fa-list-ol">')).appendTo(i),$("#wmd-ulist-button").append($('<i class="fa fa-list-ul">')).appendTo(i),$("#wmd-heading-button").append($('<i class="fa fa-header">')).appendTo(i),$("#wmd-hr-button").append($('<i class="fa fa-ellipsis-h">')).appendTo(i),i=$(".wmd-button-group4"),$("#wmd-undo-button").append($('<i class="fa fa-undo">')).appendTo(i),$("#wmd-redo-button").append($('<i class="fa fa-repeat">')).appendTo(i),$("#wmd-help-button").show()},s.initEditor=function(t){return void 0!==c&&a.onFileClosed(c),c=t,void 0!==l?(n.undoMgr.init(),l.uiManager.setUndoRedoButtonStates()):(s.initEditorFirst(),void n.undoMgr.init())},s.onReady=function(){document.body.className+=" "+i.editMode,r.init(),$(document).mousemove(o).keypress(o),a.onReady(),s.initEditorFirst(),n.init()},a.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.whichLine truncated