I did it like this …
inlinecomments.php
change
echo "<ul class=\"commentlist inlinecomments\">\n";
to
echo "<ul class=\"commentlist inlinecomments\" style=\"display: none;\">\n";
This makes comments hidden to begin with.
index.php
change
<a href="#" id="togglecomments"><?php _e('Hide threads', 'p2'); ?></a>
to
<a href="#" id="togglecomments"><?php _e('Show threads', 'p2'); ?></a>
This just changes the words at the top of the page.
So it says “Hide threads” to begin with.
p2.js
change
$("#togglecomments").click(function(){
hidecomments = !hidecomments;
var hideTxt = p2txt.hide_threads;
var showTxt = p2txt.show_threads;
if (hidecomments) {
commentLoop = false;
commentsLists.hide();
$(this).text(showTxt);
} else {
commentsLists.show();
$(this).text(hideTxt);
}
return false;
});
to
$("#togglecomments").click(function(){
hidecomments = hidecomments; // REMOVE !
var hideTxt = p2txt.hide_threads;
var showTxt = p2txt.show_threads;
if (hidecomments) {
commentLoop = false;
commentsLists.hide();
$(this).text(showTxt);
} else {
commentsLists.show();
$(this).text(hideTxt);
}
hidecomments = !hidecomments; // ADD THIS LINE
return false;
});
This makes the first click action to be ‘showTxt’.
I can’t find the code that actually replaces style=”display: none;” with style=”display: block;” but it works anyway.