Advertisement
KiberInfinity

vk.grigoriev.me stat bars fix

Mar 11th, 2013
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function process_table(table){
  2.    var pr=$(table).find('.progress');
  3.    
  4.    var answer=[];
  5.    var max=0;
  6.    for (var i=0; i<pr.length; i++){
  7.       var data={
  8.          bar:$(pr[i]).find('.bar')[0],
  9.          rate: parseInt($(pr[i]).parent().find('.amount .items').html().replace(/[^\d]/g,''))
  10.       }
  11.       max=Math.max(max,data.rate);
  12.       answer.push(data);
  13.    }
  14.    
  15.    for (var i=0; i<answer.length; i++){
  16.       var width=Math.round(answer[i].rate*100/max);
  17.       $(answer[i].bar).css('width',width+'%');
  18.    }  
  19.  
  20. }
  21. process_table($('table')[0]);
Advertisement
RAW Paste Data Copied
Advertisement