Commits

Ian George  committed 5b9239c

Forgot to minify it, bollocks.

  • Participants
  • Parent commits cea3949
  • Tags 0.4.2

Comments (0)

Files changed (1)

File jquery.tagsphere.min.js

 */
 
 
-(function($){$.fn.tagcloud=function(options){var opts=$.extend($.fn.tagcloud.defaults,options);opts.drawing_interval=1/(opts.fps/1000);$(this).each(function(){new TagCloudClass($(this),opts);});return this;};$.fn.tagcloud.defaults={zoom:75,max_zoom:120,min_zoom:25,zoom_factor:2,rotate_by:-1.75,fps:10,centrex:250,centrey:250,min_font_size:12,max_font_size:32,font_units:'px',random_points:0};var TagCloudClass=function(el,options){$(el).css('position','relative');$('ul',el).css('display','none');var eyez=-500;var rad=Math.PI/180;var basecos=Math.cos(options.rotate_by*rad);var basesin=Math.sin(options.rotate_by*rad);var sin=basesin;var cos=basecos;var hex=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");var dirty=true;var container=$(el);var id_stub='tc_'+$(el).attr('id')+"_";var opts=options;var zoom=opts.zoom;var depth;var lastx=0;var lasty=0;var points=[];points['data']=[];var drawing_interval;var cmx=options.centrex;var cmy=options.centrey;var bg_colour,fg_colour;if(options.background_colour){bg_colour=parsecolour(options.background_colour);}else{bg_colour=parsecolour($(el).css('background-color'));}
+(function($){$.fn.tagcloud=function(options){var opts=$.extend($.fn.tagcloud.defaults,options);opts.drawing_interval=1/(opts.fps/1000);$(this).each(function(){$('ul',$(this)).css('display','none');new TagCloudClass($(this),opts);});return this;};$.fn.tagcloud.defaults={zoom:75,max_zoom:120,min_zoom:25,zoom_factor:2,rotate_by:-1.75,fps:10,centrex:250,centrey:250,min_font_size:12,max_font_size:32,font_units:'px',random_points:0};var TagCloudClass=function(el,options){$(el).css('position','relative');var eyez=-500;var rad=Math.PI/180;var basecos=Math.cos(options.rotate_by*rad);var basesin=Math.sin(options.rotate_by*rad);var sin=basesin;var cos=basecos;var hex=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");var dirty=true;var container=$(el);var id_stub='tc_'+$(el).attr('id')+"_";var opts=options;var zoom=opts.zoom;var depth;var lastx=0;var lasty=0;var points=[];points['data']=[];var drawing_interval;var cmx=options.centrex;var cmy=options.centrey;var bg_colour,fg_colour;if(options.background_colour){bg_colour=parsecolour(options.background_colour);}else{bg_colour=parsecolour($(el).css('background-color'));}
 if(options.foreground_colour){fg_colour=parsecolour(options.foreground_colour);}else{fg_colour=parsecolour($(el).css('color'));}
 function parsecolour(colour){function parse_rgb_colour(colour){rgb=colour.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(rgb.length>3){return{"r":parseInt(rgb[1]),"g":parseInt(rgb[2]),"b":parseInt(rgb[3])};}else{return{"r":0,"g":0,"b":0};}}
 function parse_hex_colour(colour){var r=0,g=0,b=0;if(colour.length>4)
 function getcolour(num){if(num>256){num=256;}
 if(num<0){num=0;}
 var r=getshade(bg_colour.r,fg_colour.r,num);var g=getshade(bg_colour.g,fg_colour.g,num);var b=getshade(bg_colour.b,fg_colour.b,num);var ret="rgb("+r+", "+g+", "+b+")";return ret;}
-function getshade(lbound,ubound,dist){var ub=Math.max(lbound,ubound);var lb=Math.min(lbound,ubound);var scope=ubound-lbound;var dist_percent=scope/256;var shade=Math.round(lb+(dist*dist_percent));return shade;}
+function getshade(lbound,ubound,dist){var scope=ubound-lbound;var dist_percent=scope/100;var shade=Math.round(lbound+(dist*dist_percent));console.log(lbound,ubound,dist);return shade;}
 function rotx(){for(var p in points.data)
 {var temp=sin*points.data[p].y+cos*points.data[p].z;points.data[p].y=cos*points.data[p].y-sin*points.data[p].z;points.data[p].z=temp;}}
 function roty(){for(var p in points.data){var temp=-sin*points.data[p].x+cos*points.data[p].z;points.data[p].x=cos*points.data[p].x+sin*points.data[p].z;points.data[p].z=temp;}}
 if(my>lasty){sin=basesin;rotx();}
 if(my<lasty){sin=-basesin;rotx();}
 lastx=mx;lasty=my;dirty=true;}
-function draw(){if(dirty){var minz=0;var maxz=0;for(var r_p in points.data){if(points.data[r_p].z<minz){minz=points.data[r_p].z;}
-if(points.data[r_p].z>maxz){maxz=points.data[r_p].z;}}
-var diffz=minz-maxz;for(var s_p in points.data){var u=(depth-eyez)/(points.data[s_p].z-eyez);var dist=parseInt((points.data[s_p].z/diffz)*255);var dist_colour=getcolour(dist);$('#'+points.data[s_p].id+' a',container).css('color',dist_colour);$('#'+points.data[s_p].id,container).css('z-index',dist+1000);$('#'+points.data[s_p].id,container).css('left',u*points.data[s_p].x+cmx-points.data[s_p].cwidth);$('#'+points.data[s_p].id,container).css('top',u*points.data[s_p].y+cmy);}
+function draw(){if(dirty){var smallz=10000;var bigz=-10000;for(var r_p in points.data){if(points.data[r_p].z<smallz){smallz=points.data[r_p].z;}
+if(points.data[r_p].z>bigz){bigz=points.data[r_p].z;}}
+var minz=Math.min(smallz,bigz);var maxz=Math.max(smallz,bigz);var diffz=maxz-minz;for(var s_p in points.data){var u=(depth-eyez)/(points.data[s_p].z-eyez);var dist=Math.round(((maxz-points.data[s_p].z)/diffz)*100);var dist_colour=getcolour(dist);$('#'+points.data[s_p].id+' a',container).css('color',dist_colour);$('#'+points.data[s_p].id,container).css('z-index',dist);$('#'+points.data[s_p].id,container).css('left',u*points.data[s_p].x+cmx-points.data[s_p].cwidth);$('#'+points.data[s_p].id,container).css('top',u*points.data[s_p].y+cmy);}
 dirty=false;}}
 points.count=$('li a',container).length;points.largest=1;points.smallest=0;$('li a',container).each(function(idx,val){var sz=parseInt($(this).attr('rel'));if(sz==0)
 sz=1;points.data[idx]={id:id_stub+idx,size:sz};var h=-1+2*(idx)/(points.count-1);points.data[idx].theta=Math.acos(h);if(idx==0||idx==points.count-1){points.data[idx].phi=0;}