clusterize.js
Advanced tools
Comparing version 0.18.0 to 0.18.1
@@ -1,4 +0,4 @@ | ||
/*! Clusterize.js - v0.18.0 - 2017-11-04 | ||
* http://NeXTs.github.com/Clusterize.js/ | ||
* Copyright (c) 2015 Denis Lukov; Licensed GPLv3 */ | ||
/* Clusterize.js - v0.18.1 - 2018-01-02 | ||
http://NeXTs.github.com/Clusterize.js/ | ||
Copyright (c) 2015 Denis Lukov; Licensed GPLv3 */ | ||
@@ -179,2 +179,3 @@ ;(function(name, definition) { | ||
var nodes = this.content_elem.children; | ||
if( ! nodes.length) return; | ||
var node = nodes[Math.floor(nodes.length / 2)]; | ||
@@ -181,0 +182,0 @@ opts.item_height = node.offsetHeight; |
@@ -1,3 +0,2 @@ | ||
/* | ||
Clusterize.js - v0.18.0 - 2017-11-04 | ||
/* Clusterize.js - v0.18.1 - 2018-01-02 | ||
http://NeXTs.github.com/Clusterize.js/ | ||
@@ -12,3 +11,3 @@ Copyright (c) 2015 Denis Lukov; Licensed GPLv3 */ | ||
a)};a.prepend=function(a){w("prepend",a)}};p.prototype={constructor:p,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&&(l&&9>=l&&!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;var d=b[Math.floor(b.length/2)];a.item_height=d.offsetHeight;"tr"==a.tag&&"collapse"!=m("borderCollapse",this.content_elem)&&(a.item_height+=parseInt(m("borderSpacing",this.content_elem),10)||0);"tr"!=a.tag&&(b=parseInt(m("marginTop",d),10)||0,d=parseInt(m("marginBottom",d),10)||0,a.item_height+=Math.max(b,d));a.block_height=a.item_height*a.rows_in_block; | ||
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"!=m("borderCollapse",this.content_elem)&&(a.item_height+=parseInt(m("borderSpacing",this.content_elem),10)||0);"tr"!=a.tag&&(b=parseInt(m("marginTop",d),10)||0,d=parseInt(m("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(){this.options.scroll_top=this.scroll_elem.scrollTop;return Math.floor(this.options.scroll_top/(this.options.cluster_height-this.options.block_height))||0},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; | ||
@@ -15,0 +14,0 @@ 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,a){var c=this.options,d=b.length;if(d<c.rows_in_block)return{top_offset:0,bottom_offset:0,rows_above:0,rows:d?b:this.generateEmptyRow()};var f=Math.max((c.rows_in_cluster-c.rows_in_block)*a,0),h=f+c.rows_in_cluster,e=Math.max(f*c.item_height,0);c=Math.max((d-h)*c.item_height,0);d=[];var g=f;for(1>e&&g++;f<h;f++)b[f]&&d.push(b[f]);return{top_offset:e,bottom_offset:c, |
{ | ||
"name": "clusterize.js", | ||
"version": "0.18.0", | ||
"version": "0.18.1", | ||
"description": "Tiny vanilla JS plugin to display large data sets easily", | ||
@@ -5,0 +5,0 @@ "main": "clusterize.js", |
23075
426