|
Post by Wormopolis on Oct 15, 2009 17:54:39 GMT -8
Browser tested: IE and FF placement: global footer
you will need a DIV element with id="threadlog" somewhere ABOVE the code for this to work. it could be in a side table or regular table, or even in the floating table I have on the left.
Thread Log keeps track of the last 10 or so threads you have looked at for the day. the list auto-resets at midnight. LIST NOW LASTS FOR 24 HOURS
comes with some CSS so you can style how the text looks in the list.
code:
<style type="text/css"> .TL_title {font-size: 12pt;} .TL_threadEntry {font_size: 8pt;} .TL_timeEntry {font-size: 8pt; width: 60px; text-align: right; vertical-align: top;} </style>
<script type="text/javascript"> <!-- // Thread Log v 1.71 // by Wormopolis -- concept by Eveready // do not repost - keep header intact
var defaultThreadShow = 5; //number showing before "[more]" button shows up var maxThreadStore = 10; var boxTitle = "Daily Thread Log"; var emptythreadListMessage = "thread log is empty"; var hideTableInstead=true; //set true if you want thread log hidden when empty var multipleUsers=true; //set true if you want multiple users on the same computer to have discreet thread logs var guestsHaveThreadlog=true; //set true if you want guests to see a threadlog
// You will need a DIV element called "threadlog" somewhere on the page to display list // no need to edit below
var TL_id_array= new Array(); var TL_title_array= new Array(); var TL_date_array= new Array();
if (document.getElementById('threadlog')) { if (hideTableInstead) document.getElementById('threadlog').style.display="none"; cookieMod=(multipleUsers ? ':'+pb_username : ''); if (location.href.match(/action=display/) && (pb_username!='Guest' || guestsHaveThreadlog)) { temp=location.href.match(/board=(.*?)&/); board_id=RegExp.$1; temp=location.href.match(/thread=(\d+)/); thread_id=RegExp.$1; holdme=board_id+":"+thread_id; for (fnts=document.getElementsByTagName('font'), f=0; f<fnts.length; f++) { if (fnts[f].className=='cattext' && fnts[f].innerHTML.match(/(Topic|Announcement): (.*?) \(/)) { thread_title=RegExp.$2; break; } } tempDate=new Date(); timeStamp=tempDate.toLocaleTimeString(); timeStamp=timeStamp.split(' '); timeStamp[0]=timeStamp[0].split(':'); timeStamp[0].pop(); timeStamp[0]=timeStamp[0].join(':'); timeStamp=timeStamp.join(' '); expTime=tempDate; expTime.setDate(expTime.getDate()+1);
// check cookie for thread list and update it chk=new RegExp("TL_idlist"+cookieMod+"=(.*?)(;|$)",''); if (document.cookie.match(chk)) { // list exists, check to see if current thread is already in it temp=RegExp.$1; TL_id_array=temp.split('¦'); chk = new RegExp("TL_titlelist"+cookieMod+"=(.*?)(;|$)",''); if (document.cookie.match(chk)) { temp=unescape(RegExp.$1); TL_title_array=temp.split('¦'); } chk = new RegExp("TL_datelist"+cookieMod+"=(.*?)(;|$)",''); if (document.cookie.match(chk)) { temp=RegExp.$1; TL_date_array=temp.split('¦'); }
for (ii=0; ii<TL_id_array.length; ii++) { if (TL_id_array[ii]==holdme) { hold=TL_id_array.splice(ii,1); hold=TL_title_array.splice(ii,1); hold=TL_date_array.splice(ii,1); break; } } TL_id_array.unshift(holdme); TL_title_array.unshift(thread_title); TL_date_array.unshift(timeStamp); if (TL_id_array.length > maxThreadStore) { hold=TL_id_array.pop(); hold=TL_title_array.pop(); hold=TL_date_array.pop(); } } else { // no list exists... start a new one TL_id_array.unshift(holdme); TL_title_array.unshift(thread_title); TL_date_array.unshift(timeStamp); } document.cookie=("TL_idlist"+cookieMod+"="+TL_id_array.join('¦')+";expires="+expTime); document.cookie=("TL_titlelist"+cookieMod+"="+escape(TL_title_array.join('¦'))+";expires="+expTime); document.cookie=("TL_datelist"+cookieMod+"="+TL_date_array.join('¦')+";expires="+expTime); } chk = new RegExp("TL_idlist"+cookieMod+"=(.*?)(;|$)",''); if (document.cookie.match(chk)) { temp=RegExp.$1; TL_id_array=temp.split('¦'); } chk = new RegExp("TL_titlelist"+cookieMod+"=(.*?)(;|$)",''); if (document.cookie.match(chk)) { temp=unescape(RegExp.$1); TL_title_array=temp.split('¦'); } chk = new RegExp("TL_datelist"+cookieMod+"=(.*?)(;|$)",''); if (document.cookie.match(chk)) { temp=RegExp.$1; TL_date_array=temp.split('¦'); } function toggleTLdisplay() { var tmpdt=new Date(); if (document.getElementById('TLdisplay').style.display=='none') { document.getElementById('TLdisplay').style.display=''; tmpdt.setFullYear(tmpdt.getFullYear()+1); document.cookie="TLdisplay=true; expires="+tmpdt; } else { document.getElementById('TLdisplay').style.display='none'; tmpdt.setFullYear(tmpdt.getFullYear()-1); document.cookie="TLdisplay=false; expires="+tmpdt; } } var TLdisp=(document.cookie.match(/TLdisplay=true/) ? '' : 'none'); theStuff="<center><font class='TL_title' onmouseover='this.style.textDecoration=\"underline\";' onmouseout='this.style.textDecoration=\"none\";' onclick='toggleTLdisplay()' >"+boxTitle+"</font></center><br><div id='TLdisplay' style='display:"+TLdisp+"'><table width='100%' >"; if (TL_id_array.length==0) { theStuff+="<tr><td><center>"+emptythreadListMessage+"</center></td></tr>"; } else { document.getElementById('threadlog').style.display=""; } inter=(TL_id_array.length>defaultThreadShow ? defaultThreadShow : TL_id_array.length); for (tl=0; tl<inter; tl++) { brdnum=TL_id_array[tl].split(":")[0]; thrnum=TL_id_array[tl].split(":")[1]; linktemp="/index.cgi?board="+brdnum +"&action=display&thread="+thrnum; theStuff+="<tr><td><a class='TL_threadEntry' href='"+linktemp+"'>"+ TL_title_array[tl] +"</a></td><td class='TL_timeEntry'>" + TL_date_array[tl] +"</td></tr>"; } theStuff+="</table>"; if (inter<TL_id_array.length) { theStuff+="<table width='100%' style='display:none' id='TLmoreTable'>"; for (tl2=inter; tl2<TL_id_array.length; tl2++) { brdnum=TL_id_array[tl2].split(":")[0]; thrnum=TL_id_array[tl2].split(":")[1]; linktemp="/index.cgi?board="+brdnum +"&action=display&thread="+thrnum; theStuff+="<tr><td><a class='TL_threadEntry' href='"+linktemp+"'>"+ TL_title_array[tl2] +"</a></td><td class='TL_timeEntry'>" + TL_date_array[tl2] +"</td></tr>"; } theStuff+="</table><table id='TL_moreless'><tr><td class='TL_timeEntry' colSpan='2' align='right'>"; theStuff+="<a href='javascript:void(0)' onclick='if(this.innerHTML.match(/more/)) { this.innerHTML=this.innerHTML.replace(/more/,\"less\"); document.getElementById(\"TLmoreTable\").style.display=\"\"; } else { this.innerHTML=this.innerHTML.replace(/less/,\"more\"); document.getElementById(\"TLmoreTable\").style.display=\"none\" }'>[more]</a>"; theStuff+="</td></tr></table></div>"; } document.getElementById('threadlog').innerHTML=theStuff; document.getElementById('threadlog').align="right";
}
// --> </script>
preview: look to the left.
|
|
|
Post by eveready on Dec 26, 2009 8:11:40 GMT -8
Hey Wormo, hope you had a great Christmas.
I'm just wondering, with this code, is it possible to have it in a table that is only on the main page?
It seems to only create the cookie if the <div> element is in the global header but not if the div is placed in the main header.
Just wondering.
|
|
|
Post by Wormopolis on Dec 26, 2009 10:21:52 GMT -8
so you only want it to work when its on the main page then?
|
|
|
Post by Wormopolis on Dec 26, 2009 10:23:28 GMT -8
change the last 2 lines: document.getElementById('threadlog').innerHTML=theStuff; document.getElementById('threadlog').align="right";
to be: if (document.getElementById('threadlog')) { document.getElementById('threadlog').innerHTML=theStuff; document.getElementById('threadlog').align="right"; }
|
|
|
Post by eveready on Dec 26, 2009 10:56:08 GMT -8
hmmmmmmm.... no luck.
I have the <div id="threadlog"></div> part in a table at the top of the main page.
I have the actual code in the global footers. But when I view a new thread, it is not adding it to the list.
If I have both parts in global, then it works. But it's a no go when I split them up.
|
|
|
Post by Wormopolis on Dec 26, 2009 12:00:20 GMT -8
I need a URL to see something
|
|
|
Post by eveready on Dec 26, 2009 21:39:08 GMT -8
|
|
|
Post by Wormopolis on Dec 28, 2009 8:18:09 GMT -8
change this to true for me:
var guestsHaveThreadlog=false;
|
|
|
Post by eveready on Dec 28, 2009 9:51:12 GMT -8
It's good to go.
|
|
|
Post by Wormopolis on Dec 28, 2009 12:02:39 GMT -8
I see what it is. I was trying to keep an error from happening if the DIV wasnt present so it doesnt run the code if it doesnt see it.
find these lines:
if (document.getElementById('threadlog')) { if (hideTableInstead) document.getElementById('threadlog').style.display="none";
change to:
if (document.getElementById('threadlog') && hideTableInstead) document.getElementById('threadlog').style.display="none";
find these lines:
if (TL_id_array.length==0) { theStuff+="<tr><td><center>"+emptythreadListMessage+"</center></td></tr>"; } else { document.getElementById('threadlog').style.display=""; }
change to:
if (TL_id_array.length==0) { theStuff+="<tr><td><center>"+emptythreadListMessage+"</center></td></tr>"; } else { if (document.getElementById('threadlog')) document.getElementById('threadlog').style.display=""; }
and these lines:
if (document.getElementById('threadlog')) { document.getElementById('threadlog').innerHTML=theStuff; document.getElementById('threadlog').align="right"; } }
delete the last }
if (document.getElementById('threadlog')) { document.getElementById('threadlog').innerHTML=theStuff; document.getElementById('threadlog').align="right"; }
|
|
|
Post by eveready on Dec 28, 2009 19:42:32 GMT -8
Works real good. Thanks so much.
|
|
¢ØRTÄñÄ
Not New Member
Keep your head down, there's two of us in here now!
Posts: 10
¢ØRTÄñÄ said 0 great things
|
Post by ¢ØRTÄñÄ on Jan 9, 2010 0:17:15 GMT -8
hi, i have your floating nav tree, and would like to put the thread log in it, where would i play it?
|
|
|
Post by Wormopolis on Jan 9, 2010 6:23:28 GMT -8
since you already have the HTML table setup for the floating nav table, I would just add a new row into that table with the DIV element it needs in it.
|
|
¢ØRTÄñÄ
Not New Member
Keep your head down, there's two of us in here now!
Posts: 10
¢ØRTÄñÄ said 0 great things
|
Post by ¢ØRTÄñÄ on Jan 9, 2010 19:49:17 GMT -8
Could you help me with that, im not to good with HTML
|
|
|
Post by Wormopolis on Jan 10, 2010 2:24:25 GMT -8
<div width="10%" id="floatNav"> <table cellspacing="1" cellpadding="0" border="0" align="left" valign="top" width="120" bgcolor="0066FF" class="bordercolor"> <tr><td> <table border="0" width="100%" cellpadding="2" cellspacing="0"> <tr> <td align="left" valign="top" class="welcomebg" bgcolor="000000"> <div valign="top" id="nvtree"></div> </td> </tr> </table> <tr><td> <div id="threadlog"></div> </td></tr> </td></tr></table></div>
|
|