Thanks for feedback! I knew console.log(), console.debug(), etc., but I thought that it only works in my browser, not inside the script. That helped me a lot!
First thing I need to know is if you'd consider to implement that in official BBlog plugin? If not, I'll public that as separate plugin for BBlog.
I worked few hours and i managed to develop that:
http://imageshack.us/a/img411/7519/bblogstars2.png
As you can see it's working, but it needs several fixes:
1. Weapons as M16A4, M4 and M320's have no stars, because they "share" kills with M16A3, M4A1 and the M320. Do I have to do a special "if's" for these weapons or it's easier to implement?
2. Little stars have bug with z-index (weapon has smaller z-index value than the star, but it's still on the top). I think the DOM tree should be build differently to fix that.
3. CSS styles could be more esthetic, but I'm not an artist and it suits me. :P
4. The code needs (i think) a little optimization, because method "BBLog.getCachedJsonRequest" with "weaponsPopulateStats" argument requests a lot of stats the plugin doesn't need.
Here's the code:
/**
* The plugin is showing your stars at every gun icon.
*
* @author Humanoss
* @version 1.0
* @date 20.09.2012
* @url http://google.com
*/
var handler = function(){
var data = BBLog.getCachedJsonRequest("weaponsPopulateStats", "lastFirst", "json");
if(data){
var items = $("#profile-stats-weapons-secondary-column div.profile-stats-unlock-progression-kit-item a");
for(i in data.data.mainWeaponStats){
var weapon = data.data.mainWeaponStats[i];
var weaponTr = items.filter("[href*='iteminfo/"+weapon.slug+"/']").closest("div").not("[data-shots]");
if(weaponTr.size()){
weaponTr.attr("data-shots", true);
var html = $(
''+Math.floor(weapon.kills/100)+''
);
weaponTr.children("div.progress").append(html);
}
}
}
}
BBLog.bindDomChange(handler);
handler();
And link:
http://www.sobol6803.yoyo.pl/bbstars.js