CKEDITOR.plugins.add('button',{beforeInit:function(a){a.ui.addHandler(CKEDITOR.UI_BUTTON,CKEDITOR.ui.button.handler);}});CKEDITOR.UI_BUTTON='button';CKEDITOR.ui.button=function(a){CKEDITOR.tools.extend(this,a,{title:a.label,className:a.className||a.command&&'cke_button_'+a.command||'',click:a.click||(function(b){b.execCommand(a.command);})});this._={};};CKEDITOR.ui.button.handler={create:function(a){return new CKEDITOR.ui.button(a);}};(function(){CKEDITOR.ui.button.prototype={render:function(a,b){var c=CKEDITOR.env,d=this._.id=CKEDITOR.tools.getNextId(),e='',f=this.command,g;this._.editor=a;var h={id:d,button:this,editor:a,focus:function(){var n=CKEDITOR.document.getById(d);n.focus();},execute:function(){this.button.click(a);}},i=CKEDITOR.tools.addFunction(function(n){if(h.onkey){n=new CKEDITOR.dom.event(n);return h.onkey(h,n.getKeystroke())!==false;}}),j=CKEDITOR.tools.addFunction(function(n){var o;if(h.onfocus)o=h.onfocus(h,new CKEDITOR.dom.event(n))!==false;if(CKEDITOR.env.gecko&&CKEDITOR.env.version<10900)n.preventBubble();return o;});h.clickFn=g=CKEDITOR.tools.addFunction(h.execute,h);if(this.modes){var k={};function l(){var n=a.mode;if(n){var o=this.modes[n]?k[n]!=undefined?k[n]:CKEDITOR.TRISTATE_OFF:CKEDITOR.TRISTATE_DISABLED;this.setState(a.readOnly&&!this.readOnly?CKEDITOR.TRISTATE_DISABLED:o);}};a.on('beforeModeUnload',function(){if(a.mode&&this._.state!=CKEDITOR.TRISTATE_DISABLED)k[a.mode]=this._.state;},this);a.on('mode',l,this);!this.readOnly&&a.on('readOnly',l,this);}else if(f){f=a.getCommand(f);if(f){f.on('state',function(){this.setState(f.state);},this);e+='cke_'+(f.state==CKEDITOR.TRISTATE_ON?'on':f.state==CKEDITOR.TRISTATE_DISABLED?'disabled':'off');}}if(!f)e+='cke_off';if(this.className)e+=' '+this.className;b.push('<span class="cke_button'+(this.icon&&this.icon.indexOf('.png')==-1?' cke_noalphafix':'')+'">','<a id="',d,'" class="',e,'"',c.gecko&&c.version>=10900&&!c.hc?'':'" href="javascript:void(\''+(this.title||'').replace("'",'')+"')\"",' title="',this.title,'" tabindex="-1" hidefocus="true" role="button" aria-labelledby="'+d+'_label"'+(this.hasArrow?' aria-haspopup="true"':''));if(c.opera||c.gecko&&c.mac)b.push(' onkeypress="return false;"');if(c.gecko)b.push(' onblur="this.style.cssText = this.style.cssText;"');b.push(' onkeydown="return CKEDITOR.tools.callFunction(',i,', event);" onfocus="return CKEDITOR.tools.callFunction(',j,', event);" onclick="CKEDITOR.tools.callFunction(',g,', this); return false;"><span class="cke_icon"');if(this.icon){var m=(this.iconOffset||0)*-16;
b.push(' style="background-image:url(',CKEDITOR.getUrl(this.icon),');background-position:0 '+m+'px;"');}b.push('>&nbsp;</span><span id="',d,'_label" class="cke_label">',this.label,'</span>');if(this.hasArrow)b.push('<span class="cke_buttonarrow">'+(CKEDITOR.env.hc?'&#9660;':'&nbsp;')+'</span>');b.push('</a>','</span>');if(this.onRender)this.onRender();return h;},setState:function(a){if(this._.state==a)return false;this._.state=a;var b=CKEDITOR.document.getById(this._.id);if(b){b.setState(a);a==CKEDITOR.TRISTATE_DISABLED?b.setAttribute('aria-disabled',true):b.removeAttribute('aria-disabled');a==CKEDITOR.TRISTATE_ON?b.setAttribute('aria-pressed',true):b.removeAttribute('aria-pressed');return true;}else return false;}};})();CKEDITOR.ui.prototype.addButton=function(a,b){this.add(a,CKEDITOR.UI_BUTTON,b);};
