April 28, 2004

Thingys & Doodads - III

In this edition of Thingys & Doodads we'll look at an expanding / collapsing comment script from the Scripty Goddess.

One way to make your site more reader-friendly is to provide a show/hide comments script. This script will show or "roll-down" your comments in the current window by clicking on a link displayed between your post text and your byline. Then you can click another link and hide or "roll-up" the comments.

I have modified the original Scripty Goddess code a little by inserting code to display a horizontal line between each comment. This makes separating and reading each somment a little easier.

Installation instructions:

Cut and paste the following code between the tags in every page that you want to utilize the script:

<!-- Begin Scripty Goddess Show/Hide Comments -->
<script language="javascript">
function showMoreComments(varA12, varB12){
var1232 = ('varXYZ2' + (varA12));
varABC2 = ('varP2' + (varA12));
if( document.getElementById ) {
if( document.getElementById(var1232).style.display ) {
if( varB12 != 0 ) {
document.getElementById(var1232).style.display = "block";
document.getElementById(varABC2).style.display = "none";
} else { document.getElementById(var1232).style.display = "none";
document.getElementById(varABC2).style.display = "block"; }
} else { location.href = varB12;
return true; }
} else { location.href = varB12;
return true; }
<!-- Begin Show/Hide Comments -->

Next, in the section of the Main Index Template, cut and paste the following code in above the code that says “Posted By…”:

<!-- Begin Scripty Goddess Show/Hide Comments -->

<span id="varP2<$MTEntryID$>" class="extended">
<a href="<$MTEntryLink$>#<$MTEntryID pad="1"$>" onclick="showMoreComments(<$MTEntryID$>,'<$MTEntryLink$>#<$MTEntryID pad="1"$>');return false;">
Show Comments »
<div id="varXYZ2<$MTEntryID$>" style="display: none">

<hr width="100%" size="1px" color="#000000" align="left" />

posted by <$MTCommentAuthorLink$> at <$MTCommentDate$>
<br />

<hr width="100%" size="1px" color="#000000" align="left" />


<a href="#<$MTEntryID pad="1"$>" onclick="showMoreComments(<$MTEntryID$>,0);return
« Hide Comments

<!-- End Goddess Show/Hide Comments -->

[SAVE] and Rebuild indexes only, or whatever archives you decide to install the script in. I would recommend installing it in the all but the Individual Entry Archives.

You can customize the lines that say Show Comments and Hide Comments to say whatever you want them to say.

You can also customize the horizontal line width and color and size properties to make your color schemes etc.

If you have any problem installing this script, let me know and I'll give you a hand.

Note: This script sometimes does a funky disappearring text magic trick. It only does it in some sites, not all of them. You will have to install it and test it for yourself. As usual, make a backup copy of your Main Index Template before making modifications.

Tomorrow: In-line Show/Hide script for php sites.

Posted by Madfish Willie at April 28, 2004 11:52 PM

Okay Madfish - so what if we want to add an excerpt of pings to the expand-y script thing?

Posted by Daniel at April 29, 2004 03:48 PM

Just looking at the code and what it does, I would try inserting the code to display excerpts after the </MTComments> tag. If that doesn't work, this is Scripty Goddess' code, so I would go ask her for assistance.

Posted by Madfish Willie at April 29, 2004 06:14 PM

After a long search, I finally found your site. My granny used to say, that you must never give up to reach a certain aim.
So keep on going like I did it recently.

Posted by Cathy Lee at November 23, 2004 10:53 AM

Really good work. I found a lot of profound information which can help me to go on. Thanks for all this input.

Posted by Jamie Lee at January 19, 2005 09:18 AM

wave tidal wave tidal wave asia tsunami thailand tsunami tsunami thailand tsunami tsunami disaster wave tsunami missing satellite picture of tsunami asia tsunami tsunami missing tsunami wave picture tsunami satellite asian tsunami tsunami satellite tsunami wave picture tsunami victim wave

Posted by tsunami footage at February 22, 2005 10:06 AM
Live Comment Preview
Post a comment

Remember personal info?