2013-01-04 18:10:17 +00:00
/*! tableSorter 2.4+ widgets - updated 1/4/2013 */
; ( function ( b ) {
b . tablesorter = b . tablesorter || { } ;
b . tablesorter . themes = { bootstrap : { table : "table table-bordered table-striped" , header : "bootstrap-header" , footerRow : "" , footerCells : "" , icons : "" , sortNone : "bootstrap-icon-unsorted" , sortAsc : "icon-chevron-up" , sortDesc : "icon-chevron-down" , active : "" , hover : "" , filterRow : "" , even : "" , odd : "" } , jui : { table : "ui-widget ui-widget-content ui-corner-all" , header : "ui-widget-header ui-corner-all ui-state-default" , footerRow : "" , footerCells : "" , icons : "ui-icon" , sortNone : "ui-icon-carat-2-n-s" , sortAsc : "ui-icon-carat-1-n" , sortDesc : "ui-icon-carat-1-s" , active : "ui-state-active" , hover : "ui-state-hover" , filterRow : "" , even : "ui-widget-content" , odd : "ui-state-default" } } ;
b . tablesorter . storage = function ( d , a , e ) { var c , j = ! 1 ; c = { } ; var f = d . id || b ( ".tablesorter" ) . index ( b ( d ) ) , h = window . location . pathname ; try { j = ! ! localStorage . getItem } catch ( n ) { } b . parseJSON && ( j ? c = b . parseJSON ( localStorage [ a ] ) || { } : ( c = document . cookie . split ( /[;\s|=]/ ) , d = b . inArray ( a , c ) + 1 , c = 0 !== d ? b . parseJSON ( c [ d ] ) || { } : { } ) ) ; if ( ( e || "" === e ) && window . JSON && JSON . hasOwnProperty ( "stringify" ) ) c [ h ] || ( c [ h ] = { } ) , c [ h ] [ f ] = e , j ? localStorage [ a ] = JSON . stringify ( c ) : ( d = new Date , d . setTime ( d . getTime ( ) + 31536E6 ) , document . cookie = a + "=" + JSON . stringify ( c ) . replace ( /\"/g , '"' ) + "; expires=" + d . toGMTString ( ) + "; path=/" ) ; else return c && c [ h ] ? c [ h ] [ f ] : { } } ;
b . tablesorter . addWidget ( { id : "uitheme" , format : function ( d ) { var a , e , c , j , f = b . tablesorter . themes , h = b ( d ) , n = d . config , p = n . widgetOptions , q = "default" !== n . theme ? n . theme : p . uitheme || "jui" , g = f [ f [ q ] ? q : f [ p . uitheme ] ? p . uitheme : "jui" ] , m = b ( n . headerList ) , r = "tr." + ( p . stickyHeaders || "tablesorter-stickyHeader" ) , s = g . sortNone + " " + g . sortDesc + " " + g . sortAsc ; n . debug && ( a = new Date ) ; if ( ! h . hasClass ( "tablesorter-" + q ) || n . theme === q || ! d . hasInitialized ) "" !== g . even && ( p . zebra [ 0 ] += " " + g . even ) , "" !== g . odd && ( p . zebra [ 1 ] += " " + g . odd ) , f = h . removeClass ( "" === n . theme ? "" : "tablesorter-" + n . theme ) . addClass ( "tablesorter-" + q + " " + g . table ) . find ( "tfoot" ) , f . length && f . find ( "tr" ) . addClass ( g . footerRow ) . children ( "th, td" ) . addClass ( g . footerCells ) , m . addClass ( g . header ) . filter ( ":not(.sorter-false)" ) . hover ( function ( ) { b ( this ) . addClass ( g . hover ) } , function ( ) { b ( this ) . removeClass ( g . hover ) } ) , m . find ( ".tablesorter-wrapper" ) . length || m . wrapInner ( '<div class="tablesorter-wrapper" style="position:relative;height:100%;width:100%"></div>' ) , n . cssIcon && m . find ( "." + n . cssIcon ) . addClass ( g . icons ) , h . hasClass ( "hasFilters" ) && m . find ( ".tablesorter-filter-row" ) . addClass ( g . filterRow ) ; b . each ( m , function ( a ) { c = b ( this ) ; j = n . cssIcon ? c . find ( "." + n . cssIcon ) : c ; this . sortDisabled ? ( c . removeClass ( s ) , j . removeClass ( s + " tablesorter-icon " + g . icons ) ) : ( f = h . hasClass ( "hasStickyHeaders" ) ? h . find ( r ) . find ( "th" ) . eq ( a ) . add ( c ) : c , e = c . hasClass ( n . cssAsc ) ? g . sortAsc : c . hasClass ( n . cssDesc ) ? g . sortDesc : c . hasClass ( n . cssHeader ) ? g . sortNone : "" , c [ e === g . sortNone ? "removeClass" : "addClass" ] ( g . active ) , j . removeClass ( s ) . addClass ( e ) ) } ) ; n . debug && b . tablesorter . benchmark ( "Applying " + q + " theme" , a ) } , remove : function ( d , a , e ) { d = b ( d ) ; var c = "object" === typeof e . uitheme ? "jui" : e . uitheme || "jui" ; e = "object" === typeof e . uitheme ? e . uitheme : b . tablesorter . themes [ b . tablesorter . themes . hasOwnProperty ( c ) ? c : "jui" ] ; var j = d . children ( "thead" ) . children ( ) , f = e . sortNone + " " + e . sortDesc + " " + e . sortAsc ; d . removeClass ( "tablesorter-" + c + " " + e . table ) . find ( a . cssHeader ) . removeClass ( e . header ) ; j . unbind ( "mouseenter mouseleave" ) . removeClass ( e . hover + " " + f + " " + e . active ) . find ( ".tablesorter-filter-row" ) . removeClass ( e . filterRow ) ; j . find ( ".tablesorter-icon" ) . removeClass ( e . icons ) } } ) ;
b . tablesorter . addWidget ( { id : "columns" , format : function ( d ) { var a , e , c , j , f , h , n , p , q , g = b ( d ) , m = d . config , r = m . widgetOptions , s = m . $tbodies , u = m . sortList , w = u . length , l = [ "primary" , "secondary" , "tertiary" ] , l = m . widgetColumns && m . widgetColumns . hasOwnProperty ( "css" ) ? m . widgetColumns . css || l : r && r . hasOwnProperty ( "columns" ) ? r . columns || l : l ; h = l . length - 1 ; n = l . join ( " " ) ; m . debug && ( f = new Date ) ; for ( q = 0 ; q < s . length ; q ++ ) a = b . tablesorter . processTbody ( d , s . eq ( q ) , ! 0 ) , e = a . children ( "tr" ) , e . each ( function ( ) { j = b ( this ) ; if ( "none" !== this . style . display && ( c = j . children ( ) . removeClass ( n ) , u && u [ 0 ] && ( c . eq ( u [ 0 ] [ 0 ] ) . addClass ( l [ 0 ] ) , 1 < w ) ) ) for ( p = 1 ; p < w ; p ++ ) c . eq ( u [ p ] [ 0 ] ) . addClass ( l [ p ] || l [ h ] ) } ) , b . tablesorter . processTbody ( d , a , ! 1 ) ; e = ! 1 !== r . columns _thead ? "thead tr" : "" ; ! 1 !== r . columns _tfoot && ( e += ( "" === e ? "" : "," ) + "tfoot tr" ) ; if ( e . length && ( j = g . find ( e ) . children ( ) . removeClass ( n ) , u && u [ 0 ] && ( j . filter ( '[data-column="' + u [ 0 ] [ 0 ] + '"]' ) . addClass ( l [ 0 ] ) , 1 < w ) ) ) for ( p = 1 ; p < w ; p ++ ) j . filter ( '[data-column="' + u [ p ] [ 0 ] + '"]' ) . addClass ( l [ p ] || l [ h ] ) ; m . debug && b . tablesorter . benchmark ( "Applying Columns widget" , f ) } , remove : function ( d , a ) { var e , c , j = a . $tbodies , f = ( a . widgetOptions . columns || [ "primary" , "secondary" , "tertiary" ] ) . join ( " " ) ; a . $headers . removeClass ( f ) ; b ( d ) . children ( "tfoot" ) . children ( "tr" ) . children ( "th, td" ) . removeClass ( f ) ; for ( e = 0 ; e < j . length ; e ++ ) c = b . tablesorter . processTbody ( d , j . eq ( e ) , ! 0 ) , c . children ( "tr" ) . each ( function ( ) { b ( this ) . children ( ) . removeClass ( f ) } ) , b . tablesorter . processTbody ( d , c , ! 1 ) } } ) ;
b . tablesorter . addWidget ( { id : "filter" , format : function ( d ) { if ( d . config . parsers && ! b ( d ) . hasClass ( "hasFilters" ) ) { var a , e , c , j , f , h , n , p , q , g , m , r , s , u , w , l , y , G = "" , A = b . tablesorter , t = d . config , B = b ( t . headerList ) , k = t . widgetOptions , z = k . filter _cssFilter || "tablesorter-filter" , v = b ( d ) . addClass ( "hasFilters" ) , E = t . $tbodies , F = t . parsers . length , C = [ /^\/((?:\\\/|[^\/])+)\/([mig]{0,3})?$/ , RegExp ( t . cssChildRow ) , /undefined|number/ , /(^[\"|\'|=])|([\"|\'|=]$)/ , /[\"\'=]/g , /[^\w,. \-()]/g , /[<>=]/g ] , M = B . map ( function ( a ) { return A . getData ? "parsed" === A . getData ( B . filter ( '[data-column="' + a + '"]:last' ) , t . headers [ a ] , "filter" ) : b ( this ) . hasClass ( "filter-parsed" ) } ) . get ( ) , H , I , D = function ( a ) { var c = b . isArray ( a ) , e = v . find ( "thead" ) . eq ( 0 ) . children ( "tr" ) . find ( "select." + z + ", input." + z ) , d = c ? a : e . map ( function ( ) { return b ( this ) . val ( ) || "" } ) . get ( ) , f = ( d || [ ] ) . join ( "" ) ; c && e . each ( function ( c , d ) { b ( d ) . val ( a [ c ] || "" ) } ) ; ! 0 === k . filter _hideFilters && v . find ( ".tablesorter-filter-row" ) . trigger ( "" === f ? "mouseleave" : "mouseenter" ) ; if ( ! ( G === f && ! 1 !== a ) ) if ( v . trigger ( "filterStart" , [ d ] ) , t . showProcessing ) setTimeout ( function ( ) { J ( a , d , f ) ; return ! 1 } , 30 ) ; else return J ( a , d , f ) , ! 1 } , J = function ( j , g , h ) { var m , q , s , r , y , x , z ; t . debug && ( z = new Date ) ; for ( c = 0 ; c < E . length ; c ++ ) { j = b . tablesorter . processTbody ( d , E . eq ( c ) , ! 0 ) ; m = j . children ( "tr" ) ; y = m . length ; if ( "" === h || k . filter _serversideFiltering ) m . show ( ) . removeClass ( "filtered" ) ; else for ( e = 0 ; e < y ; e ++ ) if ( ! C [ 1 ] . test ( m [ e ] . className ) ) { r = ! 0 ; s = m . eq ( e ) . nextUntil ( "tr:not(." + t . cssChildRow + ")" ) ; l = s . length && ( k && k . hasOwnProperty ( "filter_childRows" ) && "undefined" !== typeof k . filter _childRows ? k . filter _childRows : 1 ) ? s . text ( ) : "" ; l = k . filter _ignoreCase ? l . toLocaleLowerCase ( ) : l ; q = m . eq ( e ) . children ( "td" ) ; for ( a = 0 ; a < F ; a ++ ) if ( g [ a ] ) { n = k . filter _useParsedData || M [ a ] ? t . cache [ c ] . normalized [ e ] [ a ] : b . trim ( q . eq ( a ) . text ( ) ) ; p = ! C [ 2 ] . test ( typeof n ) && k . filter _ignoreCase ? n . toLocaleLowerCase ( ) : n ; x = r ; f = k . filter _ignoreCase ? g [ a ] . toLocaleLowerCase ( ) : g [ a ] ; if ( k . filter _functions && k . filter _functions [ a ] ) ! 0 === k . filter _functions [ a ] ? x = B . filter ( '[data-column="' + a + '"]:last' ) . hasClass ( "filter-match" ) ? 0 <= p . search ( f ) : g [ a ] === n : "function" === typeof k . filter _functions [ a ] ? x = k . filter _functions [ a ] ( n , t . cache [ c ] . normalized [ e ] [ a ] , g [ a ] , a ) : "function" === typeof k . filter _functions [ a ] [ g [ a ] ] && ( x = k . filter _functions [ a ] [ g [ a ] ] ( n , t . cache [ c ] . normalized [ e ] [ a ] , g [ a ] , a ) ) ; else if ( C [ 0 ] . test ( f ) ) { u = C [ 0 ] . exec ( f ) ; try { x = RegExp ( u [ 1 ] , u [ 2 ] ) . test ( p ) } catch ( D ) { x = ! 1 } } else C [ 3 ] . test ( f ) && p === f . replace ( C [ 4 ] , "" ) ? x = ! 0 : /^\!/ . test ( f ) ? ( f = f . replace ( "!" , "" ) , w = p . search ( b . trim ( f ) ) , x = "" === f ? ! 0 : ! ( k . filter _startsWith ? 0 === w : 0 <= w ) ) : /^[<>]=?/ . test ( f ) ? ( u = isNaN ( p ) ? b . tablesorter . formatFloat ( p . replace ( C [ 5 ] , "" ) , d ) : b . tablesorter . formatFloat ( p , d ) , w = b . tablesorter . formatFloat ( f . replace ( C [ 5 ] , "" ) . replace ( C [ 6 ] , "" ) , d ) , />/ . test ( f ) && ( x = />=/ . test ( f ) ? u >= w : u > w ) , /</ . test ( f ) && ( x = /<=/ . test ( f ) ? u <= w : u < w ) ) : /[\?|\*]/ . test ( f ) ? x = RegExp ( f . replace ( /\?/g , "\\S{1}" ) . replace ( /\*/g , "\\S*" ) ) . test ( p ) : ( n = ( p + l ) . indexOf ( f ) , x = ! k . filter _startsWith && 0 <= n || k . filter _startsWith && 0 === n ) ; r = x ? r ? ! 0 : ! 1 : ! 1 } m [ e ] . style . display = r ? "" : "none" ; m . eq ( e ) [ r ? "removeClass" : "addClass" ] ( "filtered" ) ; if ( s . length ) s [ r ? "show" : "hide" ] ( ) } b . tablesorter . processTbody ( d , j , ! 1 ) } G = h ; t . debug && A . benchmark ( "Completed filter widget search" , z ) ; v . trigger ( "applyWidgets" ) ; v . trigger ( "filterEnd" ) } , K = function ( a , f ) { var g , h = [ ] ; a = parseInt ( a , 10 ) ; g = '<option value="">' + ( B . filter ( '[data-column="' + a + '"]:last' ) . attr ( "data-placeholder" ) || "" ) + "</option>" ; for ( c = 0 ; c < E . length ; c ++ ) { j = t . cache [ c ] . row . length ; for ( e = 0 ; e < j ; e ++ ) k . filter _useParsedData ? h . push ( "" + t . cache [ c ] . normalized [ e ] [ a ] ) : ( l = t . cache [ c ] . row [ e ] [ 0 ] . cells [ a ] ) && h . push ( b . trim ( t . supportsTextContent ? l . textContent : b ( l ) . text ( ) ) ) } h = b . grep ( h , function ( a , c ) { return b . inArray ( a , h ) === c } ) ; h = A . sortText ? h . sort ( function ( b , c ) { return A . sortText ( d , b , c , a ) } ) : h . sort ( ! 0 ) ; for ( c = 0 ; c < h . length ; c ++ ) g += '<option value="' + h [ c ] + '">' + h [ c ] + "</option>" ; v . find ( "thead" ) . find ( "select." + z + '[data-column="' + a + '"]' ) [ f ? "html" : "append" ] ( g ) } , L = function ( b ) { for ( a = 0 ; a < F ; a ++ ) l = B . filter ( '[data-column="' + a + '"]:last' ) , l . hasClass ( "filter-select" ) && ( ! l . hasClass ( "filter-false" ) && ! ( k . filter _functions && ! 0 === k . filter _functions [ a ] ) ) && ( k . filter _functions || ( k . filter _functions = { } ) , k . filter _functions [ a ] = ! 0 , K ( a , b ) ) } ; t .
b . tablesorter . addWidget ( { id : "stickyHeaders" , format : function ( d ) { if ( ! b ( d ) . hasClass ( "hasStickyHeaders" ) ) { var a = b ( d ) . addClass ( "hasStickyHeaders" ) , e = d . config , c = e . widgetOptions , j = b ( window ) , f = b ( d ) . children ( "thead:first" ) , h = f . children ( "tr:not(.sticky-false)" ) . children ( ) ; d = c . stickyHeaders || "tablesorter-stickyHeader" ; var n = h . eq ( 0 ) . parent ( ) , p = a . find ( "tfoot" ) , c = c . $sticky = a . clone ( ) , q = c . children ( "thead:first" ) . addClass ( d ) . css ( { width : f . outerWidth ( ! 0 ) , position : "fixed" , margin : 0 , top : 0 , visibility : "hidden" , zIndex : 1 } ) , g = q . children ( "tr:not(.sticky-false)" ) . children ( ) , m = "" , r = 0 , s = function ( ) { var c = navigator . userAgent ; r = 0 ; "collapse" !== a . css ( "border-collapse" ) && ! /(webkit|msie)/i . test ( c ) && ( r = 2 * parseInt ( h . eq ( 0 ) . css ( "border-left-width" ) , 10 ) ) ; q . css ( { left : f . offset ( ) . left - j . scrollLeft ( ) - r , width : f . outerWidth ( ) } ) ; g . each ( function ( a ) { a = h . eq ( a ) ; b ( this ) . css ( { width : a . width ( ) - r , height : a . height ( ) } ) } ) . find ( ".tablesorter-header-inner" ) . each ( function ( a ) { a = h . eq ( a ) . find ( ".tablesorter-header-inner" ) . width ( ) ; b ( this ) . width ( a ) } ) } ; c . find ( "thead:gt(0),tr.sticky-false,tbody,tfoot,caption" ) . remove ( ) ; c . css ( { height : 0 , width : 0 , padding : 0 , margin : 0 , border : 0 } ) ; q . find ( "tr.sticky-false" ) . remove ( ) ; g . find ( ".tablesorter-resizer" ) . remove ( ) ; a . bind ( "sortEnd.tsSticky" , function ( ) { h . each ( function ( a ) { a = g . eq ( a ) ; a . attr ( "class" , b ( this ) . attr ( "class" ) ) ; e . cssIcon && a . find ( "." + e . cssIcon ) . attr ( "class" , b ( this ) . find ( "." + e . cssIcon ) . attr ( "class" ) ) } ) } ) . bind ( "pagerComplete.tsSticky" , function ( ) { s ( ) } ) ; h . find ( "*" ) . andSelf ( ) . filter ( e . selectorSort ) . each ( function ( a ) { var c = b ( this ) ; g . eq ( a ) . bind ( "mouseup" , function ( a ) { c . trigger ( a , ! 0 ) } ) . bind ( "mousedown" , function ( ) { this . onselectstart = function ( ) { return ! 1 } ; return ! 1 } ) } ) ; a . after ( c ) ; j . bind ( "scroll.tsSticky" , function ( ) { var b = n . offset ( ) , c = j . scrollTop ( ) , d = a . height ( ) - ( q . height ( ) + ( p . height ( ) || 0 ) ) , b = c > b . top && c < b . top + d ? "visible" : "hidden" ; q . css ( { left : f . offset ( ) . left - j . scrollLeft ( ) - r , visibility : b } ) ; b !== m && ( s ( ) , m = b ) } ) . bind ( "resize.tsSticky" , function ( ) { s ( ) } ) } } , remove : function ( d , a , e ) { d = b ( d ) ; a = e . stickyHeaders || "tablesorter-stickyHeader" ; d . removeClass ( "hasStickyHeaders" ) . unbind ( "sortEnd.tsSticky pagerComplete.tsSticky" ) . find ( "." + a ) . remove ( ) ; e . $sticky && e . $sticky . remove ( ) ; b ( window ) . unbind ( "scroll.tsSticky resize.tsSticky" ) } } ) ; b . tablesorter . addWidget ( { id : "resizable" , format : function ( d ) { if ( ! b ( d ) . hasClass ( "hasResizable" ) ) { b ( d ) . addClass ( "hasResizable" ) ; var a , e , c , j , f , h = b ( d ) , n = d . config , p = n . widgetOptions , q = 0 , g = null , m = null , r = function ( ) { q = 0 ; g = m = null ; b ( window ) . trigger ( "resize" ) } ; if ( c = b . tablesorter . storage && ! 1 !== p . resizable ? b . tablesorter . storage ( d , "tablesorter-resizable" ) : { } ) for ( e in c ) ! isNaN ( e ) && e < n . headerList . length && b ( n . headerList [ e ] ) . width ( c [ e ] ) ; h . children ( "thead:first" ) . find ( "tr" ) . each ( function ( ) { j = b ( this ) . children ( ) ; b ( this ) . find ( ".tablesorter-wrapper" ) . length || j . wrapInner ( '<div class="tablesorter-wrapper" style="position:relative;height:100%;width:100%"></div>' ) ; j = j . slice ( 0 , - 1 ) ; f = f ? f . add ( j ) : j } ) ; f . each ( function ( ) { a = b ( this ) ; e = parseInt ( a . css ( "padding-right" ) , 10 ) + 8 ; a . find ( ".tablesorter-wrapper" ) . append ( '<div class="tablesorter-resizer" style="cursor:w-resize;position:absolute;height:100%;width:16px;right:-' + e + 'px;top:0;z-index:1;"></div>' ) } ) . bind ( "mousemove.tsresize" , function ( a ) { if ( 0 !== q && g ) { var b = a . pageX - q ; g . width ( g . width ( ) + b ) ; m . width ( m . width ( ) - b ) ; q = a . pageX } } ) . bind ( "mouseup.tsresize" , function ( ) { b . tablesorter . storage && g && ( c [ g . index ( ) ] = g . width ( ) , c [ m . index ( ) ] = m . width ( ) , ! 1 !== p . resizable && b . tablesorter . storage ( d , "tablesorter-resizable" , c ) ) ; r ( ) } ) . find ( ".tablesorter-resizer" ) . bind ( "mousedown" , function ( a ) { g = b ( a . target ) . parents ( "th:last" ) ; m = g . next ( ) ; q = a . pageX } ) ; h . find ( "thead:first" ) . bind ( "mouseup.tsresize mouseleave.tsresize" , function ( ) { r ( ) } ) . bind ( "contextmenu.tsresize" , function ( ) { b . tablesorter . resizableReset ( d ) ; var a = b . isEmptyObject ? b . isEmptyObject ( c ) : c === { } ; c = { } ; return a } ) } } , remove : function ( d ) { b ( d ) . removeClass ( "hasResizable" ) . find ( "thead" ) . unbind ( "mouseup.tsresize mouseleave.tsresize contextmenu.tsresize" ) . find ( "tr" ) . children ( ) . unbind ( "mousemove.tsresize mouseup.tsresize" ) . find ( ".tablesorter-wrapper" ) . each ( function ( ) { b ( this ) . find ( ".tablesorter-resizer" ) . remove ( ) ; b ( this ) . replaceWith ( b ( this ) . contents
b . tablesorter . addWidget ( { id : "saveSort" , init : function ( b , a ) { a . format ( b , ! 0 ) } , format : function ( d , a ) { var e , c , j = d . config ; e = ! 1 !== j . widgetOptions . saveSort ; var f = { sortList : j . sortList } ; j . debug && ( c = new Date ) ; b ( d ) . hasClass ( "hasSaveSort" ) ? e && ( d . hasInitialized && b . tablesorter . storage ) && ( b . tablesorter . storage ( d , "tablesorter-savesort" , f ) , j . debug && b . tablesorter . benchmark ( "saveSort widget: Saving last sort: " + j . sortList , c ) ) : ( b ( d ) . addClass ( "hasSaveSort" ) , f = "" , b . tablesorter . storage && ( f = ( e = b . tablesorter . storage ( d , "tablesorter-savesort" ) ) && e . hasOwnProperty ( "sortList" ) && b . isArray ( e . sortList ) ? e . sortList : "" , j . debug && b . tablesorter . benchmark ( 'saveSort: Last sort loaded: "' + f + '"' , c ) ) , a && f && 0 < f . length ? j . sortList = f : d . hasInitialized && ( f && 0 < f . length ) && b ( d ) . trigger ( "sorton" , [ f ] ) ) } , remove : function ( d ) { b . tablesorter . storage ( d , "tablesorter-savesort" , "" ) } } )
2012-10-17 15:15:54 +00:00
} ) ( jQuery ) ;