Post by Anaiu on Jun 21, 2013 23:01:49 GMT -8
Okay, so on a v4 site I am on (link), we're using HPs board mod and we've had issues with the "last post" part of this code. The last post text on the threads looked like this (problems are red): "Last Post: Count to 1000 by by Foxx (undefined)". The (undefined) part is, of course the timestamp. Now, the timestamp looks fine if the last post was a couple of days or longer ago (example: "Last Post: Plot by by Foxx (Jan 21, 2012, 11:38am)"); however, anything with a "Today" or "Yesterday" timestamp is instead saying undefined.
I was able to correct the "by by" problem easily enough, but I cannot figure out how to fix the latter problem. I found one other post with this problem on another site, and following the advice given there, I looked for bad HTML or HTML inside scripts, but nothing jumped out at me. I also tried shuffling the codes around a bit in this footer, but with no effect.
Here is a copy of our main footer. I can supply others if needed; there is nothing in the main header.
I was able to correct the "by by" problem easily enough, but I cannot figure out how to fix the latter problem. I found one other post with this problem on another site, and following the advice given there, I looked for bad HTML or HTML inside scripts, but nothing jumped out at me. I also tried shuffling the codes around a bit in this footer, but with no effect.
Here is a copy of our main footer. I can supply others if needed; there is nothing in the main header.
<script type="text/javascript">
<!--
// Category or title text to image
var tCat = document.getElementsByTagName("td");
function textToImage(text,image){
for(t = 0; t < tCat.length; t ++){
var re = new RegExp("<b>" + text.replace(/([\*\+\.\/]+)/, "\\$1") + "</b>","i");
if(tCat.item(t).className.match(/^(cat|title)bg/i) && tCat.item(t).innerHTML.match(re)){
tCat.item(t).innerHTML = tCat.item(t).innerHTML.replace(re, "<img src='" + image + "'>");
}
}
}
textToImage("Basics","http://img534.imageshack.us/img534/3892/basicsd.png");
textToImage("Character Information","http://img163.imageshack.us/img163/242/charactere.png");
textToImage("Aurora","http://img15.imageshack.us/img15/6254/auroratr.png");
textToImage("Nightfall","http://img706.imageshack.us/img706/375/nightfalla.png");
textToImage("The Exiled","http://img594.imageshack.us/img594/2695/exiled.png");
textToImage("Rogue Lands","http://img801.imageshack.us/img801/8493/roguej.png");
textToImage("Out of Character","http://img35.imageshack.us/img35/4646/oocf.png");
//-->
</script>
<script type="text/javascript">
/* HP's Board Mod v1.0 by hpmad
Do not repost or claim as your own
Without permission from creator */
var modStart = ' '; // the beginning of the moderator display
var modEnd = ' '; // the end of the moderator display
var boardnameWidth = '27%'; //the width of the board name cell, in pixels or percent
var descriptionWidth = '53%'; //the width of the description cell, in pixels or percent
var threadspostsWidth = '15%'; //the width of the posts/threads cell, in pixels or percent
var onoffWidth = '5%'; //the width of the on/off button cell, in pixels or percent
var td = document.getElementsByTagName('td');
if(location.href.match(/\.com(\/(index\.cgi(#\w+|\?(action=home)?)?)?)?$/)){
for(i=0;i<td.length;i++){
if(td[i].width=='66%'){
var moderators = td[i].innerHTML.match(/Moderator(s)?:/i) ? td[i].getElementsByTagName('i')[0].innerHTML:'Moderator: <i>none</i>';
var topics = td[i+1].getElementsByTagName('font')[0].innerHTML;
var posts = td[i+2].getElementsByTagName('font')[0].innerHTML;
var boardName = '<font size="2"> '+td[i].getElementsByTagName('font')[0].innerHTML+' </font>';
var description = td[i].innerHTML.split(/<br\s?\/?>/i)[1];
if(td[i+3].getElementsByTagName('font')[0] && td[i+3].getElementsByTagName('font')[0].innerHTML.match(/<br\s?\/?>(.+?)<br\s?\/?>/i)){
var lastPostMem = RegExp.$1;
var lastPostMem = '<font size="1">'+lastPostMem+'</font>';
if(!td[i+3].getElementsByTagName('a')[0].href.match(/board=/i)){
var lastPostThread = '<font size="1"><a href="'+td[i+3].getElementsByTagName('a')[1].href+'">'+ td[i+3].getElementsByTagName('a')[1].innerHTML +'</a></font> ';
var lastPostDate = '<font size="1">('+td[i+3].innerHTML.split(/<br>/i)[0].split("on ")[1]+')</font>';
}else{
var lastPostThread = '<font size="1"><a href="'+td[i+3].getElementsByTagName('a')[0].href+'">'+ td[i+3].getElementsByTagName('a')[0].innerHTML +'</a> </font> ';
var lastPostDate = '<font size="1">('+td[i+3].innerHTML.split(/<br>/i)[0].split("on ")[1]+')</font>';
}
}else{
var lastPostMem = '<i>none</i>';
var lastPostThread = '';
var lastPostDate = '';
}
var onoff = td[i-1].innerHTML;
td[i].innerHTML = '<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td width="'+boardnameWidth+'">'+boardName+'</td><td width="'+descriptionWidth+'">'+description+'</td><td rowspan="2"><font size="1">Threads: '+topics+'<br>Posts: '+posts+'</td><td valign="middle" rowspan="2" width="'+onoffWidth+'">'+onoff+'</td></tr><tr><td><font size="1">Last Post: '+lastPostThread+lastPostMem+'<br>'+lastPostDate+'</font></td><td><font size="1">'+modStart+moderators+modEnd+'</font></td></tr></table>';
td[i-1].style.display = 'none';
td[i].colSpan = '2';
}
if(td[i].width=='1%' && td[i+1].width=='1%'){
td[i].style.display = 'none';
td[i+1].style.display = 'none';
td[i+2].style.display = 'none';
}
if(td[i].className=='catbg' && td[i].colSpan=='5'){
td[i].colSpan = '1';
}
}
}
</script>
<script type="text/javascript">
<!--
// Legend in info center.
// Created by PopThosePringles
var iLegend = [
["Administrator", "000000"],
["Coding Queen", "373d63"],
["Ambassador", "f1f1f1"],
["Mascot", "461919"],
["Aurora", "b2d2d4"],
["Nightfall", "2e1d4b"],
["The Exiled", "283f1e"],
["Rogues", "5f1212"],
["OOC Account", "9bcb90"]
];
var iDiv = document.createElement("div");
var iTable = document.getElementsByTagName("table");
for(t = 0; t < iTable.length; t ++){
if(iTable.item(t).width == "98%" && iTable.item(t).cellPadding == "3"){
if(iTable.item(t).rows.item(0).innerHTML.match(/Most users online/)){
var nCell = iTable.item(t).insertRow(iTable.item(t).rows.length).insertCell(0);
for(l = 0; l < iLegend.length; l ++){
var nSpan = document.createElement("span");
nSpan.align = "center"
nSpan.style.color = iLegend[l][1];
nSpan.style.fontSize = 9;
nSpan.appendChild(document.createTextNode(iLegend[l][0]));
iDiv.appendChild(nSpan);
if(l != (iLegend.length - 1)){
iDiv.appendChild(document.createTextNode(" - "));
}
}
iDiv.align = "center";
nCell.appendChild(iDiv);
}
}
}
//-->
</script>