annotate media/js/markitup/jquery.markitup.pack.js @ 211:3a626c48e9ae

Fix #81: could not get paragraphs in Markdown due to the interaction between smiley and Markdown. Refactored the smilify code to use a series of regular expressions over the text when working with markdown.
author Brian Neal <bgneal@gmail.com>
date Sat, 08 May 2010 23:44:59 +0000
parents 217119c87a06
children a61b1c598001
rev   line source
gremmie@1 1 // ----------------------------------------------------------------------------
gremmie@1 2 // markItUp! Universal MarkUp Engine, JQuery plugin
bgneal@199 3 // v 1.1.7
gremmie@1 4 // Dual licensed under the MIT and GPL licenses.
gremmie@1 5 // ----------------------------------------------------------------------------
bgneal@185 6 // Copyright (C) 2007-2010 Jay Salvat
gremmie@1 7 // http://markitup.jaysalvat.com/
gremmie@1 8 // ----------------------------------------------------------------------------
bgneal@199 9 eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(3($){$.23.T=3(f,g){B k,v,A,F;v=A=F=l;k={D:\'\',12:\'\',U:\'\',1j:\'\',1y:7,24:\'25\',1k:\'~/2R/1z.1A\',1b:\'\',26:\'27\',1l:7,1B:\'\',1C:\'\',1D:{},1E:{},1F:{},1G:{},28:[{}]};$.V(k,f,g);2(!k.U){$(\'2S\').1c(3(a,b){1H=$(b).14(0).2T.2U(/(.*)2V\\.2W(\\.2X)?\\.2Y$/);2(1H!==29){k.U=1H[1]}})}4 G.1c(3(){B d,u,15,16,p,H,L,P,17,1m,w,2a,M,18;d=$(G);u=G;15=[];18=l;16=p=0;H=-1;k.1b=1d(k.1b);k.1k=1d(k.1k);3 1d(a,b){2(b){4 a.W(/("|\')~\\//g,"$1"+k.U)}4 a.W(/^~\\//,k.U)}3 2b(){D=\'\';12=\'\';2(k.D){D=\'D="\'+k.D+\'"\'}8 2(d.1I("D")){D=\'D="T\'+(d.1I("D").2c(0,1).2Z())+(d.1I("D").2c(1))+\'"\'}2(k.12){12=\'N="\'+k.12+\'"\'}d.1J(\'<z \'+12+\'></z>\');d.1J(\'<z \'+D+\' N="T"></z>\');d.1J(\'<z N="30"></z>\');d.2d("2e");17=$(\'<z N="31"></z>\').2f(d);$(1K(k.28)).1L(17);1m=$(\'<z N="32"></z>\').1M(d);2(k.1l===7&&$.X.33!==7){1l=$(\'<z N="34"></z>\').1M(d).1e("1N",3(e){B h=d.2g(),y=e.2h,1n,1o;1n=3(e){d.2i("2g",35.36(20,e.2h+h-y)+"37");4 l};1o=3(e){$("1A").1O("2j",1n).1O("2k",1o);4 l};$("1A").1e("2j",1n).1e("2k",1o)});1m.2l(1l)}d.2m(1P).38(1P);d.1e("1Q",3(e,a){2(a.1p!==l){14()}2(u===$.T.2n){Y(a)}});d.1f(3(){$.T.2n=G})}3 1K(b){B c=$(\'<Z></Z>\'),i=0;$(\'C:2o > Z\',c).2i(\'39\',\'q\');$.1c(b,3(){B a=G,t=\'\',1q,C,j;1q=(a.19)?(a.1R||\'\')+\' [3a+\'+a.19+\']\':(a.1R||\'\');19=(a.19)?\'2p="\'+a.19+\'"\':\'\';2(a.2q){C=$(\'<C N="3b">\'+(a.2q||\'\')+\'</C>\').1L(c)}8{i++;2r(j=15.6-1;j>=0;j--){t+=15[j]+"-"}C=$(\'<C N="2s 2s\'+t+(i)+\' \'+(a.3c||\'\')+\'"><a 3d="" \'+19+\' 1q="\'+1q+\'">\'+(a.1R||\'\')+\'</a></C>\').1e("3e",3(){4 l}).2t(3(){4 l}).1N(3(){2(a.2u){3f(a.2u)()}2v(3(){Y(a)},1);4 l}).2o(3(){$(\'> Z\',G).3g();$(E).3h(\'2t\',3(){$(\'Z Z\',17).2w()})},3(){$(\'> Z\',G).2w()}).1L(c);2(a.2x){15.3i(i);$(C).2d(\'3j\').2l(1K(a.2x))}}});15.3k();4 c}3 2y(c){2(c){c=c.3l();c=c.W(/\\(\\!\\(([\\s\\S]*?)\\)\\!\\)/g,3(x,a){B b=a.1S(\'|!|\');2(F===7){4(b[1]!==2z)?b[1]:b[0]}8{4(b[1]===2z)?"":b[0]}});c=c.W(/\\[\\!\\[([\\s\\S]*?)\\]\\!\\]/g,3(x,a){B b=a.1S(\':!:\');2(18===7){4 l}1T=3m(b[0],(b[1])?b[1]:\'\');2(1T===29){18=7}4 1T});4 c}4""}3 I(a){2($.3n(a)){a=a(P)}4 2y(a)}3 1g(a){J=I(L.J);1a=I(L.1a);Q=I(L.Q);O=I(L.O);2(Q!==""){q=J+Q+O}8 2(m===\'\'&&1a!==\'\'){q=J+1a+O}8{q=J+(a||m)+O}4{q:q,J:J,Q:Q,1a:1a,O:O}}3 Y(a){B b,j,n,i;P=L=a;14();$.V(P,{1r:"",U:k.U,u:u,m:(m||\'\'),p:p,v:v,A:A,F:F});I(k.1B);I(L.1B);2(v===7&&A===7){I(L.3o)}$.V(P,{1r:1});2(v===7&&A===7){R=m.1S(/\\r?\\n/);2r(j=0,n=R.6,i=0;i<n;i++){2($.3p(R[i])!==\'\'){$.V(P,{1r:++j,m:R[i]});R[i]=1g(R[i]).q}8{R[i]=""}}o={q:R.3q(\'\\n\')};11=p;b=o.q.6+(($.X.1U)?n:0)}8 2(v===7){o=1g(m);11=p+o.J.6;b=o.q.6-o.J.6-o.O.6;b-=1s(o.q)}8 2(A===7){o=1g(m);11=p;b=o.q.6;b-=1s(o.q)}8{o=1g(m);11=p+o.q.6;b=0;11-=1s(o.q)}2((m===\'\'&&o.Q===\'\')){H+=1V(o.q);11=p+o.J.6;b=o.q.6-o.J.6-o.O.6;H=d.K().1h(p,d.K().6).6;H-=1V(d.K().1h(0,p))}$.V(P,{p:p,16:16});2(o.q!==m&&18===l){2A(o.q);1W(11,b)}8{H=-1}14();$.V(P,{1r:\'\',m:m});2(v===7&&A===7){I(L.3r)}I(L.1C);I(k.1C);2(w&&k.1y){1X()}A=F=v=18=l}3 1V(a){2($.X.1U){4 a.6-a.W(/\\n*/g,\'\').6}4 0}3 1s(a){2($.X.2B){4 a.6-a.W(/\\r*/g,\'\').6}4 0}3 2A(a){2(E.m){B b=E.m.1Y();b.2C=a}8{d.K(d.K().1h(0,p)+a+d.K().1h(p+m.6,d.K().6))}}3 1W(a,b){2(u.2D){2($.X.1U&&$.X.3s>=9.5&&b==0){4 l}1i=u.2D();1i.3t(7);1i.2E(\'1Z\',a);1i.3u(\'1Z\',b);1i.3v()}8 2(u.2F){u.2F(a,a+b)}u.1t=16;u.1f()}3 14(){u.1f();16=u.1t;2(E.m){m=E.m.1Y().2C;2($.X.2B){B a=E.m.1Y(),1u=a.3w();1u.3x(u);p=-1;3y(1u.3z(a)){1u.2E(\'1Z\');p++}}8{p=u.2G}}8{p=u.2G;m=d.K().1h(p,u.3A)}4 m}3 1z(){2(!w||w.3B){2(k.1j){w=3C.2H(\'\',\'1z\',k.1j)}8{M=$(\'<2I N="3D"></2I>\');2(k.24==\'25\'){M.1M(1m)}8{M.2f(17)}w=M[M.6-1].3E||3F[M.6-1]}}8 2(F===7){2(M){M.3G()}8{w.2J()}w=M=l}2(!k.1y){1X()}}3 1X(){2K()}3 2K(){B b;2(k.1b!==\'\'){$.2L({2M:\'3H\',2N:k.1b,27:k.26+\'=\'+3I(d.K()),2O:3(a){21(1d(a,1))}})}8{2(!2a){$.2L({2N:k.1k,2O:3(a){21(1d(a,1).W(/<!-- 3J -->/g,d.K()))}})}}4 l}3 21(a){2(w.E){3K{22=w.E.2P.1t}3L(e){22=0}w.E.2H();w.E.3M(a);w.E.2J();w.E.2P.1t=22}2(k.1j){w.1f()}}3 1P(e){A=e.A;F=e.F;v=(!(e.F&&e.v))?e.v:l;2(e.2M===\'2m\'){2(v===7){C=$("a[2p="+3N.3O(e.1v)+"]",17).1w(\'C\');2(C.6!==0){v=l;2v(3(){C.3P(\'1N\')},1);4 l}}2(e.1v===13||e.1v===10){2(v===7){v=l;Y(k.1F);4 k.1F.1x}8 2(A===7){A=l;Y(k.1E);4 k.1E.1x}8{Y(k.1D);4 k.1D.1x}}2(e.1v===9){2(A==7||v==7||F==7){4 l}2(H!==-1){14();H=d.K().6-H;1W(H,0);H=-1;4 l}8{Y(k.1G);4 k.1G.1x}}}}2b()})};$.23.3Q=3(){4 G.1c(3(){B a=$(G).1O().3R(\'2e\');a.1w(\'z\').1w(\'z.T\').1w(\'z\').Q(a)})};$.T=3(a){B b={1p:l};$.V(b,a);2(b.1p){4 $(b.1p).1c(3(){$(G).1f();$(G).2Q(\'1Q\',[b])})}8{$(\'u\').2Q(\'1Q\',[b])}}})(3S);',62,241,'||if|function|return||length|true|else|||||||||||||false|selection||string|caretPosition|block||||textarea|ctrlKey|previewWindow|||div|shiftKey|var|li|id|document|altKey|this|caretOffset|prepare|openWith|val|clicked|iFrame|class|closeWith|hash|replaceWith|lines||markItUp|root|extend|replace|browser|markup|ul||start|nameSpace||get|levels|scrollPosition|header|abort|key|placeHolder|previewParserPath|each|localize|bind|focus|build|substring|range|previewInWindow|previewTemplatePath|resizeHandle|footer|mouseMove|mouseUp|target|title|line|fixIeBug|scrollTop|rangeCopy|keyCode|parent|keepDefault|previewAutoRefresh|preview|html|beforeInsert|afterInsert|onEnter|onShiftEnter|onCtrlEnter|onTab|miuScript|attr|wrap|dropMenus|appendTo|insertAfter|mousedown|unbind|keyPressed|insertion|name|split|value|opera|fixOperaBug|set|refreshPreview|createRange|character||writeInPreview|sp|fn|previewPosition|after|previewParserVar|data|markupSet|null|template|init|substr|addClass|markItUpEditor|insertBefore|height|clientY|css|mousemove|mouseup|append|keydown|focused|hover|accesskey|separator|for|markItUpButton|click|call|setTimeout|hide|dropMenu|magicMarkups|undefined|insert|msie|text|createTextRange|moveStart|setSelectionRange|selectionStart|open|iframe|close|renderPreview|ajax|type|url|success|documentElement|trigger|templates|script|src|match|jquery|markitup|pack|js|toUpperCase|markItUpContainer|markItUpHeader|markItUpFooter|safari|markItUpResizeHandle|Math|max|px|keyup|display|Ctrl|markItUpSeparator|className|href|contextmenu|eval|show|one|push|markItUpDropMenu|pop|toString|prompt|isFunction|beforeMultiInsert|trim|join|afterMultiInsert|version|collapse|moveEnd|select|duplicate|moveToElementText|while|inRange|selectionEnd|closed|window|markItUpPreviewFrame|contentWindow|frame|remove|POST|encodeURIComponent|content|try|catch|write|String|fromCharCode|triggerHandler|markItUpRemove|removeClass|jQuery'.split('|'),0,{}))