Radarr/NzbDrone.Web/Scripts/2011.3.1115/telerik.grid.resizing.min.js

1 line
2.4 KiB
JavaScript
Raw Normal View History

2011-11-23 01:51:44 +00:00
(function(a){var b=a.telerik;b.scripts.push("telerik.grid.resizing.js");b.resizing={};b.resizing.initialize=function(i){var c,d=a('<div class="t-grid-resize-indicator" />'),j,f,e,l=3;function g(q,r){a("th, th .t-grid-filter, th .t-link",q).add(document.body).css("cursor",r)}function k(q){var r=0;a("> .t-grouping-header, > .t-grid-top",q).each(function(){r+=this.offsetHeight});return r}function n(r){var s=0;a(".t-resize-handle",i.element).each(function(){s+=a(this).data("th").outerWidth();a(this).css("left",s-l)});s=-i.$tbody.closest(".t-grid-content").scrollLeft();r.prevAll("th").add(r).each(function(){s+=this.offsetWidth});var q=i.scrollable?a(".t-grid-content",i.element):a("tbody",i.element);var t=q.attr(i.scrollable?"clientWidth":"offsetWidth");if(s>=t){d.remove()}else{d.css({left:s,top:k(i.element),height:r.outerHeight()+q.attr(i.scrollable?"clientHeight":"offsetHeight")});if(!d.parent().length){d.appendTo(i.element)}}}function o(s){var q=s.$draggable.data("th"),r=i.$tbody.parent();if(!i.scrollable){c=r.children("colgroup").find("col:eq("+q.index()+")")}else{c=i.$header.parent().prev().find("col:eq("+q.index()+")").add(r.children("colgroup").find("col:eq("+q.index()+")"))}e=s.pageX;f=q.outerWidth();j=i.$tbody.outerWidth()}function h(q){var r=f+q.pageX-e;if(r>10){c.css("width",r);if(i.scrollable){i.$tbody.parent().add(i.$headerWrap.find("table")).add(i.$footer.find("table")).css("width",j+q.pageX-e)}n(q.$draggable.data("th"))}}function p(r){d.remove();g(i.element,"");var q=r.$draggable.data("th");var s=q.outerWidth();if(i.onColumnResize&&s!=f){b.trigger(i.element,"columnResize",{column:i.columns[i.$columns().index(q)],oldWidth:f,newWidth:s})}return false}function m(){var s=0,t=i.element.id+"-column-resizing",q;var r=b.draggable.get(t);if(r){r._destroy()}i.$headerWrap.add(i.element).find("> .t-resize-handle").remove();i.$header.find(".t-header:visible").each(function(){s+=this.offsetWidth;var u=a(this);a('<div class="t-resize-handle" />').css({left:s-l,top:i.scrollable?0:k(i.element),width:l*2}).appendTo(i.scrollable?i.$headerWrap:i.element).data("th",u).mousedown(function(){n(u);q=a(this);g(i.element,q.css("cursor"))})});a(document).mouseup(function(){if(q){p({$draggable:q});g(i.element,"");q=null}});new b.draggable({owner:i.element,selector:".t-resize-handle",scope:t,distance:0,start:o,drag:h,stop:p})}m();a(i.element).one("mouseenter",m).bind("repaint",m)}})(jQuery);