Tuesday, July 31, 2012

Comment Counter Code Available!



Good morning! I'm so excited that my programmer husband, Tom, made the COMMENT COUNTER gadget now work with the updated blogger stuff. Yeah! Thanks, Tom!  You guys are welcome to copy and paste the code below as an HTML gadget to your Layout if you would like your comments to be numbered.

IMPORTANT: You MUST choose the EMBEDDED option in SETTINGS for COMMENTS.  This numbering system will NOT work with pop-up comments.

Find step-by-step photos below. :)


ENJOY! This code is FREE if you'd like to use it. :)

<style type="text/css">
.commentNumber {
border: 0px solid Black;
padding-right:5px;
display: inline;
color: #6FA8DC;
font-weight: bold;
}
</style>
<script type="text/javascript">
function getElementsByClassName2(className, tag, elm){
 var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
 var tag = tag || "*";
 var elm = elm || document;
 var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
 var returnElements = [];
 var current;
 var length = elements.length;
 for(var i=0; i<length; i++){
  current = elements[i];
  if(testClass.test(current.className)){
   returnElements.push(current);
  }
 }
 return returnElements;
}
function addCounters()
{
       var numBox, i, j;

       var topComments = getElementsByClassName2("comment-thread")[0].firstChild.children;
       for (i = 0, j = topComments.length; i < j; i++)
       {
               var commentBlock = getElementsByClassName2("comment-block", "*", topComments[i])[0];
               numBox = document.createElement("span");
               numBox.className = "commentNumber";
               numBox.appendChild(document.createTextNode((i + 1) + ':'));
               commentBlock .firstChild.insertBefore(numBox, commentBlock .firstChild.firstChild);
       }
}
addCounters();
</script>


If you want to see what this looks like in use... as soon as someone leaves me at least 1 comment on this post, it will start the numbering. Just click on my BLOG TITLE so that this post and it's comments are the only thing showing on the page. You'll see the comments numbered. I just love that he did this for me and all my friends. Sure does make it easier when doing a give-away and using random.org to pick a winner and not having to count the comments. 

Have a GREAT day!
:) Janis

Click on photos to enlarge for better viewing. 








31 comments:

Lucy Kelleher said...

Awesome! Tom Rocks!! TFS Janis :)

Lucy
http://love2createitall.com

~ Jo ~ said...

This is awesome!!! Thank you for sharing it Janis!!

Hugs,
Jo

Creative Diva said...

OMG! Thank you for sharing this information. I just did it! Wow! This makes it so much easier when looking for the winner of blog candy after using Random. Org. You are truly a life saver. Thanks to your hubby also.

Hugs,
Patty

febe said...

TFS! Awesome chance again :)

australian gifts for overseas

jessica said...

TFS and thanks for the step by step! This is so awesome and works perfectly!!!!

Candice Fields said...

Thanks Tom! I love it! TFS

Kate said...

OMG Please tell your hubby I love him so much!!!!!!!!! THANK YOU THANK YOU THANK YOU! I have been seriously trying to figure out how to # my comments and none was working and this worked.

Thank you for sharing this Janis, really appreciate.

Hugs,
Kate

Katie said...

wow THANKS this is awesome...thanks Tom for your kindness in sharing this with us!! what a dandy Idea!!! I snagged it ... www.ktsangels.blogspot.com...tfs

Rhonda Emery said...

thank you so much janis this is real sweet of you to share. it works great. hugs

Lagene said...

WOW, Thanks so much!

Boots And Bling Time said...

Oh my stars...yes yes yes!!! Tom is the MAN! Give him a Big Kiss for me!

Laine said...

Thank you so much for this, how super.
Hugs
Laine
X

AJ Scrapbooking and Cards said...

This is so awesome. Woot Woot GO TOM GO! Thank You both so much. I so need this. I will be sure to share the awesome new. THANKS TOM!

Chriss America Real said...

This is great! Thanks so much! Makes giving out prizes easier!

Hugs,

Chriss

Houses Built of Cards said...

WOW!!! Thanks SOOO much! Been trying to get something like this on my blog again! Had it once...then it disappeared for some reason! This is wonderful!!!

housesbuiltofcards@gmail.com
www.housesbuiltofcards.blogspot.com

Tisha said...

Thanks to both of you for sharing this! I can't wait to see if it works!

ScrapMyWay said...

Let's hear it for TOM and for JANIS who were kind enough to post easy peasy directions for comment numbering on our blog...it worked so y'all come down and comment to your hearts content so I can see how great it works!! This is why I LOVE my blogger peeps...they share ALL the good stuff!!!
creative Wishes,
Claire S.
www.scrapmyway.blogspot.com

Heather said...

THANK YOU FOR THIS AWESOME TUTORIAL!!! YAY!!! I have it on my challenge blog and will add it to my blog too. You rock!!!

Lisa M. (aka Lisabee) said...

It doesn't work on either of my blogs either...not that I can see anyways. Bummer. I love this idea because I DO have contests and having the comments numbered would really help. Oh well! LOL!

Cut It Up Challenge Blog said...

Thank you so much for this! Off to try it out now :)

Sarah said...

Got it! Thank you!!

SiskiyouSue said...

Please pass my thanks to your hubby. And thanks for the easy-to-follow installation instructions. I might have done it without them, but they really speeded things up.

Darlene (SCS:akronstamperdpk) said...

Thank you, thank you, thank you! Please tell hubby I said thanks too! This is going to be SO HELPFUL to me! I have a 4 year Blogaversary Candy going on through this month and it will certainly help with it comes time to draw a winner! Please feel free to come check it out ... and thanks ever so much again! I will be directing my friends to your site!
Hugs from Ohio
Darlene
DAR'S CRAFTY CREATIONS

Crafty Moni said...

Thank you so much for posting this up! So sweet of you to post all the visiual insturctions, very helpful:)I just became a follwer and would love if you stopped by my blog and became a follower as well.

Peace, Love, & Cricut Hugs!
Monica L.

Holly said...

Hey Janis. Thank you so much for this code. I finally remembered to link it with a new post and it worked great! Thanks so much Mrs Smarty Pants...hubby too. Holly :-)

Dee Burns said...

Janis, that is so sweet of you to do this, not only the counter, but instructions too...wow! Your dh must love you very much...he's a keeper...lol. To both of you it's very much appreciated and a big thanks.

Thanks a bunch!
Dee B
Crafdeecat

Tammylee said...

Ya thanks! I just added to my blog!

Jennifer Restivo said...

You are amazing! I've been so sad that numbered comments have gone away. you made my day! Thanks to your husband for figuring it out and thanks to you for sharing! New follower...

Lisa said...

Janis, please tell Tom THANK YOU SO MUCH!! I used to have my comments numbered and it just disappeared. I added this and voila, they're back!! Thank you, thank you, thank you and your hubby for sharing this!! Hugs my sweet friend :)

Lisa
A Mermaid's Crafts

Gail said...

I am sure this is something I will want Janis when I do my next blog candy - I need to research more so I can understand where to install it on my blog - I am a newbie - learning the ropes you know! Tell your hubby Tom - I think it is a wonderful, kind thing he has done -Very much appreciated! Have a great week! ~ Gail ~

DIANA L. said...

Jnis Thank your Hubby I used this on my blog also -- I would have gon e bananas trying to count all the comments.
HUGS!
DIANA L
http://dianamlarson.blogspot.com

Tom's Comment Counter