I currently have the code listed below. This shows as a dark green reputation bar for two points and light green bar for 10 points. The problem is I want to add a third gold bar for reputation of 100 points. I tried to fiddle with it and ended up taking out all the reputation points. I reset it back but still left with my original problem. I tried to follow the codes for the green bars but I may have missed something. Thanks bunches to anyone that can help. <script type="text/javascript"> <!-- /* karma to images */ var noKarma = "No Karma"; var crossOver = 10; //Cross Over Point from small to large icons var bigInt = 10; //Number of Karma for Big Icon var smallInt = 2; //Number of Karma for Small Icon var positive = [ ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_greenh.gif'], // Small Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_green.gif'], // Big Karma Icon ]; var negative = [ ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_neg.gif'], // Small Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_neg.gif'], // Big Karma Icon ]; var noKarma="No Karma"; var td=document.getElementsByTagName('td'); for(i=0; i<td.length; i++) { if(td.item(i).width == '20%' && td.item(i).parentNode.innerHTML.match(/(Karma: (-)?(.+?))</i)) { var iTemp = RegExp.$1; var iHolder = 'Karma: '; if(RegExp.$3 == '0') iHolder += noKarma; else { var base = (RegExp.$2 == '-')? negative : positive; var kar = parseInt(RegExp.$3) var small = Math.round((kar % bigInt) / smallInt); var big = Math.round((kar - (kar % bigInt)) / bigInt); for(b=0; b<big; b++) { iHolder += '<img src="'+ base[0] +'" alt="'+ bigInt +' Karma" />'; } for(s=0; s<small; s++) { iHolder += '<img src="'+ base[1] +'" alt="'+ smallInt +' Karma" />'; } td.item(i).innerHTML = td.item(i).innerHTML.replace(iTemp,iHolder) } } } //--> </script>
This is what you want ? Replace the images with other colors ... <script type="text/javascript"> <!-- var noKarma = "No Karma"; var crossOver = 10; //Cross Over Point from small to large icons var bbbInt = 100; var bigInt = 10; //Number of Karma for Big Icon var smallInt = 2; //Number of Karma for Small Icon var positive = [ ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_greenh.gif'], // Small Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_green.gif'], // Big Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_neg.gif'], // Big Karma Icon ]; var negative = [ ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_neg.gif'], // Small Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_neg.gif'], // Big Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_greenh.gif'], // Small Karma Icon ]; var noKarma="No Karma"; var td=document.getElementsByTagName('td'); for(i=0; i<td.length; i++) { if(td.item(i).width == '20%' && td.item(i).parentNode.innerHTML.match(/(Karma: (-)?(.+?))</i)) { var iTemp = RegExp.$1; var iHolder = 'Karma: '; if(RegExp.$3 == '0') iHolder += noKarma; else { var base = (RegExp.$2 == '-')? negative : positive; var kar = parseInt(RegExp.$3) var small = Math.round((kar % bbbInt) / smallInt); var big = Math.round((kar - (kar % bbbInt)) / bigInt); var bbb = Math.round((kar - (kar % bbbInt)) / bbbInt); if (kar>100) { for(bb=0; bb<bbb; bb++) { iHolder += '<img src="'+ base[2] +'" alt="'+ bbbInt +' Karma" />'; } } else { for(b=0; b<big; b++) { iHolder += '<img src="'+ base[0] +'" alt="'+ bigInt +' Karma" />'; } for(s=0; s<small; s++) { iHolder += '<img src="'+ base[1] +'" alt="'+ smallInt +' Karma" />'; } } td.item(i).innerHTML = td.item(i).innerHTML.replace(iTemp,iHolder) } } } //--> </script> Code (markup):
Interesting result. I get 1 gold for a member that has 130 points and nothing else. That person should have 1 gold and 3 light green. I also get 5 dark green for a member that has 10 points and they should have 1 light green. And 18 dark green for a member that has 18 points. So the light green seems to have disappeared ?
Yes that is what should come out except the dark green are worth 2 points so you will actually only have 2 dark greens. I gather this is not an easy a code to fix as I thought. LOL
Tell me if is ok ... <script type="text/javascript"> <!-- var noKarma = "No Karma"; var crossOver = 10; //Cross Over Point from small to large icons var bbbInt = 100; var bigInt = 10; //Number of Karma for Big Icon var smallInt = 2; //Number of Karma for Small Icon var positive = [ ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_greenh.gif'], // Small Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_green.gif'], // Big Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_neg.gif'], // Big Karma Icon ]; var negative = [ ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_neg.gif'], // Small Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_neg.gif'], // Big Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_greenh.gif'], // Small Karma Icon ]; var noKarma="No Karma"; var td=document.getElementsByTagName('td'); for(i=0; i<td.length; i++) { if(td.item(i).width == '20%' && td.item(i).parentNode.innerHTML.match(/(Karma: (-)?(.+?))</i)) { var iTemp = RegExp.$1; var iHolder = 'Karma: '; if(RegExp.$3 == '0') iHolder += noKarma; else { var base = (RegExp.$2 == '-')? negative : positive; var kar = parseInt(RegExp.$3) var small = Math.round(((kar % bbbInt)%bigInt) / smallInt); var big = Math.round(((kar-small) % bbbInt) / bigInt); var bbb = Math.round((kar - (kar % bbbInt)) / bbbInt); for(bb=0; bb<bbb; bb++) { iHolder += '<img src="'+ base[2] +'" alt="'+ bbbInt +' Karma" />'; } for(b=0; b<big; b++) { iHolder += '<img src="'+ base[0] +'" alt="'+ bigInt +' Karma" />'; } for(s=0; s<small; s++) { iHolder += '<img src="'+ base[1] +'" alt="'+ smallInt +' Karma" />'; } td.item(i).innerHTML = td.item(i).innerHTML.replace(iTemp,iHolder) } } } //--> Code (markup):
I changed the third URL from the red negative to the gold one andYAHHHHHHHHHHHHH it works. Copywrite it as proboards have been trying to get it to work and you did it. Thank you bunches so much.
I am bringing it up again as I was hoping that another adjustment can be made. I have an active board were exalting is done in a positive way. I currently have this code to show a dark green icon for every 2 points/a light green for every 10 points and a gold for every 100 points. What I want to do is add something that will allow another icon ( silver) to represent 1,000 points. It was a hard code to enter in the beginning to get it just right so I will understand if you can't do it. This is the icon I will use for the silver rep points..http://i30.photobucket.com/albums/c323/EquineExperience/rep-silver.gif Anyways here is the code as it stands now... <script type="text/javascript"> <!-- var noKarma = "No Karma"; var crossOver = 10; //Cross Over Point from small to large icons var bbbInt = 100; var bigInt = 10; //Number of Karma for Big Icon var smallInt = 2; //Number of Karma for Small Icon var positive = [ ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_greenh.gif'], // Small Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_green.gif'], // Big Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_gold.gif'], // Big Karma Icon ]; var negative = [ ['http://i30.photobucket.com/albums/c323/EquineExperience/replightred.gif'], // Small Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_neg.gif'], // Big Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_greenh.gif'], // Small Karma Icon ]; var noKarma="No Karma"; var td=document.getElementsByTagName('td'); for(i=0; i<td.length; i++) { if(td.item(i).width == '20%' && td.item(i).parentNode.innerHTML.match(/(Karma: (-)?(.+?))</i)) { var iTemp = RegExp.$1; var iHolder = 'Karma: '; if(RegExp.$3 == '0') iHolder += noKarma; else { var base = (RegExp.$2 == '-')? negative : positive; var kar = parseInt(RegExp.$3) var small = Math.round(((kar % bbbInt)%bigInt) / smallInt); var big = Math.round(((kar-small) % bbbInt) / bigInt); var bbb = Math.round((kar - (kar % bbbInt)) / bbbInt); for(bb=0; bb<bbb; bb++) { iHolder += '<img src="'+ base[2] +'" alt="'+ bbbInt +' Karma" />'; } for(b=0; b<big; b++) { iHolder += '<img src="'+ base[0] +'" alt="'+ bigInt +' Karma" />'; } for(s=0; s<small; s++) { iHolder += '<img src="'+ base[1] +'" alt="'+ smallInt +' Karma" />'; } td.item(i).innerHTML = td.item(i).innerHTML.replace(iTemp,iHolder) } } } //--> </script>
Here is the solution var bbbbInt = 1000; var positive = [ ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_greenh.gif'], // Small Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_green.gif'], // Big Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_gold.gif'], // Big Karma Icon ], ['http://i30.photobucket.com/albums/c323/EquineExperience/rep-silver.gif'] // BBig Karma Icon ] ; var bbbb = Math.round((kar - (kar % bbbbInt)) / bbbbInt); for(bb=0; bb<bbbb; bb++) { iHolder += '<img src="'+ base[3] +'" alt="'+ bbbbInt +' Karma" />'; }
Thanks itcareer but before I put it on my site can you verify that I have it right. <script type="text/javascript"> <!-- var noKarma = "No Karma"; var crossOver = 10; //Cross Over Point from small to large icons var bbbbInt = 1000; var bbbInt = 100; var bigInt = 10; //Number of Karma for Big Icon var smallInt = 2; //Number of Karma for Small Icon var positive = [ ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_greenh.gif'], // Small Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_green.gif'], // Big Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_gold.gif'], // Big Karma Icon ]; ['http://i30.photobucket.com/albums/c323/EquineExperience/rep-silver.gif'] // BBig Karma Icon ] ; var negative = [ ['http://i30.photobucket.com/albums/c323/EquineExperience/replightred.gif'], // Small Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_neg.gif'], // Big Karma Icon ['http://i30.photobucket.com/albums/c323/EquineExperience/reputation_greenh.gif'], // Small Karma Icon ]; var noKarma="No Karma"; var td=document.getElementsByTagName('td'); for(i=0; i<td.length; i++) { if(td.item(i).width == '20%' && td.item(i).parentNode.innerHTML.match(/(Karma: (-)?(.+?))</i)) { var iTemp = RegExp.$1; var iHolder = 'Karma: '; if(RegExp.$3 == '0') iHolder += noKarma; else { var base = (RegExp.$2 == '-')? negative : positive; var kar = parseInt(RegExp.$3) var small = Math.round(((kar % bbbInt)%bigInt) / smallInt); var big = Math.round(((kar-small) % bbbInt) / bigInt); var bbb = Math.round((kar - (kar % bbbInt)) / bbbInt); var bbbb = Math.round((kar - (kar % bbbbInt)) / bbbbInt); for(bb=0; bb<bbbb; bb++) { iHolder += '<img src="'+ base[3] +'" alt="'+ bbbbInt +' Karma" />'; } for(b=0; b<big; b++) { iHolder += '<img src="'+ base[0] +'" alt="'+ bigInt +' Karma" />'; } for(s=0; s<small; s++) { iHolder += '<img src="'+ base[1] +'" alt="'+ smallInt +' Karma" />'; } td.item(i).innerHTML = td.item(i).innerHTML.replace(iTemp,iHolder) } } } //--> </script>
I tried it the way I have it above as no one answered to tell me it was wrong and all the icon boxes dissapeared so can someone tell me where the corrections actually go in the script, please.
PIF--I tried it and only the light green ( worth 10 points) and the dark green ( worth 2 points) showed up. Those members that had gold reputation bars did not show anything other than the green ones.