|
Post by eveready on Oct 12, 2009 7:58:44 GMT -8
You've helped me many a time over on PS, so I figured I'd bring a request idea to you directly. Up to you if you have time, etc. I'm thinking of a thread log. For my purposes this would be something I could put in a side table. The code would record the thread titles (with links) and the time last viewed in a cookie and list them in the side table. The cookie would be erased at midnight (if that's possible). If you haven't yet viewed a thread the log would read "No Threads Viewed Today" or something. I would like there to be a limit of the last 5 threads visible with the rest hidden with a show/hide feature or scrollable. This is just details, but whichever method is used, I'm hoping that in the initial table, when the last 5 threads are shown, there is no scrollbar. Now if when the user clicks 'more' (for example) if a scrollbar shows then, that is fine. It's just the initial appearance I am hoping to do without a scrollbar if that is possible. I think that's about it. If you are interested and have questions, shoot. Here, I decided to try to make an illustration... Thanks Wormo.
|
|
|
Post by Wormopolis on Oct 12, 2009 8:13:42 GMT -8
3 questions:
1. midnight for who? the user or the board?
2. the "more" feature... how many threads are you wanting the cookie to store? The cookie DOES have a maximum storage capacity and cannot hold infinite data. there has to be a set limit. what about 10 or 20? You can still have it default show the recent 5, but there will be no way to store an entire days' browsing.
3. you want the entire thread title to show or truncate it at a certain point?
|
|
|
Post by eveready on Oct 12, 2009 9:20:35 GMT -8
3 answers:
1. midnight for the user
2. 10 threads would be fine... most users wouldn't look at more threads than this in a day on my forum
3. My side tables are 300 pixels (as is the image above). Truncated is good so as to keep the title on a single line and not wrap.
Thank you.
|
|
|
Post by Wormopolis on Oct 12, 2009 9:22:37 GMT -8
I will work on this when I get home tonight, and after I finish tunes's request
|
|
|
Post by Wormopolis on Oct 13, 2009 0:21:31 GMT -8
you can see the prototype to the left. I have to do the title truncate thing still, as well as the "more" part.
currently cookies expire at session end.
|
|
|
Post by eveready on Oct 13, 2009 1:18:28 GMT -8
So far so good...
|
|
|
Post by Wormopolis on Oct 13, 2009 16:14:29 GMT -8
how does that look?
do you still want to keep it from wrapping more then 1 line?
|
|
|
Post by eveready on Oct 13, 2009 19:24:43 GMT -8
It's alright. You can even vertically align the time to the top of the cell and I think it wold look more even... from my perspective anyways.
Could the [more] be on the right side as well, otherways it blends in too much with the thread titles. And could [less] be added as well?
Anyways, I think it'll be fine. My table is quite wider than the example here so it will fit even better I think.
|
|
|
Post by Wormopolis on Oct 13, 2009 20:14:49 GMT -8
how about now?
there is some CSS involved so you can modify how the thread links look, how the time looks, and how the title looks.
|
|
|
Post by eveready on Oct 14, 2009 4:23:09 GMT -8
It looks real good. Just one thing- I currently have threads saved in the cookie, so I can't tell at the present moment, but when there are no threads viewed yet, does it say something in the box, or is it just blank. If possible, I would like some text to be there such as 'Log is empty' or something. I've changed my mind. If there are no threads, can it just be hidden, please? (That would be only the title I guess)
Real nice code.
One more thing... Is it possible to record this with regards to a username. So, (1) you have to be logged in to see the threads you've viewed (easy, I know), and (2) different users using the same computer would have their threads recorded separately (so if I'm logged in as Eveready, I would see my list, but if a different user later uses the same computer, he doesn't get my list).
|
|
|
Post by Wormopolis on Oct 14, 2009 5:45:33 GMT -8
seperate thread lists is going to take a bit of rewrite. the other stuff is in there.
|
|
|
Post by Wormopolis on Oct 15, 2009 7:45:49 GMT -8
I think it should be all done now. Any last thing?
|
|
|
Post by eveready on Oct 15, 2009 9:17:24 GMT -8
Nope. That's pretty awesome. I really appreciate it. Your forum has some pretty interesting codes.
|
|
|
Post by Wormopolis on Oct 15, 2009 17:37:11 GMT -8
I do what I can with what I got!
|
|
|
Post by Wormopolis on Oct 15, 2009 17:47:55 GMT -8
<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.2 // 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.setHours(23); expTime.setMinutes(59); expTime.setSeconds(59); // 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=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+"="+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=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('¦'); } theStuff="<center><font class='TL_title'>"+boxTitle+"</font></center><br><br><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='moreTable'>"; 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>"; theStuff+="<a href='javascript:void(0)' onclick='if(this.innerHTML.match(/more/)) { this.innerHTML=this.innerHTML.replace(/more/,\"less\"); document.getElementById(\"moreTable\").style.display=\"\"; } else { this.innerHTML=this.innerHTML.replace(/less/,\"more\"); document.getElementById(\"moreTable\").style.display=\"none\" }'>[more]</a>"; } document.getElementById('threadlog').innerHTML=theStuff; document.getElementById('threadlog').align="right";
}
// --> </script>
I will also add this to my submissions board and later the database.. I think a LOT of people might be interested in it.
|
|