!function(){CKEDITOR.plugins.add("codemirror",{lang:"af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en-au,en-ca,en-gb,en,eo,es,et,eu,fa,fi,fo,fr-ca,fr,gl,gu,he,hi,hr,hu,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt-br,pt,ro,ru,sk,sl,sr-latn,sr,sv,th,tr,ug,uk,vi,zh-cn,zh",init:function(t){var o=this.path,i=t.config,r=null!=i.codemirror_theme?i.codemirror_theme:"default";if(CKEDITOR.document.appendStyleSheet(o+"css/codemirror.css"),r.length&&"default"!=r&&CKEDITOR.document.appendStyleSheet(o+"theme/"+r+".css"),CKEDITOR.scriptLoader.load(o+"js/codemirror.js",function(e){CKEDITOR.scriptLoader.load([o+"js/xml.js",o+"js/javascript.js",o+"js/css.js",o+"js/htmlmixed.js"])}),t.elementMode!=CKEDITOR.ELEMENT_MODE_INLINE){var n=CKEDITOR.plugins.sourcearea;t.addMode("source",function(o){var i=t.ui.space("contents").getDocument().createElement("textarea");i.setStyles(CKEDITOR.tools.extend({width:CKEDITOR.env.ie7Compat?"99%":"100%",height:"100%",resize:"none",outline:"none","text-align":"left"},CKEDITOR.tools.cssVendorPrefix("tab-size",t.config.sourceAreaTabSize||4)));var n=[t.lang.editor,t.name].join(",");i.setAttributes({dir:"ltr",tabIndex:CKEDITOR.env.webkit?-1:t.tabIndex,role:"textbox","aria-label":n}),i.addClass("cke_source cke_reset cke_enable_context_menu"),t.ui.space("contents").append(i),window["editable_"+t.id]=t.editable(new e(t,i)),window["editable_"+t.id].setData(t.getData(1)),window["editable_"+t.id].editorID=t.id,t.fire("ariaWidget",this);var a,d=window["editable_"+t.id],s=d.getParent(),c=s.$.clientHeight+"px",l=s.$.clientWidth+"px";codemirror=t.id,window["codemirror_"+t.id]=CodeMirror.fromTextArea(d.$,{mode:"text/html",matchBrackets:!0,workDelay:300,workTime:35,lineNumbers:!0,lineWrapping:!0,theme:r}),window["codemirror_"+t.id].on("change",function(e,o){clearTimeout(a),a=setTimeout(function(){window["codemirror_"+t.id].save()},300)}),window["codemirror_"+t.id].setSize(l,c),o()}),t.addCommand("source",n.commands.source),t.ui.addButton&&t.ui.addButton("Source",{label:t.lang.codemirror.toolbar,command:"source",toolbar:"mode,10"}),t.on("mode",function(){t.getCommand("source").setState("source"==t.mode?CKEDITOR.TRISTATE_ON:CKEDITOR.TRISTATE_OFF)}),t.on("resize",function(){if(window["editable_"+t.id]){var e=window["editable_"+t.id].getParent(),o=e.$.clientHeight+"px",i=e.$.clientWidth+"px";window["codemirror_"+t.id].setSize(i,o)}})}}});var e=CKEDITOR.tools.createClass({base:CKEDITOR.editable,proto:{setData:function(e){this.setValue(e),this.editor.fire("dataReady")},getData:function(){return this.getValue()},insertHtml:function(){},insertElement:function(){},insertText:function(){},setReadOnly:function(e){this[(e?"set":"remove")+"Attribute"]("readOnly","readonly")},editorID:null,detach:function(){window["codemirror_"+this.editorID].toTextArea(),e.baseProto.detach.call(this),this.clearCustomData(),this.remove()}}})}(),CKEDITOR.plugins.sourcearea={commands:{source:{modes:{wysiwyg:1,source:1},editorFocus:!1,readOnly:1,exec:function(e){"wysiwyg"==e.mode&&e.fire("saveSnapshot"),e.getCommand("source").setState(CKEDITOR.TRISTATE_DISABLED),e.setMode("source"==e.mode?"wysiwyg":"source")},canUndo:!1}}};