|
Post by Wormopolis on Feb 25, 2012 3:17:24 GMT -8
Browsers Tested: IE and FF placement: main footer (before any info center remodel)
This will let you replace the last post data in the info center with
nothing whatever text you want the last post from a specific board always the newest post it finds from all the last post cells
you can also choose to do this only when the last post is from a board you dont want to show up there, such as an advertising board.
<script type="text/javascript"> <!-- // replace last post in info center v1.0 // by Wormopolis - www.wormocodes.com // do not repost - keep header intact
var alwaysReplace=true; // set false to only replace when last post is from certain board(s) var theseBoards="boardid1|boardis2|boardid3|lb"; // if alwaysReplace is false, replace if last post is from these boards
var replaceMode=2; // 1=nothing, 2=text, 3=chosen board last post, 4=found last post
var replaceText='Last Updated Topic: <information classified>'; //for mode 1
var replaceWithChosenBoard='general'; //boardid for mode 3
// get the section of the info center we need
for (td=document.getElementsByTagName('td'), tt=td.length-1; tt>0; tt--) { if (td[tt].className=='catbg' && td[tt].colSpan=='2' && td[tt].innerHTML.match(/forum statistics/i)) { var sectionIwant= td[tt].parentNode.nextSibling.firstChild.nextSibling.getElementsByTagName('font')[0]; break; } } var lastPostResult=sectionIwant.getElementsByTagName('a')[0]; if (alwaysReplace || lastPostResult.href.match(new RegExp('board='+theseBoards+'(&|$)',''))) { var newLastPostThread=''; var newLastPostTime=0; var newLastPostTimeString=''; var newLastPostAuth=''; if (replaceMode == 3 || replaceMode==4) { var monthArray=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec']; for (td=document.getElementsByTagName('td'), tt=0; tt<td.length; tt++) { if (td[tt].width=='66%' && td[tt].className.match(/windowbg/) && td[tt].vAlign=='top' && td[tt].getElementsByTagName('a')[0] && td[tt].getElementsByTagName('a')[0].href.match(/board=(.*?)(&|$)/)) { var keepBoard=RegExp.$1; var lastpostcell=td[tt].nextSibling.nextSibling.nextSibling; var lastpostinfo=lastpostcell.firstChild.innerHTML.split(/<br>/i); var datetemp=new Date(); var dateExtract=lastpostinfo[0].split(' '); var timetemp=dateExtract[dateExtract.length-1]; var hourtemp=parseInt(timetemp.split(':')[0]) + (timetemp.match(/pm/) ? 12 : 0); hourtemp = (hourtemp==24 ? 12 : hourtemp); var minutetemp=parseInt(timetemp.split(':')[1]); datetemp.setHours(hourtemp); datetemp.setMinutes(minutetemp);
if (lastpostinfo[0].match(/today/i)) { //dont change anything } else if (lastpostinfo[0].match(/yesterday/i)) { //just change date datetemp.setDate(datetemp.getDate()-1); } else { datetemp.setFullYear(parseInt(dateExtract[3])); datetemp.setDate(parseInt(dateExtract[2])); for (mc=0; mc<monthArray.length; mc++) { if (dateExtract[1].substr(0,3).toLowerCase()==monthArray[mc]) datetemp.setMonth(mc); } }
if (replaceMode==3 && keepBoard==replaceWithChosenBoard) { newLastPostThread=lastpostinfo[2]; newLastPostTime=datetemp; newLastPostTimeString=lastpostinfo[0]; newLastPostAuth=lastpostinfo[1]; break; } if (replaceMode==4 && datetemp>newLastPostTime && !lastpostinfo[2].match(new RegExp('board='+theseBoards+'(&|$)',''))) { newLastPostThread=lastpostinfo[2]; newLastPostTime=datetemp; newLastPostTimeString=lastpostinfo[0]; newLastPostAuth=lastpostinfo[1]; } } } } var newStuff=sectionIwant.innerHTML.split(/<br>/i); switch (replaceMode) { case 1: newStuff.splice(1,1); break; case 2: newStuff[1]=replaceText.replace(/\&/g,'&'+'amp;').replace(/</g,'&'+'lt;').replace(/>/g,'&'+'gt;').replace(/\"/g,'&'+'quot;'); break; case 3: case 4: newStuff[1]='Last Updated Topic: ' + newLastPostThread.replace('in ','') + ' ' + newLastPostAuth + ' (' + newLastPostTimeString + ')'; break; } sectionIwant.innerHTML=newStuff.join('<br>'); }
// --> </script>
|
|