/* Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ (function(){function t(a){return CKEDITOR.env.ie?a.$.clientWidth:parseInt(a.getComputedStyle("width"),10)}function n(a,h){var b=a.getComputedStyle("border-"+h+"-width"),j={thin:"0px",medium:"1px",thick:"2px"};0>b.indexOf("px")&&(b=b in j&&"none"!=a.getComputedStyle("border-style")?j[b]:0);return parseInt(b,10)}function w(a){var h=[],b=-1,j="rtl"==a.getComputedStyle("direction"),c;c=a.$.rows;for(var p=0,g,d,e,i=0,o=c.length;ip&&(p=g,d=e);c=d;p=new CKEDITOR.dom.element(a.$.tBodies[0]); g=p.getDocumentPosition();d=0;for(e=c.cells.length;d',d);a.on("destroy",function(){e.remove()});s||d.getDocumentElement().append(e);this.attachTo=function(a){i|| (s&&(d.getBody().append(e),k=0),g=a,e.setStyles({width:f(a.width),height:f(a.height),left:f(a.x),top:f(a.y)}),s&&e.setOpacity(0.25),e.on("mousedown",j,this),d.getBody().setStyle("cursor","col-resize"),e.show())};var r=this.move=function(a){if(!g)return 0;if(!i&&(ag.x+g.width))return g=null,i=k=0,d.removeListener("mouseup",c),e.removeListener("mousedown",j),e.removeListener("mousemove",p),d.getBody().setStyle("cursor","auto"),s?e.remove():e.hide(),0;a-=Math.round(e.$.offsetWidth/2);if(i){if(a== y||a==z)return 1;a=Math.max(a,y);a=Math.min(a,z);k=a-o}e.setStyle("left",f(a));return 1}}function r(a){var h=a.data.getTarget();if("mouseout"==a.name){if(!h.is("table"))return;for(var b=new CKEDITOR.dom.element(a.data.$.relatedTarget||a.data.$.toElement);b&&b.$&&!b.equals(h)&&!b.is("body");)b=b.getParent();if(!b||b.equals(h))return}h.getAscendant("table",1).removeCustomData("_cke_table_pillars");a.removeListener()}var f=CKEDITOR.tools.cssLength,s=CKEDITOR.env.ie&&(CKEDITOR.env.ie7Compat||CKEDITOR.env.quirks); CKEDITOR.plugins.add("tableresize",{requires:"tabletools",init:function(a){a.on("contentDom",function(){var h,b=a.editable();b.attachListener(b.isInline()?b:a.document,"mousemove",function(b){var b=b.data,c=b.getTarget();if(c.type==CKEDITOR.NODE_ELEMENT){var f=b.getPageOffset().x;if(h&&h.move(f))u(b);else if(c.is("table")||c.getAscendant("tbody",1))if(c=c.getAscendant("table",1),a.editable().contains(c)){if(!(b=c.getCustomData("_cke_table_pillars")))c.setCustomData("_cke_table_pillars",b=w(c)),c.on("mouseout", r),c.on("mousedown",r);a:{for(var c=0,g=b.length;c=d.x&&f<=d.x+d.width){f=d;break a}}f=null}f&&(!h&&(h=new A(a)),h.attachTo(f))}}})})}})})();