All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.scripts.vendor.plugins.tables.colResizable.min.js Maven / Gradle / Ivy

//colResizable - by Alvaro Prieto Lauroba - MIT & GPL
(function ( d ) {
	var A = d( document ), v = "", f = "position", o = ":absolute;", k = "append", E = d( "head" )[k]( v + ".CRZ{table-layout:fixed}.CRZ td,.CRZ th{overflow:hidden}.CRC{height:0px;" + f + ":relative}.CRG{margin-left:-5px;" + f + o + " z-index:5}.CRG .CRZ{" + f + o + "background-color:red;filter:alpha(opacity=1);opacity:0;width:10px;cursor:e-resize;height:100%}.CRL{" + f + o + "width:1px}.CRD{border-left:1px dotted black" + u ), q = null, a = q, e = [], L = 0, n = "id", m = "px", c = "CRZ", B = parseInt, p = Math, C = d.browser.msie, g = false, s = "mousemove.", t = "mouseup.", x = "tr:first ", b = "width", r = "border-", w = "table", y = '
' ); a.o = k; a.g = []; a.c = []; a.w = a[b](); a.d = a.prev(); a.s = B( C ? f.cellSpacing || f[g].borderSpacing : a.css( r + "spacing" ) ) || 2; a.b = B( C ? f.border || f[g].borderLeftWidth : a.css( r + "left-" + b ) ) || 1; e[h] = a; D( a ) } function K( a ) { var b = a[j]( n ), a = e[b]; if ( !a || !a.is( w ) ) { return; } a[h]( c ).d.remove(); delete e[b] } function D( a ) { var e = a.find( x + "th" ), f = "removeAttr"; if ( !e.length ) { e = a.find( x + "td" ); } a.l = e.length; e.each( function ( l ) { var g = d( this ), e = d( a.d[k]( y + 'G">
' )[0].lastChild ); e.t = a; e.i = l; e.c = g; g.w = g[b](); a.g.push( e ); a.c.push( g ); g[b]( g.w )[f]( b ); if ( l < a.l - 1 ) { e.mousedown( J ).html( '
' )[k]( a.o.gripInnerHtml ); } else { e[i]( "CRL" )[h]( "CRG" ); } e.data( c, {i: l, t: a[j]( n )} ) } ); l( a ); a.find( "tr:not(:first)" ).find( "td,th" ).each( function () { d( this )[f]( b ) } ) } function l( a ) { a.d[b]( a.w ); for ( var d, c = 0; c < a.l; c++ ) { d = a.c[c]; a.g[c].css( {left: d.offset().left - a.offset().left + d.outerWidth() + a.s / 2 + m, height: a.outerHeight()} ) } } function z( g, f, j ) { var e = a.x - a.l, d = g.c[f], c = g.c[f + 1], h = d.w + e, i = c.w - e; d[b]( h + m ); c[b]( i + m ); if ( j ) { d.w = h; c.w = i } } function F( i ) { if ( !a ) { return; } var b = a.t, d = i.pageX - a.L + a.l, e = 20, c = a.i, h = b.s * 1.5 + e + b.b, j = c == b.l - 1 ? b.w - h : b.g[c + 1][f]().left - b.s - e, k = c ? b.g[c - 1][f]().left + b.s + e : h; d = p.max( k, p.min( j, d ) ); a.x = d; a.css( "left", d + m ); if ( b.o.liveDrag ) { z( b, c ); l( b ) } return g } function G( f ) { A.unbind( s + c ).unbind( t + c ); d( "head :last-child" ).remove(); if ( !a ) { return; } var b = a[h]( a.t.o.draggingClass ).t, e = b.o.onResize; if ( a.x ) { z( b, a.i, 1 ); l( b ); if ( e ) { f.currentTarget = b[0]; e( f ) } } a = q } function J( o ) { var n = d( this ).data( c ), j = e[n.t], h = j.g[n.i], m = 0, l; h.L = o.pageX; h.l = h[f]().left; A.bind( s + c, F ).bind( t + c, G ); E[k]( v + "*{cursor:e-resize!important" + u ); h[i]( j.o.draggingClass ); a = h; if ( j.c[n.i].l ) { for ( ; m < j.l; m++ ) { l = j.c[m]; l.l = g; l.w = l[b]() } } return g } function I() { for ( a in e ) { var a = e[a], d = 0, f = 0; a[h]( c ); if ( a.w != a[b]() ) { a.w = a[b](); for ( ; d < a.l; d++ ) { f += a.c[d].w; } for ( d = 0; d < a.l; d++ ) { a.c[d].css( b, p.round( 1e3 * a.c[d].w / f ) / 10 + "%" ).l = 1 } } l( a[i]( c ) ) } } d( window ).bind( "resize." + c, I ); d.fn.extend( {colResizable: function ( a ) { var b = {draggingClass: "CRD", gripInnerHtml: "", onResize: q, liveDrag: g, disable: g}, a = d.extend( b, a ); return this.each( function () { H( this, a ) } ) }} ) })( jQuery )




© 2015 - 2024 Weber Informatics LLC | Privacy Policy