To make the expand all and contract all links not require reloading do the following:
In the showthread template find
Code:
function expand(listID) {
and add above that:
Code:
function contractAll() {
var aDivs=document.body.getElementsByTagName("div");
for (x=0;x<aDivs.length;x++) {
if (/^p[0-9]{1,8}h$/.test(aDivs[x].id)) {
aDivs[x].style.display="";
} else if (/^p[0-9]{1,8}e$/.test(aDivs[x].id)) {
aDivs[x].style.display="none";
}
}
window.event.cancelBubble=true;
}
function expandAll() {
var aDivs=document.getElementsByTagName("div");
for (x=0;x<aDivs.length;x++) {
if (/^p[0-9]{1,8}e$/.test(aDivs[x].id)) {
aDivs[x].style.display="";
} else if (/^p[0-9]{1,8}h$/.test(aDivs[x].id)) {
aDivs[x].style.display="none";
}
}
window.event.cancelBubble=true;
}
Then in the showthread_hideposts template find
Code:
<a href="showthread.php?threadid=$thread[threadid]&s=$session[sessionhash]&perpage=$perpage&pagenumber=$pagenumber&display=show">
and replace that with
Code:
<a href="#" onclick="expandAll();return false;">
Then find also in the showthread_hideposts template
Code:
<a href="showthread.php?threadid=$thread[threadid]&s=$session[sessionhash]&perpage=$perpage&pagenumber=$pagenumber&display=none">
and replace that with
Code:
<a href="#" onclick="contractAll();return false;">
And for Bira, feel free to use this in an update to the full hack if you find it worthwhile.