Changeset 10024 in spip-zone
- Timestamp:
- Mar 1, 2007, 5:45:00 PM (14 years ago)
- Location:
- _dev_/top10
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
_dev_/top10/stats.html
r9956 r10024 27 27 var cells = jQuery(">td",this); 28 28 var version = cells.eq(0).html(); 29 var maj = parseInt(version.replace(/[.-]/g,'')) 30 if(maj<100) maj *=10; 31 var maj2 = parseInt(maj/10); 32 var maj3 = parseInt(maj%10); 33 if(!maj_versions[maj2]) maj_versions[maj2] = {}; 34 if(!maj_versions[maj2][maj3]) maj_versions[maj2][maj3] = []; 35 maj_versions[maj2][maj3].push([version,cells.eq(1).html()]); 29 var maj = parseInt(version.replace(/[.-]/g,'')); 30 if(maj == "NaN") { 31 maj_versions[maj] = [version,cells.eq(1).html()]; 32 } else { 33 if(maj<100) maj *=10; 34 var maj2 = parseInt(maj/10); 35 var maj3 = parseInt(maj%10); 36 if(!maj_versions[maj2]) maj_versions[maj2] = {}; 37 if(!maj_versions[maj2][maj3]) maj_versions[maj2][maj3] = []; 38 maj_versions[maj2][maj3].push([version,cells.eq(1).html()]); 39 } 36 40 }); 37 41 38 42 jQuery.each(maj_versions,function(i,n){ 39 var row = [i [0]+'.'+i[1],n];43 var row = [i.charAt(0)+'.'+i.charAt(1),n]; 40 44 if(n.constructor==Object) { 41 45 var row2 = []; … … 54 58 jQuery("div.treemapCell",t).hover(function(){jQuery(this).addClass("selected")},function(){jQuery(this).removeClass("selected")}); 55 59 } 56 57 58 60 </script> 59 61 <style type="text/css"> -
_dev_/top10/stats.php
r9956 r10024 7 7 jQuery(function(){ 8 8 jQuery("<div class='treemap'>").hide().insertAfter("table"); 9 9 jQuery("table").each(function(){ 10 10 var dataFunction; 11 11 if(jQuery(this).is("#versions")) … … 18 18 jQuery("table, div.treemap").toggle(); 19 19 jQuery(this).text( jQuery(this).is(":contains(treemap)")?"tableaux <<":">> treemap" ); 20 }); 20 }); 21 21 }) 22 22 … … 27 27 var cells = jQuery(">td",this); 28 28 var version = cells.eq(0).html(); 29 var maj = parseInt(version.replace(/[.-]/g,'')) 30 if(maj<100) maj *=10; 31 var maj2 = parseInt(maj/10); 32 var maj3 = parseInt(maj%10); 33 if(!maj_versions[maj2]) maj_versions[maj2] = {}; 34 if(!maj_versions[maj2][maj3]) maj_versions[maj2][maj3] = []; 35 maj_versions[maj2][maj3].push([version,cells.eq(1).html()]); 29 var maj = parseInt(version.replace(/[.-]/g,'')); 30 if(maj == "NaN") { 31 maj_versions[maj] = [version,cells.eq(1).html()]; 32 } else { 33 if(maj<100) maj *=10; 34 var maj2 = parseInt(maj/10); 35 var maj3 = parseInt(maj%10); 36 if(!maj_versions[maj2]) maj_versions[maj2] = {}; 37 if(!maj_versions[maj2][maj3]) maj_versions[maj2][maj3] = []; 38 maj_versions[maj2][maj3].push([version,cells.eq(1).html()]); 39 } 36 40 }); 37 41 38 42 jQuery.each(maj_versions,function(i,n){ 39 var row = [i [0]+'.'+i[1],n];43 var row = [i.charAt(0)+'.'+i.charAt(1),n]; 40 44 if(n.constructor==Object) { 41 45 var row2 = []; -
_dev_/top10/treemap.js
r9956 r10024 7 7 (function() { 8 8 jQuery.fn.treemap = function(w,h,options) { 9 options = jQuery.extend({labelCell:0,dataCell:1,headHeight:20,borderWidth:1,sort:true },options);9 options = jQuery.extend({labelCell:0,dataCell:1,headHeight:20,borderWidth:1,sort:true,nested:false},options); 10 10 var or_target = options.target; 11 11 return this.pushStack(jQuery.map(this,function(el){ … … 132 132 for(var i=0;i<=rl;i++) { 133 133 var n = row[i],hier = n[1].constructor == Array, head = [], val = hier?treemap.getValue(n[1]):n[1]; 134 var cell = treemap.emptyCell.clone().html(n[0]).attr('title',n[0]+' ('+val+')'); 134 var cell = treemap.emptyCell.clone(); 135 if(!hier) cell.html(n[0]).attr('title',n[0]+' ('+val+')'); 135 136 var lastCell = i==rl; 136 137 var fixedDim = rowDim, varDim = lastCell ? w-sum : Math.round(val/h); … … 140 141 if(bw && rowDim>=bw2 && varDim>=bw2) { 141 142 if(jQuery.boxModel) { 142 fixedDim -= bw*( options.numSquare>=2?1:2);143 varDim -= bw*(2-(!lastCell ?1:0)-(i || options.numSquare<1?0:1));143 fixedDim -= bw*(2-(options.numSquare>=2 || !options.numSquare && options.nested?1:0)-(last && options.nested?1:0)); 144 varDim -= bw*(2-(!lastCell||options.nested?1:0)-(options.numSquare>=1 && !i?1:0)); 144 145 } 145 cellStyles.border = bw+'px solid' 146 if(!lastCell )147 cellStyles['border -'+(orientation?'bottom':'right')] = 'none';148 if(options.numSquare>=2 )149 cellStyles['border -'+(orientation?'left':'top')] = 'none';146 cellStyles.border = bw+'px solid'; 147 if(!lastCell || options.nested) 148 cellStyles['border'+(orientation?'Bottom':'Right')] = 'none'; 149 if(options.numSquare>=2 || !options.numSquare && options.nested) 150 cellStyles['border'+(orientation?'Left':'Top')] = 'none'; 150 151 if(options.numSquare>=1 && !i) 151 cellStyles['border-'+(orientation?'top':'left')] = 'none'; 152 cellStyles['border'+(orientation?'Top':'Left')] = 'none'; 153 if(last && options.nested) 154 cellStyles['border'+(orientation?'Right':'Bottom')] = 'none'; 152 155 } 153 156 var height = orientation?varDim:fixedDim, width = orientation?fixedDim:varDim; … … 157 160 if(hier) { 158 161 if(options.headHeight) { 159 head = jQuery("<div class='treemapHead'>").css({"width":width,"height":options.headHeight,"overflow":"hidden"}).html(n[0]) ;162 head = jQuery("<div class='treemapHead'>").css({"width":width,"height":options.headHeight,"overflow":"hidden"}).html(n[0]).attr('title',n[0]+' ('+val+')'); 160 163 if(orientation) 161 164 height = varDim -= options.headHeight; … … 164 167 165 168 } 166 var new_opt = {getData:function(){return n[1].concat()},borderWidth:options.borderWidth,headHeight:options.headHeight}; 167 cell.treemap(width,height,new_opt); 169 if(height>0) { 170 var new_opt = {}; 171 for(var prop in options) new_opt[prop] = options[prop]; 172 new_opt = jQuery.extend(new_opt,{getData:function(){return n[1].concat()},target:undefined,nested:true}); 173 cell.treemap(width,height,new_opt); 174 } 168 175 cell.prepend(head); 169 176 }
Note: See TracChangeset
for help on using the changeset viewer.