1 (edited by ShawnBrown 2005-01-12 07:55)

Topic: New Post Indicator Management (volunteers?)

During an earlier discussion about new post indicator tracking, I decided to make a JavaScript-only new post manager.

I have a working version of this now--I'm calling it PunJS New Posts. If anyone's feeling brave--and would like new post indicator management--you can install it on your forum but be warned that it's only been tested with a single account on an untrafficked test forum. That said, I don't expect it to behave too badly and since it's client-side script it can't cause any real harm.

To install it, copy new_posts.js into your forum directory (PunBB 1.2 only please!) and add a simple script tag in main.tpl to load it as an external file...

<script type="text/javascript" src="http://yoursite.com/forum/new_posts.js"></script>

If anyone installs this, let me know how it works out--and if you have problems with it.

Note: This isn't the final version but I don't have enough traffic on my own forum to give it any more of a test than I already have.

Issues:
- If you've modded your install of PunBB and added extra tables inside the punwrap DIV, you may encounter problems (but maybe not).
- If user-posting is disabled in a forum, the script might not be able to mark that forum's new posts as having been read.

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

Re: New Post Indicator Management (volunteers?)

any screenshots?  i have no idea what it does.  willing to try it after someone makes a PM and Poll system for 1.2

3 (edited by ShawnBrown 2005-01-20 07:34)

Re: New Post Indicator Management (volunteers?)

Here's a screenshot...

[Edit: image removed, see the new screenshot instead]

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

Re: New Post Indicator Management (volunteers?)

nice! i cant wait to try this out once the other guys get the PM and poll working big_smile

Re: New Post Indicator Management (volunteers?)

Very nice. I will definately be checking this out when I get back from work.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: New Post Indicator Management (volunteers?)

Super!!!
very very very nice!!!

7

Re: New Post Indicator Management (volunteers?)

I really like this idea. Good Stuff.

8 (edited by XuMiX 2005-01-10 14:24)

Re: New Post Indicator Management (volunteers?)

a small question then, how does this script determine that topic is new? i mean does it mark topic read immediately after entering it ?

9

Re: New Post Indicator Management (volunteers?)

Nice, I'll try it out.

Re: New Post Indicator Management (volunteers?)

XuMiX wrote:

a small question then, how does this script determine that topic is new? i mean does it mark topic read immediately after entering it ?

the javascript makes it's own cookies

11 (edited by XuMiX 2005-01-10 14:30)

Re: New Post Indicator Management (volunteers?)

hmm. ok...
BTW i've made smth same but at server-side and not using any timeout schemes http://punbb.org/forums/viewtopic.php?id=5297
its not very pretty, but i'll improve it, when i add it to my forum
i don't like huge javascripts smile especially on slow computers.. yeah..

12 (edited by ShawnBrown 2005-01-10 17:27)

Re: New Post Indicator Management (volunteers?)

XuMiX wrote:

a small question then, how does this script determine that topic is new? i mean does it mark topic read immediately after entering it ?

When a page loads, the script looks at the first cell in each row--if it sees an inew class DIV, it adds that topic's id to the cookie along with an unread mark. If the topic gets timed-out, the cookie still has a record of the topic and its status. The cookie also stays small--only recording what it needs to. If a topic has been read and has timed-out, its entry is removed from the cookie.

Since this is currently a "session" cookie, all of this is cleared when the browser window closes. I'm thinking about changing its behavior slightly though.

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

Re: New Post Indicator Management (volunteers?)

one thing that would be cool is if instead of just making them as old topics it marked them in a new colour so you could see what was new even if you've read it... since i actually quite like the PunBB way of new topics now i'm used to it wink

Re: New Post Indicator Management (volunteers?)

Connorhd wrote:

one thing that would be cool is if instead of just making them as old topics it marked them in a new colour so you could see what was new even if you've read it...

This is certainly possible. Right now it assigns inormal to the DIVs as the messages are read... but a 3rd class could be assigned just-as-easily. Maybe something like ioff. If this is done, the array pruning will need to be modified to make the display operate intuitively... not really a problem though.

I could add an option for this after I'm sure the script works well in its current state. If it is added, the use of a 3rd class will not be the default behavior--I'd like the script to lay seamlessly over an out-of-the-box install of PunBB.

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

15 (edited by ShawnBrown 2005-01-20 07:36)

Re: New Post Indicator Management (volunteers?)

