Post by Todge on Jul 29, 2009 12:50:26 GMT -8
This will add a table between your forum table and the info center on your home page listing your 10 most recent posts. No editing is required.
The code stores the information in cookies as you post, so the table will not be fully populated until you have posted 10 times AFTER the code is in place..
Put it at the top of your Global Footer..
The code stores the information in cookies as you post, so the table will not be fully populated until you have posted 10 times AFTER the code is in place..
Put it at the top of your Global Footer..
<center style="display: none;" id="pTable"><table class="bordercolor" border="0" cellpadding="4" cellspacing="1" width="100%"><tbody><tr><td class="titlebg" align="center"><font class="text1" size="2"><b>Your most recent posts</b></font></td></tr>
<tr><td class="windowbg" id="lastPosts" align="center"></td><tr></tbody></table><br><br></center>
<script type="text/javascript">
<!--
/*
10 previous threads you posted on..
by Todge
Copyright © 2007
Please keep this header intact
*/
function setThreadCookie(cName,cValue)
{
var cookieTime = 12;
if(cName == 'remove')
{
cName = 'setcookie';
cookieTime = -1;
}
if(cName == 'threads' && document.cookie.match('threads='))
{
var threads = document.cookie.split(/threads=/)[1].split(';')[0].split('|');
if(threads.length > 9)
{
threads.length = 9;
}
cValue = cValue+'|'+threads.join('|');
}
var exdate=new Date();
exdate.setMonth(exdate.getMonth()+cookieTime);
document.cookie=cName+ "=" +cValue+ ";expires="+exdate.toGMTString();
}
if(document.postForm)
{
if(window.addEventListener)
{
document.postForm.addEventListener('submit', setThreadCookie('setcookie','yes'), false);
}
else if(window.attachEvent)
{
document.postForm.attachEvent('onsubmit', setThreadCookie('setcookie','yes'));
}
else
{
document.postForm.onsubmit = setThreadCookie('setcookie','yes');
}}
if(location.href.match(/tion=display/) && location.href.match(/thread=/) && document.cookie.match(/setcookie/))
{
setThreadCookie('remove','');
var postLink = document.getElementsByTagName('a');
var topic = document.getElementsByTagName('font');
for(p=postLink.length-1; p>1; p--)
{
if(postLink[p].innerHTML == 'Link to Post')
{
postLink = postLink[p].href.split('/index.cgi?')[1];
break;
}}
for(t=0; t<topic.length; t++)
{
if(topic[t].className == 'cattext' && topic[t].parentNode.className == 'catbg' && topic[t].parentNode.width == '80%')
{
topic = topic[t].innerHTML.split('Topic: ')[1].split(' (Read ')[0];
break;
}}
setThreadCookie('threads',topic+'('+postLink+')');
}
if(document.title.match(/- Home$/) && document.cookie.match('threads='))
{
var info = document.getElementsByTagName('table');
var pTable = document.getElementById('lastPosts');
var yourPosts = document.cookie.split('threads=')[1].split(';')[0].split('|');
pTable.innerHTML = '<a href=/index.cgi?'+yourPosts[0].split('(')[1].split(')')[0]+'>'+yourPosts[0].split('(')[0]+'</a>';
for(y=1; y<yourPosts.length; y++)
{
pTable.innerHTML += '<br><a href=/index.cgi?'+yourPosts[y].split('(')[1].split(')')[0]+'>'+yourPosts[y].split('(')[0]+'</a>';
}
for(i=0; i<info.length; i++)
{
if(info[i].className == "bordercolor" && info[i].innerHTML.match(/Info Center/))
{
info[i].parentNode.insertBefore(document.getElementById('pTable'),info[i]);
document.getElementById('pTable').style.display = '';
break;
}}}
// -->
</script>