mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-23 08:13:01 +00:00
1 line
2 KiB
JavaScript
1 line
2 KiB
JavaScript
|
(function(a){var b=a.telerik;b.resizing={};b.resizing.initialize=function(r){var d,p=a('<div class="t-grid-resize-indicator" />'),k,e,j,n=3;function o(s,t){a("th, th .t-grid-filter, th .t-link",s).add(document.body).css("cursor",t)}function m(s){var t=0;a(".t-grouping-header, .t-grid-toolbar",s).each(function(){t+=this.offsetHeight});return t}function g(v){var t=0;a(".t-resize-handle",r.element).each(function(){t+=a(this).data("th").outerWidth();a(this).css("left",t-n)});t=-r.$tbody.closest(".t-grid-content").scrollLeft();v.prevAll("th").add(v).each(function(){t+=this.offsetWidth});var s=r.scrollable?a(".t-grid-content",r.element):a("tbody",r.element);var u=s.attr(r.scrollable?"clientWidth":"offsetWidth");if(t>=u){p.remove()}else{p.css({left:t,top:m(r.element),height:v.outerHeight()+s.attr(r.scrollable?"clientHeight":"offsetHeight")});if(!p.parent().length){p.appendTo(r.element)}}}function q(s){return true}function i(t,u){var s=u.data("th");d=a("colgroup",r.element).find("col:eq("+s.index()+")");j=t.pageX;e=s.outerWidth();k=r.$tbody.outerWidth()}function l(t,u){var s=e+t.pageX-j;if(s>10){d.css("width",s);if(r.scrollable){r.$tbody.parent().add(r.$headerWrap.find("table")).css("width",k+t.pageX-j)}g(u.data("th"))}}function f(s,t){p.remove();o(r.element,"")}function c(v,w,t){f();var u=w.data("th");var s=u.outerWidth();if(r.onColumnResize&&s!=e){b.trigger(r.element,"columnResize",{column:r.columns[r.$columns().index(u)],oldWidth:e,newWidth:s})}return true}var h=0;a(".t-header",r.element).each(function(){h+=this.offsetWidth;var s=a(this);if(!s.hasClass("t-group-cell")){a('<div class="t-resize-handle" />').css({left:h-n,top:r.scrollable?0:m(r.element),width:n*2}).appendTo(r.scrollable?r.$headerWrap:r.element).data("th",s).mousedown(function(){g(s);o(r.element,a(this).css("cursor"))}).mouseup(function(){o(r.element,"")})}});b.draganddrop(r.element.id+"Resize",{draggables:a(".t-resize-handle",r.element),hitTestOffset:0,shouldDrag:q,onDragStart:i,onDragMove:l,onDragCancelled:f,onDrop:c})}})(jQuery);
|