crayon-syntax-highlighter/js/min/crayon.te.min.js
2019-08-30 19:30:19 +02:00

8 lines
42 KiB
JavaScript

var jQueryCrayon=jQuery;(function(a){CrayonUtil=new function(){var c=this;var b=null;c.init=function(){b=CrayonSyntaxSettings;c.initGET()};c.addPrefixToID=function(d){return d.replace(/^([#.])?(.*)$/,"$1"+b.prefix+"$2")};c.removePrefixFromID=function(e){var d=new RegExp("^[#.]?"+b.prefix,"i");return e.replace(d,"")};c.cssElem=function(d){return a(c.addPrefixToID(d))};c.setDefault=function(e,f){return(typeof e=="undefined")?f:e};c.setMax=function(e,d){return e<=d?e:d};c.setMin=function(d,e){return d>=e?d:e};c.setRange=function(e,f,d){return c.setMax(c.setMin(e,f),d)};c.getExt=function(e){if(e.indexOf(".")==-1){return undefined}var d=e.split(".");if(d.length){d=d[d.length-1]}else{d=""}return d};c.initGET=function(){window.currentURL=window.location.protocol+"//"+window.location.host+window.location.pathname;window.currentDir=window.currentURL.substring(0,window.currentURL.lastIndexOf("/"));function d(e){e=e.split("+").join(" ");var h={},g,f=/[?&]?([^=]+)=([^&]*)/g;while(g=f.exec(e)){h[decodeURIComponent(g[1])]=decodeURIComponent(g[2])}return h}window.GET=d(document.location.search)};c.getAJAX=function(d,e){d.version=b.version;a.get(b.ajaxurl,d,e)};c.postAJAX=function(d,e){d.version=b.version;a.post(b.ajaxurl,d,e)};c.reload=function(){var d="?";for(var e in window.GET){d+=e+"="+window.GET[e]+"&"}window.location=window.currentURL+d};c.escape=function(d){if(typeof encodeURIComponent=="function"){return encodeURIComponent(d)}else{if(typeof escape!="function"){return escape(d)}else{return d}}};c.log=function(d){if(typeof console!="undefined"&&b.debug){console.log(d)}};c.decode_html=function(d){return String(d).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")};c.encode_html=function(d){return String(d).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")};c.getReadableColor=function(g,f){f=a.extend({amount:0.5,xMulti:1,yMulti:1.5,normalizeHue:[20,180],normalizeHueXMulti:1/2.5,normalizeHueYMulti:1},f);var d=tinycolor(g);var e=d.toHsv();var i={x:e.s,y:1-e.v};i.x*=f.xMulti;i.y*=f.yMulti;if(f.normalizeHue&&e.h>f.normalizeHue[0]&&e.h<f.normalizeHue[1]){i.x*=f.normalizeHueXMulti;i.y*=f.normalizeHueYMulti}var h=Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2));if(h<f.amount){e.v=0}else{e.v=1}e.s=0;return tinycolor(e).toHexString()};c.removeChars=function(e,f){var d=new RegExp("["+e+"]","gmi");return f.replace(d,"")}};a(document).ready(function(){CrayonUtil.init()});a.fn.bindFirst=function(c,e){this.bind(c,e);var b=this.data("events")[c.split(".")[0]];var d=b.pop();b.splice(0,0,d)};a.keys=function(d){var c=[];for(var b in d){c.push(b)}return c};RegExp.prototype.execAll=function(c){var f=[];var b=null;while((b=this.exec(c))!=null){var e=[];for(var d in b){if(parseInt(d)==d){e.push(b[d])}}f.push(e)}return f};RegExp.prototype.escape=function(b){return b.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")};String.prototype.sliceReplace=function(d,b,c){return this.substring(0,d)+c+this.substring(b)};String.prototype.escape=function(){var b={"&":"&amp;","<":"&lt;",">":"&gt;"};return this.replace(/[&<>]/g,function(c){return b[c]||c})};String.prototype.linkify=function(b){b=typeof b!="undefined"?b:"";return this.replace(/(http(s)?:\/\/(\S)+)/gmi,'<a href="$1" target="'+b+'">$1</a>')};String.prototype.toTitleCase=function(){var b=this.split(/\s+/);var c="";a.each(b,function(e,d){if(d!=""){c+=d.slice(0,1).toUpperCase()+d.slice(1,d.length);if(e!=b.length-1&&b[e+1]!=""){c+=" "}}});return c}})(jQueryCrayon);jqueryPopup=Object();jqueryPopup.defaultSettings={centerBrowser:0,centerScreen:0,height:500,left:0,location:0,menubar:0,resizable:0,scrollbars:0,status:0,width:500,windowName:null,windowURL:null,top:0,toolbar:0,data:null,event:"click"};(function(a){popupWindow=function(d,c,f,b){f=typeof f!=="undefined"?f:null;b=typeof b!=="undefined"?b:null;if(typeof d=="string"){d=jQuery(d)}if(!(d instanceof jQuery)){return false}var e=jQuery.extend({},jqueryPopup.defaultSettings,c||{});d.handler=jQuery(d).bind(e.event,function(){if(f){f()}var g="height="+e.height+",width="+e.width+",toolbar="+e.toolbar+",scrollbars="+e.scrollbars+",status="+e.status+",resizable="+e.resizable+",location="+e.location+",menuBar="+e.menubar;e.windowName=e.windowName||jQuery(this).attr("name");var h=jQuery(this).attr("href");if(!e.windowURL&&!(h=="#")&&!(h=="")){e.windowURL=jQuery(this).attr("href")}var i,j;var k=null;if(e.centerBrowser){if(typeof window.screenY=="undefined"){i=(window.screenTop-120)+((((document.documentElement.clientHeight+120)/2)-(e.height/2)));j=window.screenLeft+((((document.body.offsetWidth+20)/2)-(e.width/2)))}else{i=window.screenY+(((window.outerHeight/2)-(e.height/2)));j=window.screenX+(((window.outerWidth/2)-(e.width/2)))}k=window.open(e.windowURL,e.windowName,g+",left="+j+",top="+i)}else{if(e.centerScreen){i=(screen.height-e.height)/2;j=(screen.width-e.width)/2;k=window.open(e.windowURL,e.windowName,g+",left="+j+",top="+i)}else{k=window.open(e.windowURL,e.windowName,g+",left="+e.left+",top="+e.top)}}if(k!=null){k.focus();if(e.data){k.document.write(e.data)}}if(b){b()}});return e};popdownWindow=function(b,c){if(typeof c=="undefined"){c="click"}b=jQuery(b);if(!(b instanceof jQuery)){return false}b.unbind(c,b.handler)}})(jQueryCrayon);(function(f){f.fn.exists=function(){return this.length!==0};f.fn.style=function(B,E,A){var D=this.get(0);if(typeof D=="undefined"){return}var C=D.style;if(typeof B!="undefined"){if(typeof E!="undefined"){A=typeof A!="undefined"?A:"";if(typeof C.setProperty!="undefined"){C.setProperty(B,E,A)}else{C[B]=E}}else{return C[B]}}else{return C}};var d="crayon-pressed";var a="";var n="div.crayon-syntax";var e=".crayon-toolbar";var c=".crayon-info";var w=".crayon-plain";var o=".crayon-main";var m=".crayon-table";var v=".crayon-loading";var h=".crayon-code";var p=".crayon-title";var l=".crayon-tools";var b=".crayon-nums";var j=".crayon-num";var q=".crayon-line";var g="crayon-wrapped";var s=".crayon-nums-content";var u=".crayon-nums-button";var k=".crayon-wrap-button";var i=".crayon-expand-button";var t="crayon-expanded crayon-toolbar-visible";var y="crayon-placeholder";var x=".crayon-popup-button";var r=".crayon-copy-button";var z=".crayon-plain-button";CrayonSyntax=new function(){var I=this;var N=new Object();var ag;var H;var G=0;var Z;I.init=function(){if(typeof N=="undefined"){N=new Object()}ag=CrayonSyntaxSettings;H=CrayonSyntaxStrings;f(n).each(function(){I.process(this)})};I.process=function(aD,aE){aD=f(aD);var ar=aD.attr("id");if(ar=="crayon-"){ar+=X()}aD.attr("id",ar);CrayonUtil.log(ar);if(typeof aE=="undefined"){aE=false}if(!aE&&!aa(ar)){return}var au=aD.find(e);var aC=aD.find(c);var ap=aD.find(w);var aq=aD.find(o);var aB=aD.find(m);var aj=aD.find(h);var aG=aD.find(p);var aA=aD.find(l);var ay=aD.find(b);var av=aD.find(s);var az=aD.find(u);var am=aD.find(k);var ao=aD.find(i);var aF=aD.find(x);var at=aD.find(r);var al=aD.find(z);N[ar]=aD;N[ar].toolbar=au;N[ar].plain=ap;N[ar].info=aC;N[ar].main=aq;N[ar].table=aB;N[ar].code=aj;N[ar].title=aG;N[ar].tools=aA;N[ar].nums=ay;N[ar].nums_content=av;N[ar].numsButton=az;N[ar].wrapButton=am;N[ar].expandButton=ao;N[ar].popup_button=aF;N[ar].copy_button=at;N[ar].plainButton=al;N[ar].numsVisible=true;N[ar].wrapped=false;N[ar].plainVisible=false;N[ar].toolbar_delay=0;N[ar].time=1;f(w).css("z-index",0);var aw=aq.style();N[ar].mainStyle={height:aw&&aw.height||"","max-height":aw&&aw.maxHeight||"","min-height":aw&&aw.minHeight||"",width:aw&&aw.width||"","max-width":aw&&aw.maxWidth||"","min-width":aw&&aw.minWidth||""};N[ar].mainHeightAuto=N[ar].mainStyle.height==""&&N[ar].mainStyle["max-height"]=="";var ak;var ax=0;N[ar].loading=true;N[ar].scrollBlockFix=false;az.click(function(){CrayonSyntax.toggleNums(ar)});am.click(function(){CrayonSyntax.toggleWrap(ar)});ao.click(function(){CrayonSyntax.toggleExpand(ar)});al.click(function(){CrayonSyntax.togglePlain(ar)});at.click(function(){CrayonSyntax.copyPlain(ar)});B(ar);var an=function(){if(ay.filter('[data-settings~="hide"]').length!=0){av.ready(function(){CrayonUtil.log("function"+ar);CrayonSyntax.toggleNums(ar,true,true)})}else{ac(ar)}if(typeof N[ar].expanded=="undefined"){if(Math.abs(N[ar].main.outerWidth()-N[ar].table.outerWidth())<10){N[ar].expandButton.hide()}else{N[ar].expandButton.show()}}if(ax==5){clearInterval(ak);N[ar].loading=false}ax++};ak=setInterval(an,300);C(ar);f(j,N[ar]).each(function(){var aJ=f(this).attr("data-line");var aI=f("#"+aJ);var aH=aI.style("height");if(aH){aI.attr("data-height",aH)}});aq.css("position","relative");aq.css("z-index",1);Z=(aD.filter('[data-settings~="touchscreen"]').length!=0);if(!Z){aq.click(function(){A(ar,"",false)});ap.click(function(){A(ar,"",false)});aC.click(function(){A(ar,"",false)})}if(aD.filter('[data-settings~="no-popup"]').length==0){N[ar].popup_settings=popupWindow(aF,{height:screen.height-200,width:screen.width-100,top:75,left:50,scrollbars:1,windowURL:"",data:""},function(){F(ar)},function(){})}ap.css("opacity",0);N[ar].toolbarVisible=true;N[ar].hasOneLine=aB.outerHeight()<au.outerHeight()*2;N[ar].toolbarMouseover=false;if(au.filter('[data-settings~="mouseover"]').length!=0&&!Z){N[ar].toolbarMouseover=true;N[ar].toolbarVisible=false;au.css("margin-top","-"+au.outerHeight()+"px");au.hide();if(au.filter('[data-settings~="overlay"]').length!=0&&!N[ar].hasOneLine){au.css("position","absolute");au.css("z-index",2);if(au.filter('[data-settings~="hide"]').length!=0){aq.click(function(){T(ar,undefined,undefined,0)});ap.click(function(){T(ar,false,undefined,0)})}}else{au.css("z-index",4)}if(au.filter('[data-settings~="delay"]').length!=0){N[ar].toolbar_delay=500}aD.mouseenter(function(){T(ar,true)}).mouseleave(function(){T(ar,false)})}else{if(Z){au.show()}}if(aD.filter('[data-settings~="minimize"]').length==0){I.minimize(ar)}if(ap.length!=0&&!Z){if(ap.filter('[data-settings~="dblclick"]').length!=0){aq.dblclick(function(){CrayonSyntax.togglePlain(ar)})}else{if(ap.filter('[data-settings~="click"]').length!=0){aq.click(function(){CrayonSyntax.togglePlain(ar)})}else{if(ap.filter('[data-settings~="mouseover"]').length!=0){aD.mouseenter(function(){CrayonSyntax.togglePlain(ar,true)}).mouseleave(function(){CrayonSyntax.togglePlain(ar,false)});az.hide()}}}if(ap.filter('[data-settings~="show-plain-default"]').length!=0){CrayonSyntax.togglePlain(ar,true)}}var ai=aD.filter('[data-settings~="expand"]').length!=0;if(!Z&&aD.filter('[data-settings~="scroll-mouseover"]').length!=0){aq.css("overflow","hidden");ap.css("overflow","hidden");aD.mouseenter(function(){M(ar,true,ai)}).mouseleave(function(){M(ar,false,ai)})}if(ai){aD.mouseenter(function(){D(ar,true)}).mouseleave(function(){D(ar,false)})}if(aD.filter('[data-settings~="disable-anim"]').length!=0){N[ar].time=0}if(aD.filter('[data-settings~="wrap"]').length!=0){N[ar].wrapped=true}N[ar].mac=aD.hasClass("crayon-os-mac");ac(ar);ab(ar);Y(ar)};var aa=function(ai){CrayonUtil.log(N);if(typeof N[ai]=="undefined"){N[ai]=f("#"+ai);CrayonUtil.log("make "+ai);return true}CrayonUtil.log("no make "+ai);return false};var X=function(){return G++};var F=function(ai){if(typeof N[ai]=="undefined"){return aa(ai)}var aj=N[ai].popup_settings;if(aj&&aj.data){return}var al=N[ai].clone(true);al.removeClass("crayon-wrapped");if(N[ai].wrapped){f(j,al).each(function(){var ao=f(this).attr("data-line");var an=f("#"+ao);var am=an.attr("data-height");am=am?am:"";if(typeof am!="undefined"){an.css("height",am);f(this).css("height",am)}})}al.find(o).css("height","");var ak="";if(N[ai].plainVisible){ak=al.find(w)}else{ak=al.find(o)}aj.data=I.getAllCSS()+'<body class="crayon-popup-window" style="padding:0; margin:0;"><div class="'+al.attr("class")+' crayon-popup">'+I.removeCssInline(I.getHtmlString(ak))+"</div></body>"};I.minimize=function(al){var ak=f('<div class="crayon-minimize crayon-button"><div>');N[al].tools.append(ak);N[al].origTitle=N[al].title.html();if(!N[al].origTitle){N[al].title.html(H.minimize)}var aj="crayon-minimized";var ai=function(){N[al].toolbarPreventHide=false;ak.remove();N[al].removeClass(aj);N[al].title.html(N[al].origTitle);var am=N[al].toolbar;if(am.filter('[data-settings~="never-show"]').length!=0){am.remove()}};N[al].toolbar.click(ai);ak.click(ai);N[al].addClass(aj);N[al].toolbarPreventHide=true;T(al,undefined,undefined,0)};I.getHtmlString=function(ai){return f("<div>").append(ai.clone()).remove().html()};I.removeCssInline=function(ak){var aj=/style\s*=\s*"([^"]+)"/gmi;var ai=null;while((ai=aj.exec(ak))!=null){var al=ai[1];al=al.replace(/\b(?:width|height)\s*:[^;]+;/gmi,"");ak=ak.sliceReplace(ai.index,ai.index+ai[0].length,'style="'+al+'"')}return ak};I.getAllCSS=function(){var ak="";var aj=f('link[rel="stylesheet"]');var ai=[];if(aj.length==1){ai=aj}else{ai=aj.filter('[href*="crayon-syntax-highlighter"], [href*="min/"]')}ai.each(function(){var al=I.getHtmlString(f(this));ak+=al});return ak};I.copyPlain=function(ak,al){if(typeof N[ak]=="undefined"){return aa(ak)}var aj=N[ak].plain;I.togglePlain(ak,true,true);T(ak,true);var ai=N[ak].mac?"\u2318":"CTRL";var am=H.copy;am=am.replace(/%s/,ai+"+C");am=am.replace(/%s/,ai+"+V");A(ak,am);return false};var A=function(aj,al,ai){if(typeof N[aj]=="undefined"){return aa(aj)}var ak=N[aj].info;if(typeof al=="undefined"){al=""}if(typeof ai=="undefined"){ai=true}if(L(ak)&&ai){ak.html("<div>"+al+"</div>");ak.css("margin-top",-ak.outerHeight());ak.show();Q(aj,ak,true);setTimeout(function(){Q(aj,ak,false)},5000)}if(!ai){Q(aj,ak,false)}};var B=function(ai){if(window.devicePixelRatio>1){var aj=f(".crayon-button-icon",N[ai].toolbar);aj.each(function(){var al=f(this).css("background-image");var ak=al.replace(/\.(?=[^\.]+$)/g,"@2x.");f(this).css("background-size","48px 128px");f(this).css("background-image",ak)})}};var L=function(ai){var aj="-"+ai.outerHeight()+"px";if(ai.css("margin-top")==aj||ai.css("display")=="none"){return true}else{return false}};var Q=function(al,ak,aj,an,am,ap){var ai=function(){if(ap){ap(al,ak)}};var ao="-"+ak.outerHeight()+"px";if(typeof aj=="undefined"){if(L(ak)){aj=true}else{aj=false}}if(typeof an=="undefined"){an=100}if(an==false){an=false}if(typeof am=="undefined"){am=0}ak.stop(true);if(aj==true){ak.show();ak.animate({marginTop:0},ah(an,al),ai)}else{if(aj==false){if(ak.css("margin-top")=="0px"&&am){ak.delay(am)}ak.animate({marginTop:ao},ah(an,al),function(){ak.hide();ai()})}}};I.togglePlain=function(al,am,aj){if(typeof N[al]=="undefined"){return aa(al)}var ai=N[al].main;var ak=N[al].plain;if((ai.is(":animated")||ak.is(":animated"))&&typeof am=="undefined"){return}ae(al);var ao,an;if(typeof am!="undefined"){if(am){ao=ai;an=ak}else{ao=ak;an=ai}}else{if(ai.css("z-index")==1){ao=ai;an=ak}else{ao=ak;an=ai}}N[al].plainVisible=(an==ak);N[al].top=ao.scrollTop();N[al].left=ao.scrollLeft();N[al].scrollChanged=false;C(al);ao.stop(true);ao.fadeTo(ah(500,al),0,function(){ao.css("z-index",0)});an.stop(true);an.fadeTo(ah(500,al),1,function(){an.css("z-index",1);if(an==ak){if(aj){ak.select()}else{}}an.scrollTop(N[al].top+1);an.scrollTop(N[al].top);an.scrollLeft(N[al].left+1);an.scrollLeft(N[al].left)});an.scrollTop(N[al].top);an.scrollLeft(N[al].left);ab(al);T(al,false);return false};I.toggleNums=function(am,al,ai){if(typeof N[am]=="undefined"){aa(am);return false}if(N[am].table.is(":animated")){return false}var ao=Math.round(N[am].nums_content.outerWidth()+1);var an="-"+ao+"px";var ak;if(typeof al!="undefined"){ak=false}else{ak=(N[am].table.css("margin-left")==an)}var aj;if(ak){aj="0px";N[am].numsVisible=true}else{N[am].table.css("margin-left","0px");N[am].numsVisible=false;aj=an}if(typeof ai!="undefined"){N[am].table.css("margin-left",aj);ac(am);return false}var ap=(N[am].table.outerWidth()+J(N[am].table.css("margin-left"))>N[am].main.outerWidth());var aq=(N[am].table.outerHeight()>N[am].main.outerHeight());if(!ap&&!aq){N[am].main.css("overflow","hidden")}N[am].table.animate({marginLeft:aj},ah(200,am),function(){if(typeof N[am]!="undefined"){ac(am);if(!ap&&!aq){N[am].main.css("overflow","auto")}}});return false};I.toggleWrap=function(ai){N[ai].wrapped=!N[ai].wrapped;Y(ai)};I.toggleExpand=function(ai){var aj=!CrayonUtil.setDefault(N[ai].expanded,false);D(ai,aj)};var Y=function(ai,aj){aj=CrayonUtil.setDefault(aj,true);if(N[ai].wrapped){N[ai].addClass(g)}else{N[ai].removeClass(g)}E(ai);if(!N[ai].expanded&&aj){V(ai)}N[ai].wrapTimes=0;clearInterval(N[ai].wrapTimer);N[ai].wrapTimer=setInterval(function(){if(N[ai].is(":visible")){O(ai);N[ai].wrapTimes++;if(N[ai].wrapTimes==5){clearInterval(N[ai].wrapTimer)}}},200)};var ad=function(ai){if(typeof N[ai]=="undefined"){aa(ai);return false}};var J=function(aj){if(typeof aj!="string"){return 0}var ai=aj.replace(/[^-0-9]/g,"");if(ai.length==0){return 0}else{return parseInt(ai)}};var ac=function(ai){if(typeof N[ai]=="undefined"||typeof N[ai].numsVisible=="undefined"){return}if(N[ai].numsVisible){N[ai].numsButton.removeClass(a);N[ai].numsButton.addClass(d)}else{N[ai].numsButton.removeClass(d);N[ai].numsButton.addClass(a)}};var E=function(ai){if(typeof N[ai]=="undefined"||typeof N[ai].wrapped=="undefined"){return}if(N[ai].wrapped){N[ai].wrapButton.removeClass(a);N[ai].wrapButton.addClass(d)}else{N[ai].wrapButton.removeClass(d);N[ai].wrapButton.addClass(a)}};var W=function(ai){if(typeof N[ai]=="undefined"||typeof N[ai].expanded=="undefined"){return}if(N[ai].expanded){N[ai].expandButton.removeClass(a);N[ai].expandButton.addClass(d)}else{N[ai].expandButton.removeClass(d);N[ai].expandButton.addClass(a)}};var ab=function(ai){if(typeof N[ai]=="undefined"||typeof N[ai].plainVisible=="undefined"){return}if(N[ai].plainVisible){N[ai].plainButton.removeClass(a);N[ai].plainButton.addClass(d)}else{N[ai].plainButton.removeClass(d);N[ai].plainButton.addClass(a)}};var T=function(aj,ai,al,ak){if(typeof N[aj]=="undefined"){return aa(aj)}else{if(!N[aj].toolbarMouseover){return}else{if(ai==false&&N[aj].toolbarPreventHide){return}else{if(Z){return}}}}var am=N[aj].toolbar;if(typeof ak=="undefined"){ak=N[aj].toolbar_delay}Q(aj,am,ai,al,ak,function(){N[aj].toolbarVisible=ai})};var R=function(ak,ai){var aj=f.extend({},ak);aj.width+=ai.width;aj.height+=ai.height;return aj};var P=function(ak,ai){var aj=f.extend({},ak);aj.width-=ai.width;aj.height-=ai.height;return aj};var U=function(ai){if(typeof N[ai].initialSize=="undefined"){N[ai].toolbarHeight=N[ai].toolbar.outerHeight();N[ai].innerSize={width:N[ai].width(),height:N[ai].height()};N[ai].outerSize={width:N[ai].outerWidth(),height:N[ai].outerHeight()};N[ai].borderSize=P(N[ai].outerSize,N[ai].innerSize);N[ai].initialSize={width:N[ai].main.outerWidth(),height:N[ai].main.outerHeight()};N[ai].initialSize.height+=N[ai].toolbarHeight;N[ai].initialOuterSize=R(N[ai].initialSize,N[ai].borderSize);N[ai].finalSize={width:N[ai].table.outerWidth(),height:N[ai].table.outerHeight()};N[ai].finalSize.height+=N[ai].toolbarHeight;N[ai].finalSize.width=CrayonUtil.setMin(N[ai].finalSize.width,N[ai].initialSize.width);N[ai].finalSize.height=CrayonUtil.setMin(N[ai].finalSize.height,N[ai].initialSize.height);N[ai].diffSize=P(N[ai].finalSize,N[ai].initialSize);N[ai].finalOuterSize=R(N[ai].finalSize,N[ai].borderSize);N[ai].initialSize.height+=N[ai].toolbar.outerHeight()}};var D=function(al,ao){if(typeof N[al]=="undefined"){return aa(al)}if(typeof ao=="undefined"){return}var aj=N[al].main;var aq=N[al].plain;if(ao){if(typeof N[al].expanded=="undefined"){U(al);N[al].expandTime=CrayonUtil.setRange(N[al].diffSize.width/3,300,800);N[al].expanded=false;var ap=N[al].finalOuterSize;N[al].placeholder=f("<div></div>");N[al].placeholder.addClass(y);N[al].placeholder.css(ap);N[al].before(N[al].placeholder);N[al].placeholder.css("margin",N[al].css("margin"));f(window).bind("resize",K)}var am={height:"auto","min-height":"none","max-height":"none"};var ai={width:"auto","min-width":"none","max-width":"none"};N[al].outerWidth(N[al].outerWidth());N[al].css({"min-width":"none","max-width":"none"});var an={width:N[al].finalOuterSize.width};if(!N[al].mainHeightAuto&&!N[al].hasOneLine){an.height=N[al].finalOuterSize.height;N[al].outerHeight(N[al].outerHeight())}aj.css(am);aj.css(ai);N[al].stop(true);N[al].animate(an,ah(N[al].expandTime,al),function(){N[al].expanded=true;W(al)});N[al].placeholder.show();f("body").prepend(N[al]);N[al].addClass(t);K()}else{var ar=N[al].initialOuterSize;var ak=N[al].toolbar_delay;if(ar){N[al].stop(true);if(!N[al].expanded){N[al].delay(ak)}var an={width:ar.width};if(!N[al].mainHeightAuto&&!N[al].hasOneLine){an.height=ar.height}N[al].animate(an,ah(N[al].expandTime,al),function(){af(al)})}else{setTimeout(function(){af(al)},ak)}N[al].placeholder.hide();N[al].placeholder.before(N[al]);N[al].css({left:"auto",top:"auto"});N[al].removeClass(t)}ae(al);if(ao){Y(al,false)}};var K=function(){for(uid in N){if(N[uid].hasClass(t)){N[uid].css(N[uid].placeholder.offset())}}};var af=function(ai){N[ai].expanded=false;V(ai);W(ai);if(N[ai].wrapped){Y(ai)}};var M=function(al,aj,am){if(typeof N[al]=="undefined"){return aa(al)}if(typeof aj=="undefined"||am||N[al].expanded){return}var ai=N[al].main;var ak=N[al].plain;if(aj){ai.css("overflow","auto");ak.css("overflow","auto");if(typeof N[al].top!="undefined"){visible=(ai.css("z-index")==1?ai:ak);visible.scrollTop(N[al].top-1);visible.scrollTop(N[al].top);visible.scrollLeft(N[al].left-1);visible.scrollLeft(N[al].left)}}else{visible=(ai.css("z-index")==1?ai:ak);N[al].top=visible.scrollTop();N[al].left=visible.scrollLeft();ai.css("overflow","hidden");ak.css("overflow","hidden")}N[al].scrollChanged=true;C(al)};var C=function(ai){N[ai].table.style("width","100%","important");var aj=setTimeout(function(){N[ai].table.style("width","");clearInterval(aj)},10)};var V=function(ak){var aj=N[ak].main;var ai=N[ak].mainStyle;aj.css(ai);N[ak].css("height","auto");N[ak].css("width",ai.width);N[ak].css("max-width",ai["max-width"]);N[ak].css("min-width",ai["min-width"])};var ae=function(ai){N[ai].plain.outerHeight(N[ai].main.outerHeight())};var O=function(ai){f(j,N[ai]).each(function(){var al=f(this).attr("data-line");var ak=f("#"+al);var aj=null;if(N[ai].wrapped){ak.css("height","");aj=ak.outerHeight();aj=aj?aj:""}else{aj=ak.attr("data-height");aj=aj?aj:"";ak.css("height",aj)}f(this).css("height",aj)})};var ah=function(ai,aj){if(ai=="fast"){ai=200}else{if(ai=="slow"){ai=600}else{if(!S(ai)){ai=parseInt(ai);if(isNaN(ai)){return 0}}}}return ai*N[aj].time};var S=function(ai){return typeof ai=="number"}};f(document).ready(function(){CrayonSyntax.init()})})(jQueryCrayon);(function(b){var a=CrayonTagEditorSettings;window.CrayonQuickTags=new function(){var c=this;c.init=function(){c.sel='*[id*="crayon_quicktag"],*[class*="crayon_quicktag"]';var e=a.quicktag_text;e=e!==undefined?e:"crayon";QTags.addButton("crayon_quicktag",e,function(){CrayonTagEditor.showDialog({insert:function(g){QTags.insertContent(g)},select:c.getSelectedText,editor_str:"html",output:"encode"});b(c.sel).removeClass("qt_crayon_highlight")});var d;var f=setInterval(function(){d=b(c.sel).first();if(typeof d!="undefined"){CrayonTagEditor.bind(c.sel);clearInterval(f)}},100)};c.getSelectedText=function(){if(QTags.instances.length==0){return null}else{var f=QTags.instances[0];var e=f.canvas.selectionStart;var d=f.canvas.selectionEnd;return f.canvas.value.substring(e,d)}}};b(document).ready(function(){CrayonQuickTags.init()})})(jQueryCrayon);
/*!
Colorbox v1.5.9 - 2014-04-25
jQuery lightbox and modal window plugin
(c) 2014 Jack Moore - http://www.jacklmoore.com/colorbox
license: http://www.opensource.org/licenses/mit-license.php
*/
(function(aT,a8,a4){function aZ(a,d,c){var b=a8.createElement(a);return d&&(b.id=ab+d),c&&(b.style.cssText=c),aT(b)}function aY(){return a4.innerHeight?a4.innerHeight:aT(a4).height()}function aV(b,a){a!==Object(a)&&(a={}),this.cache={},this.el=b,this.value=function(c){var d;return void 0===this.cache[c]&&(d=aT(this.el).attr("data-cbox-"+c),void 0!==d?this.cache[c]=d:void 0!==a[c]?this.cache[c]=a[c]:void 0!==ad[c]&&(this.cache[c]=ad[c])),this.cache[c]},this.get=function(d){var c=this.value(d);return aT.isFunction(c)?c.call(this.el,this):c}}function a5(b){var c=ag.length,a=(aM+b)%c;return 0>a?c+a:a}function bd(a,b){return Math.round((/%/.test(a)?("x"===b?az.width():aY())/100:1)*parseInt(a,10))}function aU(a,b){return a.get("photo")||a.get("photoRegex").test(b)}function a1(a,b){return a.get("retinaUrl")&&a4.devicePixelRatio>1?b.replace(a.get("photoRegex"),a.get("retinaSuffix")):b}function a9(a){"contains" in aP[0]&&!aP[0].contains(a.target)&&a.target!==aR[0]&&(a.stopPropagation(),aP.focus())}function ba(a){ba.str!==a&&(aP.add(aR).removeClass(ba.str).addClass(a),ba.str=a)}function a6(a){aM=0,a&&a!==!1?(ag=aT("."+af).filter(function(){var b=aT.data(this,ac),c=new aV(this,b);return c.get("rel")===a}),aM=ag.index(bf.el),-1===aM&&(ag=ag.add(bf.el),aM=ag.length-1)):ag=aT(bf.el)}function aS(a){aT(a8).trigger(a),aA.triggerHandler(a)}function a7(b){var g;if(!ax){if(g=aT(b).data("colorbox"),bf=new aV(b,g),a6(bf.get("rel")),!aH){aH=aW=!0,ba(bf.get("className")),aP.css({visibility:"hidden",display:"block",opacity:""}),ar=aZ(aG,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),bb.css({width:"",height:""}).append(ar),aB=aj.height()+a2.height()+bb.outerHeight(!0)-bb.height(),a3=aC.width()+aw.width()+bb.outerWidth(!0)-bb.width(),aF=ar.outerHeight(!0),ap=ar.outerWidth(!0);var d=bd(bf.get("initialWidth"),"x"),c=bd(bf.get("initialHeight"),"y"),a=bf.get("maxWidth"),e=bf.get("maxHeight");bf.w=(a!==!1?Math.min(d,bd(a,"x")):d)-ap-a3,bf.h=(e!==!1?Math.min(c,bd(e,"y")):c)-aF-aB,ar.css({width:"",height:bf.h}),au.position(),aS(bc),bf.get("onOpen"),ao.add(av).hide(),aP.focus(),bf.get("trapFocus")&&a8.addEventListener&&(a8.addEventListener("focus",a9,!0),aA.one(aO,function(){a8.removeEventListener("focus",a9,!0)})),bf.get("returnFocus")&&aA.one(aO,function(){aT(bf.el).focus()})}aR.css({opacity:parseFloat(bf.get("opacity"))||"",cursor:bf.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),bf.get("closeButton")?aE.html(bf.get("close")).appendTo(bb):aE.appendTo("<div/>"),aQ()}}function aX(){!aP&&a8.body&&(ah=!1,az=aT(a4),aP=aZ(aG).attr({id:ac,"class":aT.support.opacity===!1?ab+"IE":"",role:"dialog",tabindex:"-1"}).hide(),aR=aZ(aG,"Overlay").hide(),ak=aT([aZ(aG,"LoadingOverlay")[0],aZ(aG,"LoadingGraphic")[0]]),aN=aZ(aG,"Wrapper"),bb=aZ(aG,"Content").append(av=aZ(aG,"Title"),al=aZ(aG,"Current"),an=aT('<button type="button"/>').attr({id:ab+"Previous"}),at=aT('<button type="button"/>').attr({id:ab+"Next"}),ay=aZ("button","Slideshow"),ak),aE=aT('<button type="button"/>').attr({id:ab+"Close"}),aN.append(aZ(aG).append(aZ(aG,"TopLeft"),aj=aZ(aG,"TopCenter"),aZ(aG,"TopRight")),aZ(aG,!1,"clear:left").append(aC=aZ(aG,"MiddleLeft"),bb,aw=aZ(aG,"MiddleRight")),aZ(aG,!1,"clear:left").append(aZ(aG,"BottomLeft"),a2=aZ(aG,"BottomCenter"),aZ(aG,"BottomRight"))).find("div div").css({"float":"left"}),aq=aZ(aG,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),ao=at.add(an).add(al).add(ay),aT(a8.body).append(aR,aP.append(aN,aq)))}function a0(){function a(b){b.which>1||b.shiftKey||b.altKey||b.metaKey||b.ctrlKey||(b.preventDefault(),a7(this))}return aP?(ah||(ah=!0,at.click(function(){au.next()}),an.click(function(){au.prev()}),aE.click(function(){au.close()}),aR.click(function(){bf.get("overlayClose")&&au.close()}),aT(a8).bind("keydown."+ab,function(b){var c=b.keyCode;aH&&bf.get("escKey")&&27===c&&(b.preventDefault(),au.close()),aH&&bf.get("arrowKey")&&ag[1]&&!b.altKey&&(37===c?(b.preventDefault(),an.click()):39===c&&(b.preventDefault(),at.click()))}),aT.isFunction(aT.fn.on)?aT(a8).on("click."+ab,"."+af,a):aT("."+af).live("click."+ab,a)),!0):!1}function aQ(){var f,i,b,a=au.prep,g=++aK;if(aW=!0,ai=!1,aS(be),aS(aJ),bf.get("onLoad"),bf.h=bf.get("height")?bd(bf.get("height"),"y")-aF-aB:bf.get("innerHeight")&&bd(bf.get("innerHeight"),"y"),bf.w=bf.get("width")?bd(bf.get("width"),"x")-ap-a3:bf.get("innerWidth")&&bd(bf.get("innerWidth"),"x"),bf.mw=bf.w,bf.mh=bf.h,bf.get("maxWidth")&&(bf.mw=bd(bf.get("maxWidth"),"x")-ap-a3,bf.mw=bf.w&&bf.w<bf.mw?bf.w:bf.mw),bf.get("maxHeight")&&(bf.mh=bd(bf.get("maxHeight"),"y")-aF-aB,bf.mh=bf.h&&bf.h<bf.mh?bf.h:bf.mh),f=bf.get("href"),am=setTimeout(function(){ak.show()},100),bf.get("inline")){var j=aT(f);b=aT("<div>").hide().insertBefore(j),aA.one(be,function(){b.replaceWith(j)}),a(j)}else{bf.get("iframe")?a(" "):bf.get("html")?a(bf.get("html")):aU(bf,f)?(f=a1(bf,f),ai=new Image,aT(ai).addClass(ab+"Photo").bind("error",function(){a(aZ(aG,"Error").html(bf.get("imgError")))}).one("load",function(){g===aK&&setTimeout(function(){var c;aT.each(["alt","longdesc","aria-describedby"],function(h,d){var k=aT(bf.el).attr(d)||aT(bf.el).attr("data-"+d);k&&ai.setAttribute(d,k)}),bf.get("retinaImage")&&a4.devicePixelRatio>1&&(ai.height=ai.height/a4.devicePixelRatio,ai.width=ai.width/a4.devicePixelRatio),bf.get("scalePhotos")&&(i=function(){ai.height-=ai.height*c,ai.width-=ai.width*c},bf.mw&&ai.width>bf.mw&&(c=(ai.width-bf.mw)/ai.width,i()),bf.mh&&ai.height>bf.mh&&(c=(ai.height-bf.mh)/ai.height,i())),bf.h&&(ai.style.marginTop=Math.max(bf.mh-ai.height,0)/2+"px"),ag[1]&&(bf.get("loop")||ag[aM+1])&&(ai.style.cursor="pointer",ai.onclick=function(){au.next()}),ai.style.width=ai.width+"px",ai.style.height=ai.height+"px",a(ai)},1)}),ai.src=f):f&&aq.load(f,bf.get("data"),function(d,c){g===aK&&a("error"===c?aZ(aG,"Error").html(bf.get("xhrError")):aT(this).contents())})}}var aR,aP,aN,bb,aj,aC,aw,a2,ag,az,ar,aq,ak,av,al,ay,at,an,aE,ao,bf,aB,a3,aF,ap,aM,ai,aH,aW,ax,am,au,ah,ad={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:0.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return aT(this).attr("href")},title:function(){return this.title}},ac="colorbox",ab="cbox",af=ab+"Element",bc=ab+"_open",aJ=ab+"_load",aa=ab+"_complete",aL=ab+"_cleanup",aO=ab+"_closed",be=ab+"_purge",aA=aT("<a/>"),aG="div",aK=0,aD={},aI=function(){function l(){clearTimeout(g)}function j(){(bf.get("loop")||ag[aM+1])&&(l(),g=setTimeout(au.next,bf.get("slideshowSpeed")))}function f(){ay.html(bf.get("slideshowStop")).unbind(m).one(m,d),aA.bind(aa,j).bind(aJ,l),aP.removeClass(k+"off").addClass(k+"on")}function d(){l(),aA.unbind(aa,j).unbind(aJ,l),ay.html(bf.get("slideshowStart")).unbind(m).one(m,function(){au.next(),f()}),aP.removeClass(k+"on").addClass(k+"off")}function c(){b=!1,ay.hide(),l(),aA.unbind(aa,j).unbind(aJ,l),aP.removeClass(k+"off "+k+"on")}var b,g,k=ab+"Slideshow_",m="click."+ab;return function(){b?bf.get("slideshow")||(aA.unbind(aL,c),c()):bf.get("slideshow")&&ag[1]&&(b=!0,aA.one(aL,c),bf.get("slideshowAuto")?f():d(),ay.show())}}();aT.colorbox||(aT(aX),au=aT.fn[ac]=aT[ac]=function(b,a){var d,c=this;if(b=b||{},aT.isFunction(c)){c=aT("<a/>"),b.open=!0}else{if(!c[0]){return c}}return c[0]?(aX(),a0()&&(a&&(b.onComplete=a),c.each(function(){var e=aT.data(this,ac)||{};aT.data(this,ac,aT.extend(e,b))}).addClass(af),d=new aV(c[0],b),d.get("open")&&a7(c[0])),c):c},au.position=function(o,j){function b(){aj[0].style.width=a2[0].style.width=bb[0].style.width=parseInt(aP[0].style.width,10)-a3+"px",bb[0].style.height=aC[0].style.height=aw[0].style.height=parseInt(aP[0].style.height,10)-aB+"px"}var a,k,t,f=0,p=0,q=aP.offset();if(az.unbind("resize."+ab),aP.css({top:-90000,left:-90000}),k=az.scrollTop(),t=az.scrollLeft(),bf.get("fixed")?(q.top-=k,q.left-=t,aP.css({position:"fixed"})):(f=k,p=t,aP.css({position:"absolute"})),p+=bf.get("right")!==!1?Math.max(az.width()-bf.w-ap-a3-bd(bf.get("right"),"x"),0):bf.get("left")!==!1?bd(bf.get("left"),"x"):Math.round(Math.max(az.width()-bf.w-ap-a3,0)/2),f+=bf.get("bottom")!==!1?Math.max(aY()-bf.h-aF-aB-bd(bf.get("bottom"),"y"),0):bf.get("top")!==!1?bd(bf.get("top"),"y"):Math.round(Math.max(aY()-bf.h-aF-aB,0)/2),aP.css({top:q.top,left:q.left,visibility:"visible"}),aN[0].style.width=aN[0].style.height="9999px",a={width:bf.w+ap+a3,height:bf.h+aF+aB,top:f,left:p},o){var m=0;aT.each(a,function(c){return a[c]!==aD[c]?(m=o,void 0):void 0}),o=m}aD=a,o||aP.css(a),aP.dequeue().animate(a,{duration:o||0,complete:function(){b(),aW=!1,aN[0].style.width=bf.w+ap+a3+"px",aN[0].style.height=bf.h+aF+aB+"px",bf.get("reposition")&&setTimeout(function(){az.bind("resize."+ab,au.position)},1),j&&j()},step:b})},au.resize=function(a){var b;aH&&(a=a||{},a.width&&(bf.w=bd(a.width,"x")-ap-a3),a.innerWidth&&(bf.w=bd(a.innerWidth,"x")),ar.css({width:bf.w}),a.height&&(bf.h=bd(a.height,"y")-aF-aB),a.innerHeight&&(bf.h=bd(a.innerHeight,"y")),a.innerHeight||a.height||(b=ar.scrollTop(),ar.css({height:"auto"}),bf.h=ar.height()),ar.css({height:bf.h}),b&&ar.scrollTop(b),au.position("none"===bf.get("transition")?0:bf.get("speed")))},au.prep=function(c){function h(){return bf.w=bf.w||ar.width(),bf.w=bf.mw&&bf.mw<bf.w?bf.mw:bf.w,bf.w}function b(){return bf.h=bf.h||ar.height(),bf.h=bf.mh&&bf.mh<bf.h?bf.mh:bf.h,bf.h}if(aH){var f,e="none"===bf.get("transition")?0:bf.get("speed");ar.remove(),ar=aZ(aG,"LoadedContent").append(c),ar.hide().appendTo(aq.show()).css({width:h(),overflow:bf.get("scrolling")?"auto":"hidden"}).css({height:b()}).prependTo(bb),aq.hide(),aT(ai).css({"float":"none"}),ba(bf.get("className")),f=function(){function g(){aT.support.opacity===!1&&aP[0].style.removeAttribute("filter")}var k,j,d=ag.length;aH&&(j=function(){clearTimeout(am),ak.hide(),aS(aa),bf.get("onComplete")},av.html(bf.get("title")).show(),ar.show(),d>1?("string"==typeof bf.get("current")&&al.html(bf.get("current").replace("{current}",aM+1).replace("{total}",d)).show(),at[bf.get("loop")||d-1>aM?"show":"hide"]().html(bf.get("next")),an[bf.get("loop")||aM?"show":"hide"]().html(bf.get("previous")),aI(),bf.get("preloading")&&aT.each([a5(-1),a5(1)],function(){var a,p=ag[this],m=new aV(p,aT.data(p,ac)),l=m.get("href");l&&aU(m,l)&&(l=a1(m,l),a=a8.createElement("img"),a.src=l)})):ao.hide(),bf.get("iframe")?(k=a8.createElement("iframe"),"frameBorder" in k&&(k.frameBorder=0),"allowTransparency" in k&&(k.allowTransparency="true"),bf.get("scrolling")||(k.scrolling="no"),aT(k).attr({src:bf.get("href"),name:(new Date).getTime(),"class":ab+"Iframe",allowFullScreen:!0}).one("load",j).appendTo(ar),aA.one(be,function(){k.src="//about:blank"}),bf.get("fastIframe")&&aT(k).trigger("load")):j(),"fade"===bf.get("transition")?aP.fadeTo(e,1,g):g())},"fade"===bf.get("transition")?aP.fadeTo(e,0,function(){au.position(0,f)}):au.position(e,f)}},au.next=function(){!aW&&ag[1]&&(bf.get("loop")||ag[aM+1])&&(aM=a5(1),a7(ag[aM]))},au.prev=function(){!aW&&ag[1]&&(bf.get("loop")||aM)&&(aM=a5(-1),a7(ag[aM]))},au.close=function(){aH&&!ax&&(ax=!0,aH=!1,aS(aL),bf.get("onCleanup"),az.unbind("."+ab),aR.fadeTo(bf.get("fadeOut")||0,0),aP.stop().fadeTo(bf.get("fadeOut")||0,0,function(){aP.hide(),aR.hide(),aS(be),ar.remove(),setTimeout(function(){ax=!1,aS(aO),bf.get("onClosed")},1)}))},au.remove=function(){aP&&(aP.stop(),aT.colorbox.close(),aP.stop().remove(),aR.remove(),ax=!1,aP=null,aT("."+af).removeData(ac).removeClass(af),aT(a8).unbind("click."+ab))},au.element=function(){return aT(bf.el)},au.settings=ad)})(jQuery,document,window);(function(a){window.CrayonTagEditor=new function(){var j=this;var B=false;var y=false;var e=false;var o,f,r,A,w;var C,t,i,v;var x=0;var k,q;var b=null;var g="";var D=false;var n,p,d;var z,c,u,l,h;var m={inline:true,width:690,height:"90%",closeButton:false,fixed:true,transition:"none",className:"crayon-colorbox",onOpen:function(){a(this.outer).prepend(a(n.bar_content))},onComplete:function(){a(n.code_css).focus()},onCleanup:function(){a(n.bar).prepend(a(n.bar_content))}};j.init=function(){n=CrayonTagEditorSettings;p=CrayonSyntaxSettings;d=CrayonUtil;m.href=n.content_css};j.bind=function(E){if(!B){B=true;j.init()}var s=a(E);s.each(function(G,F){var I=a(F);var H=a('<a class="crayon-tag-editor-button-wrapper"></a>').attr("href",n.content_css);I.after(H);H.append(I);H.colorbox(m)})};j.hide=function(){a.colorbox.close();return false};j.loadDialog=function(s){if(!y){y=true}else{s&&s();return}CrayonUtil.getAJAX({action:"crayon-tag-editor",is_admin:p.is_admin},function(I){z=a('<div id="'+n.css+'"></div>');z.appendTo("body").hide();z.html(I);j.setOrigValues();l=z.find(n.submit_css);h=z.find(n.cancel_css);c=a(n.code_css);u=a("#crayon-te-clear");k=function(){var J=u.is(":visible");if(c.val().length>0&&!J){u.show();c.removeClass(p.selected)}else{if(c.val().length<=0){u.hide()}}};c.keyup(k);c.change(k);u.click(function(){c.val("");c.removeClass(p.selected);c.focus()});var G=a(n.url_css);var F=a(n.url_info_css);var H=CrayonTagEditorSettings.extensions;q=function(){if(G.val().length>0&&!F.is(":visible")){F.show();G.removeClass(p.selected)}else{if(G.val().length<=0){F.hide()}}var L=CrayonUtil.getExt(G.val());if(L){var M=H[L];var K=M?M:L;var J=CrayonTagEditorSettings.fallback_lang;a(n.lang_css+" option").each(function(){if(a(this).val()==K){J=K}});a(n.lang_css).val(J)}};G.keyup(q);G.change(q);var E=function(){var L=a(this);var J=a(this).attr(p.orig_value);if(typeof J=="undefined"){J=""}var M=j.settingValue(L);CrayonUtil.log(L.attr("id")+" value: "+M);var K=null;if(L.is("input[type=checkbox]")){K=L.next("span")}CrayonUtil.log(" >>> "+L.attr("id")+" is "+J+" = "+M);if(J==M){L.removeClass(p.changed);if(K){K.removeClass(p.changed)}}else{L.addClass(p.changed);if(K){K.addClass(p.changed)}}j.settingValue(L,M)};a("."+p.setting+"[id]:not(."+p.special+")").each(function(){a(this).change(E);a(this).keyup(E)});s&&s()})};j.showDialog=function(E){var s=y;j.loadDialog(function(){if(!s){a.colorbox(m)}j._showDialog(E)})};j._showDialog=function(E){E=a.extend({insert:null,edit:null,show:null,hide:j.hide,select:null,editor_str:null,ed:null,node:null,input:null,output:null},E);j.resetSettings();o=E.insert;f=E.edit;r=E.show;A=E.hide;w=E.select;C=E.input;t=E.output;i=E.editor_str;var F=E.node;var F=E.node;D=false;l.unbind();l.click(function(V){j.submitButton();V.preventDefault()});j.setSubmitText(n.submit_add);h.unbind();h.click(function(V){j.hide();V.preventDefault()});if(j.isCrayon(F)){b=a(F);if(b.length!=0){g=b.attr("class");var L=new RegExp("\\b([A-Za-z-]+)"+n.attr_sep+"(\\S+)","gim");var s=L.execAll(g);g=a.trim(g.replace(L,""));var M={};for(var R in s){var J=s[R][1];var N=s[R][2];M[J]=N}var U=b.attr("title");if(U){M.title=U}var H=b.attr("data-url");if(H){M.url=H}if(typeof M.highlight!="undefined"){M.highlight="0"?"1":"0"}D=b.hasClass(n.inline_css);M.inline=D?"1":"0";var S=[];a(n.lang_css+" option").each(function(){var V=a(this).val();if(V){S.push(V)}});if(a.inArray(M.lang,S)==-1){M.lang=n.fallback_lang}M=j.validate(M);for(var O in M){var K=a("#"+p.prefix+O+"."+p.setting);var N=M[O];j.settingValue(K,N);K.change();if(!K.hasClass(p.special)){K.addClass(p.changed);if(K.is("input[type=checkbox]")){highlight=K.next("span");highlight.addClass(p.changed)}}CrayonUtil.log("loaded: "+O+":"+N)}e=true;j.setSubmitText(n.submit_edit);var Q=b.html();if(C=="encode"){Q=CrayonUtil.encode_html(Q)}else{if(C=="decode"){Q=CrayonUtil.decode_html(Q)}}c.val(Q)}else{CrayonUtil.log("cannot load currNode of type pre")}}else{if(w){c.val(w)}e=false;j.setSubmitText(n.submit_add);b=null;g=""}var G=a("#"+n.inline_css);G.change(function(){D=a(this).is(":checked");var V=a("."+n.inline_hide_css);var Z=a("."+n.inline_hide_only_css);var X=[n.mark_css,n.range_css,n.title_css,n.url_css];for(var W in X){var Y=a(X[W]);Y.attr("disabled",D)}if(D){V.hide();Z.hide();V.closest("tr").hide();for(var W in X){var Y=a(X[W]);Y.addClass("crayon-disabled")}}else{V.show();Z.show();V.closest("tr").show();for(var W in X){var Y=a(X[W]);Y.removeClass("crayon-disabled")}}});G.change();var I=e?n.edit_text:n.add_text;a(n.dialog_title_css).html(I);if(r){r()}c.focus();k();q();if(v){clearInterval(v);x=0}var T=a("#TB_window");T.hide();var P=function(){T.show();var V=a(window).scrollTop();a(window).scrollTop(V+10);a(window).scrollTop(V-10)};v=setInterval(function(){if(typeof T!="undefined"&&!T.hasClass("crayon-te-ajax")){T.addClass("crayon-te-ajax");clearInterval(v);P()}if(x>=100){clearInterval(v);P()}x++},40)};j.addCrayon=function(){var E=a(n.url_css);if(E.val().length==0&&c.val().length==0){c.addClass(p.selected);c.focus();return false}c.removeClass(p.selected);var M=a("#"+n.inline_css);D=M.length!=0&&M.is(":checked");var G=br_after="";if(!e){if(!D){if(i=="html"){br_after=G=" \n"}else{br_after="<p>&nbsp;</p>"}}else{if(i=="html"){br_after=G=" "}else{br_after="&nbsp;"}}}var P=(D?"span":"pre");var I=G+"<"+P+" ";var K={};I+='class="';var s=new RegExp("\\b"+n.inline_css+"\\b","gim");if(D){if(s.exec(g)==null){g+=" "+n.inline_css+" "}}else{g=g.replace(s,"")}a("."+p.changed+"[id],."+p.changed+"["+n.data_value+"]").each(function(){var R=a(this).attr("id");var Q=a(this).attr(n.data_value);R=d.removePrefixFromID(R);K[R]=Q});K.lang=a(n.lang_css).val();var H=a(n.mark_css).val();if(H.length!=0&&!D){K.mark=H}var J=a(n.range_css).val();if(J.length!=0&&!D){K.range=J}if(a(n.hl_css).is(":checked")){K.highlight="0"}K.decode="true";K=j.validate(K);for(var F in K){var O=K[F];CrayonUtil.log("add "+F+":"+O);I+=F+n.attr_sep+O+" "}I+=g;I+='" ';if(!D){var N=a(n.title_css).val();if(N.length!=0){I+='title="'+N+'" '}var E=a(n.url_css).val();if(E.length!=0){I+='data-url="'+E+'" '}}var L=a(n.code_css).val();if(t=="encode"){L=CrayonUtil.encode_html(L)}else{if(t=="decode"){L=CrayonUtil.decode_html(L)}}L=typeof L!="undefined"?L:"";I+=">"+L+"</"+P+">"+br_after;if(e&&f){f(I)}else{if(o){o(I)}}return true};j.submitButton=function(){CrayonUtil.log("submit");if(j.addCrayon()!=false){j.hideDialog()}};j.hideDialog=function(){CrayonUtil.log("hide");if(A){A()}};j.setOrigValues=function(){a("."+p.setting+"[id]").each(function(){var s=a(this);s.attr(p.orig_value,j.settingValue(s))})};j.resetSettings=function(){CrayonUtil.log("reset");a("."+p.setting).each(function(){var s=a(this);j.settingValue(s,s.attr(p.orig_value));s.change()});c.val("")};j.settingValue=function(s,E){if(typeof E=="undefined"){E="";if(s.is("input[type=checkbox]")){E=s.is(":checked")?"true":"false"}else{E=s.val()}return E}else{if(s.is("input[type=checkbox]")){if(typeof E=="string"){if(E=="true"||E=="1"){E=true}else{if(E=="false"||E=="0"){E=false}}}s.prop("checked",E)}else{s.val(E)}s.attr(n.data_value,E)}};j.validate=function(G){var s=["range","mark"];for(var E in s){var F=s[E];if(typeof G[F]!="undefined"){G[F]=G[F].replace(/\s/g,"")}}return G};j.isCrayon=function(s){return s!=null&&(s.nodeName=="PRE"||(s.nodeName=="SPAN"&&a(s).hasClass(n.inline_css)))};j.elemValue=function(E){var s=null;if(E.is("input[type=checkbox]")){s=E.is(":checked")}else{s=E.val()}return s};j.setSubmitText=function(s){l.html(s)}}})(jQueryCrayon);