I just made a slight change to the script (it's still available at the same location - new_posts.js).

The script was assigning a punhover class to rows so they'd change color on mouseover...

[Edit: image removed from server]

...but I don't think it's appropriate for a new-indicator-management script to assign unrelated onmouseover/onmouseout events. (This should be a completely separate add-on.)

DIFFERENT TOPIC: In the screenshot above, I've declared STRONG { font-weight : normal }. But instead of this, I'm going to have the script alter the assigned font-weight of the timed-out-but-unread messages so they mirror the default or CSS-declared STRONG style.

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

16 (edited by Connorhd 2005-01-10 22:11)

Re: New Post Indicator Management (volunteers?)

I could add an option for this after I'm sure the script works well in its current state. If it is added, the use of a 3rd class will not be the default behavior--I'd like the script to lay seamlessly over an out-of-the-box install of PunBB.

i was thinking along the lines of this being in 1.2.1 wink

however i don't know if that is what anyone else was thinking...

17 (edited by ShawnBrown 2005-01-20 07:36)

Re: New Post Indicator Management (volunteers?)

I have an updated--and much improved--version of the script online now (new_posts.js). I decided to scrap the "STRONG-style copying" idea and do a proper rebuild of the "tclcon" DIV in the node tree. So instead of looking like a <strong> tag, it actually is a <strong> tag. Also, the <strong> is removed for messages marked as read.

[Edit: image removed, see the new screenshot instead]

Additionally, the "There are new posts" text in the "nosize" DIV is added/removed as appropriate. All of this DOM-node manipulation can be confirmed in Firefox by choosing: View > Page Style > No Style. And persistent cookies are currently turned off until the script supports reply-number tracking for marked-as-read posts.

i was thinking along the lines of this being in 1.2.1 wink...

I'd be happy if it were someday part of the core but I'm content with it being simply an add-on as well.

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

Re: New Post Indicator Management (volunteers?)

Question for Rickard:

I'm getting ready to add a [ New posts ] link for timed-out messages but I have a question: the normal [ New posts ] link uses the href: viewtopic.php?id=TOPICID&action=new.

Now when I append &action=new to an old post (e.g. 1.0 Preview) I'm taken to the last message in that topic.

So I see that this works... but can I use this as a reliable way to reach a topic's last post? Or should I use a different method (like building a proper pid=POSTNUM#pPOSTNUM link) instead?

Next Revision Will Include...
- [ New posts ] link for unread-but-timed-out messages
- last-post tracking for messages that aren't timed-out

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

Re: New Post Indicator Management (volunteers?)

&action=new gets the latest post you haven't read or if you have read them the last posts, so for timed out posts it will always be the last post (i think)

Re: New Post Indicator Management (volunteers?)

What he said smile It takes you to the first new post or the last post if there is no new post. If you want to get to the last post every time, you can use action=last

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: New Post Indicator Management (volunteers?)

Updated version...

http://shawnbrown.com/new_posts4.png
The new version is available at the same location as before (new_posts.js).

Here are some of the new changes:

- Last-post tracking has been added for posts that haven't timed out. All new posts are now accurately tracked and marked as such.

- A persistent cookie is used to prevent marked-as-read posts from coming back between short multiple visits.

-  To keep things visually consistent, the script generates a [Last post] link using action=last. I wanted to add a genuine [New posts] link for unread-but-timed-out messages but doing this reliably with the given markup just isn't possible.

- The script now also suppresses the update flicker that was sometimes apparent (especially in IE). The style sheet method used to do this should work in all common browsers except Opera. If you have Opera, you may still see a slight flicker as the script re-writes the new post indicators.

Question: One of the last things I need to add is detection for the punbb_cookie. The script needs to determine if the browser is logged in as a user or as a guest. Can anyone tell me what I should be looking for to determine this? I've looked at the unescaped cookie data but I can't readily see what I need to be testing for.

This detection is necessary to prevent odd behavior for users that have turned off the "Save username and password between visits" option.

After this user/guest detection is implemented, I believe the script is pretty much done. If I don't hear of any errors or strangeness, I'll package it up as a proper mod in a week or so.

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

Re: New Post Indicator Management (volunteers?)

Regarding the cookie. If the cookie contents starts with the string "a%3A2%3A%7Bi%3A0%3Bi%3A1%3B", it's a guest.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: New Post Indicator Management (volunteers?)

Rickard, Connorhd: Thanks for the info. I'll be posting this as a packaged mod in a few minutes.

Latest Open Source project: [img=Templar PHP]http://code.google.com/p/templarphp/logo?logo_id=1251758459[/img]

TemplarPHP - A cascading template framework for PHP.

Re: New Post Indicator Management (volunteers?)

Would it be possible to make a server-side version of this tool, to improve the punBB read/not-read system ? That would be great (javascript has to be downloaded to the client, it's mean on low speed access).

Re: New Post Indicator Management (volunteers?)

the conversation has continued here - http://punbb.org/forums/viewtopic.php?id=5988