Code suggestions - using $.each() to set a kind of use meter
<p>Hoping for a quick peer review here. An associate and I build out a video popchart  plugin for a client in south korea (here's the test site - <a href="http://izepic.com/kpopcharts/" rel="nofollow">http://izepic.com/kpopcharts/</a>). My question relates to the activity meter in the header of each vid player. So, I wrote the js below to check each of the social interaction numbers, determine their percentage of the interaction total, and then set the width of each type in the meter itself. Note, specificity for each interaction type was required.</p>

<pre><code>$('.bkp-meter').each(function(index){

// find participation type base numbers
var voteTotal = parseInt($('.bkp-vote-total').eq(index).text());
var facebookTotal = parseInt($('.bkp-facebook-total').eq(index).text());
var twitterTotal = parseInt($('.bkp-twitter-total').eq(index).text());
var googleTotal = parseInt($('.bkp-google-total').eq(index).text());
var commentTotal = parseInt($('.bkp-comment-total').eq(index).text());

var scoreTotal = voteTotal + facebookTotal + twitterTotal + googleTotal + commentTotal;

// find participation type ratio
var votePercentage = (voteTotal / scoreTotal) * 100;
var facebookPercentage = (facebookTotal / scoreTotal) * 100;
var twitterPercentage = (twitterTotal / scoreTotal) * 100;
var googlePercentage = (googleTotal / scoreTotal) * 100;
var commentPercentage = (commentTotal / scoreTotal) * 100;

if(scoreTotal &gt; 2) {

// set meter widths for each participation type
$('.bkp-meter-votes').eq(index).css('width', (votePercentage.toFixed(0) - 2) + "%");
$('.bkp-meter-fb').eq(index).css('width',facebookPercentage.toFixed(0) + "%");
$('.bkp-meter-twitter').eq(index).css('width',twitterPercentage.toFixed(0) + "%");
$('.bkp-meter-google').eq(index).css('width',googlePercentage.toFixed(0) + "%");
$('.bkp-meter-comments').eq(index).css('width',(commentPercentage.toFixed(0)) + "%");

} else {
$(this).parent().parent().addClass('novotes');
}

});
</code></pre>

<p>My question: is there a quicker, cleaner way to do this? I mean, it's working fine so problem solved but it feels very brute force ... for my own improvement I'd like to know if there's a more efficient method and what sort of issues I might run into with this. One note - the percentages didn't have to be perfect ... they just need to give the user a quick shot of what other people are doin' with that vid.</p>

<p>Thanks</p>
