2024-03-26 17:57:45 +00:00
/* eslint-disable */
2024-03-22 20:24:47 +00:00
/ * C l u s t e r i z e . j s - v 0 . 1 9 . 0 - 2 0 2 1 - 1 2 - 1 9
http : //NeXTs.github.com/Clusterize.js/
Copyright ( c ) 2015 Denis Lukov ; Licensed GPLv3 * /
; ( function ( p , m ) { "undefined" != typeof module ? module . exports = m ( ) : "function" == typeof define && "object" == typeof define . amd ? define ( m ) : this [ p ] = m ( ) } ) ( "Clusterize" , function ( ) { function p ( b , a , c ) { return a . addEventListener ? a . addEventListener ( b , c , ! 1 ) : a . attachEvent ( "on" + b , c ) } function m ( b , a , c ) { return a . removeEventListener ? a . removeEventListener ( b , c , ! 1 ) : a . detachEvent ( "on" + b , c ) } function t ( b ) { return "[object Array]" === Object . prototype . toString . call ( b ) } function q ( b , a ) { return window . getComputedStyle ? window . getComputedStyle ( a ) [ b ] :
a . currentStyle [ b ] } var r = function ( ) { for ( var b = 3 , a = document . createElement ( "b" ) , c = a . all || [ ] ; a . innerHTML = "\x3c!--[if gt IE " + ++ b + "]><i><![endif]--\x3e" , c [ 0 ] ; ) ; return 4 < b ? b : document . documentMode } ( ) , C = navigator . platform . toLowerCase ( ) . indexOf ( "mac" ) + 1 , n = function ( b ) { if ( ! ( this instanceof n ) ) return new n ( b ) ; var a = this , c = { rows _in _block : 50 , blocks _in _cluster : 4 , tag : null , show _no _data _row : ! 0 , no _data _class : "clusterize-no-data" , no _data _text : "No data" , keep _parity : ! 0 , callbacks : { } } ; a . options = { } ; for ( var d = "rows_in_block blocks_in_cluster show_no_data_row no_data_class no_data_text keep_parity tag callbacks" . split ( " " ) ,
h = 0 , g ; g = d [ h ] ; h ++ ) a . options [ g ] = "undefined" != typeof b [ g ] && null != b [ g ] ? b [ g ] : c [ g ] ; c = [ "scroll" , "content" ] ; for ( h = 0 ; d = c [ h ] ; h ++ ) if ( a [ d + "_elem" ] = b [ d + "Id" ] ? document . getElementById ( b [ d + "Id" ] ) : b [ d + "Elem" ] , ! a [ d + "_elem" ] ) throw Error ( "Error! Could not find " + d + " element" ) ; a . content _elem . hasAttribute ( "tabindex" ) || a . content _elem . setAttribute ( "tabindex" , 0 ) ; var e = t ( b . rows ) ? b . rows : a . fetchMarkup ( ) , k = { } ; b = a . scroll _elem . scrollTop ; a . insertToDOM ( e , k ) ; a . scroll _elem . scrollTop = b ; var l = ! 1 , w = 0 , u = ! 1 , x = function ( ) { C && ( u || ( a . content _elem . style . pointerEvents =
"none" ) , u = ! 0 , clearTimeout ( w ) , w = setTimeout ( function ( ) { a . content _elem . style . pointerEvents = "auto" ; u = ! 1 } , 50 ) ) ; l != ( l = a . getClusterNum ( e ) ) && a . insertToDOM ( e , k ) ; a . options . callbacks . scrollingProgress && a . options . callbacks . scrollingProgress ( a . getScrollProgress ( ) ) } , y = 0 , z = function ( ) { clearTimeout ( y ) ; y = setTimeout ( a . refresh , 100 ) } ; p ( "scroll" , a . scroll _elem , x ) ; p ( "resize" , window , z ) ; a . destroy = function ( f ) { m ( "scroll" , a . scroll _elem , x ) ; m ( "resize" , window , z ) ; a . html ( ( f ? a . generateEmptyRow ( ) : e ) . join ( "" ) ) } ; a . refresh = function ( f ) { ( a . getRowsHeight ( e ) ||
f ) && a . update ( e ) } ; a . update = function ( f ) { e = t ( f ) ? f : [ ] ; f = a . scroll _elem . scrollTop ; e . length * a . options . item _height < f && ( l = a . scroll _elem . scrollTop = 0 ) ; a . insertToDOM ( e , k ) ; a . scroll _elem . scrollTop = f } ; a . clear = function ( ) { a . update ( [ ] ) } ; a . getRowsAmount = function ( ) { return e . length } ; a . getScrollProgress = function ( ) { return this . options . scroll _top / ( e . length * this . options . item _height ) * 100 || 0 } ; var B = function ( f , A ) { var v = t ( A ) ? A : [ ] ; v . length && ( e = "append" == f ? e . concat ( v ) : v . concat ( e ) , a . insertToDOM ( e , k ) ) } ; a . append = function ( f ) { B ( "append" ,
f ) } ; a . prepend = function ( f ) { B ( "prepend" , f ) } } ; n . prototype = { constructor : n , fetchMarkup : function ( ) { for ( var b = [ ] , a = this . getChildNodes ( this . content _elem ) ; a . length ; ) b . push ( a . shift ( ) . outerHTML ) ; return b } , exploreEnvironment : function ( b , a ) { var c = this . options ; c . content _tag = this . content _elem . tagName . toLowerCase ( ) ; b . length && ( r && 9 >= r && ! c . tag && ( c . tag = b [ 0 ] . match ( /<([^>\s/]*)/ ) [ 1 ] . toLowerCase ( ) ) , 1 >= this . content _elem . children . length && ( a . data = this . html ( b [ 0 ] + b [ 0 ] + b [ 0 ] ) ) , c . tag || ( c . tag = this . content _elem . children [ 0 ] . tagName . toLowerCase ( ) ) ,
this . getRowsHeight ( b ) ) } , getRowsHeight : function ( b ) { var a = this . options , c = a . item _height ; a . cluster _height = 0 ; if ( b . length && ( b = this . content _elem . children , b . length ) ) { var d = b [ Math . floor ( b . length / 2 ) ] ; a . item _height = d . offsetHeight ; "tr" == a . tag && "collapse" != q ( "borderCollapse" , this . content _elem ) && ( a . item _height += parseInt ( q ( "borderSpacing" , this . content _elem ) , 10 ) || 0 ) ; "tr" != a . tag && ( b = parseInt ( q ( "marginTop" , d ) , 10 ) || 0 , d = parseInt ( q ( "marginBottom" , d ) , 10 ) || 0 , a . item _height += Math . max ( b , d ) ) ; a . block _height = a . item _height * a . rows _in _block ;
a . rows _in _cluster = a . blocks _in _cluster * a . rows _in _block ; a . cluster _height = a . blocks _in _cluster * a . block _height ; return c != a . item _height } } , getClusterNum : function ( b ) { var a = this . options ; a . scroll _top = this . scroll _elem . scrollTop ; var c = a . cluster _height - a . block _height ; return Math . min ( Math . floor ( a . scroll _top / c ) , Math . floor ( b . length * a . item _height / c ) ) } , generateEmptyRow : function ( ) { var b = this . options ; if ( ! b . tag || ! b . show _no _data _row ) return [ ] ; var a = document . createElement ( b . tag ) , c = document . createTextNode ( b . no _data _text ) ;
a . className = b . no _data _class ; if ( "tr" == b . tag ) { var d = document . createElement ( "td" ) ; d . colSpan = 100 ; d . appendChild ( c ) } a . appendChild ( d || c ) ; return [ a . outerHTML ] } , generate : function ( b ) { var a = this . options , c = b . length ; if ( c < a . rows _in _block ) return { top _offset : 0 , bottom _offset : 0 , rows _above : 0 , rows : c ? b : this . generateEmptyRow ( ) } ; var d = Math . max ( ( a . rows _in _cluster - a . rows _in _block ) * this . getClusterNum ( b ) , 0 ) , h = d + a . rows _in _cluster , g = Math . max ( d * a . item _height , 0 ) ; a = Math . max ( ( c - h ) * a . item _height , 0 ) ; c = [ ] ; var e = d ; for ( 1 > g && e ++ ; d < h ; d ++ ) b [ d ] &&
c . push ( b [ d ] ) ; return { top _offset : g , bottom _offset : a , rows _above : e , rows : c } } , renderExtraTag : function ( b , a ) { var c = document . createElement ( this . options . tag ) ; c . className = [ "clusterize-extra-row" , "clusterize-" + b ] . join ( " " ) ; a && ( c . style . height = a + "px" ) ; return c . outerHTML } , insertToDOM : function ( b , a ) { this . options . cluster _height || this . exploreEnvironment ( b , a ) ; var c = this . generate ( b ) , d = c . rows . join ( "" ) , h = this . checkChanges ( "data" , d , a ) , g = this . checkChanges ( "top" , c . top _offset , a ) , e = this . checkChanges ( "bottom" , c . bottom _offset ,
a ) , k = this . options . callbacks , l = [ ] ; h || g ? ( c . top _offset && ( this . options . keep _parity && l . push ( this . renderExtraTag ( "keep-parity" ) ) , l . push ( this . renderExtraTag ( "top-space" , c . top _offset ) ) ) , l . push ( d ) , c . bottom _offset && l . push ( this . renderExtraTag ( "bottom-space" , c . bottom _offset ) ) , k . clusterWillChange && k . clusterWillChange ( ) , this . html ( l . join ( "" ) ) , "ol" == this . options . content _tag && this . content _elem . setAttribute ( "start" , c . rows _above ) , this . content _elem . style [ "counter-increment" ] = "clusterize-counter " + ( c . rows _above - 1 ) , k . clusterChanged &&
k . clusterChanged ( ) ) : e && ( this . content _elem . lastChild . style . height = c . bottom _offset + "px" ) } , html : function ( b ) { var a = this . content _elem ; if ( r && 9 >= r && "tr" == this . options . tag ) { var c = document . createElement ( "div" ) ; for ( c . innerHTML = "<table><tbody>" + b + "</tbody></table>" ; b = a . lastChild ; ) a . removeChild ( b ) ; for ( c = this . getChildNodes ( c . firstChild . firstChild ) ; c . length ; ) a . appendChild ( c . shift ( ) ) } else a . innerHTML = b } , getChildNodes : function ( b ) { b = b . children ; for ( var a = [ ] , c = 0 , d = b . length ; c < d ; c ++ ) a . push ( b [ c ] ) ; return a } , checkChanges : function ( b ,
a , c ) { var d = a != c [ b ] ; c [ b ] = a ; return d } } ; return n } ) ;