Page 1 of 1

Unread post and topic titles in different color - ajax.js changes required

Posted: Sat Jun 16, 2018 2:12 am
by Pilxy
I have a custom (prosilver based) theme installed in my forum. Ever since I remember, we've allways had unread posts and topic titles in different color, si I also included this in our 3.2 template.

I've done this by adding unread class to unread forums and unread topics by applying <!-- IF forumrow.S_UNREAD_FORUM --> unread<!-- ENDIF --> and <!-- IF topicrow.S_UNREAD_TOPIC --> unread<!-- ENDIF --> to forumlist_body and viewforum_body templates.

The thing works, but not entirely as it should. What I have noticed is that in 3.2 clicking on "mark forums read" is handled by ajax.js file and by clicking on the "mark read" link does not change the color of unread posts and topics to read (the same way as it does with icons). The unread color changes however, if I refresh the page.

So, looks like I'm gonna have to add or change something in ajax.js file. Anyone here who is willing to help, as I'm not qute familiar with .js? Thanks! :)

Re: Unread post and topic titles in different color - ajax.js changes required

Posted: Sat Jun 16, 2018 8:25 am
by Toxyy
I'd need to see the ajax file but there's some jquery in here for you to remove a class from a defined div:
https://stackoverflow.com/questions/951 ... -in-jquery

if you know where to put it in the ajax function then it shouldn't be too bad.

Re: Unread post and topic titles in different color - ajax.js changes required

Posted: Sat Jun 16, 2018 11:57 am
by Pilxy
It's the default file used in prosilver template. The same as used in this forum as well.

styles/prosilver/template/ajax.js?assets_version=790


I tryed using these, but I probably haven't put them in the right place as they didn't work:


// Mark forumtitles read
$('a.forumtitle[class*="unread"]').removeClass('unread').addClass('read');

// Mark topictitle read
$('a.topictitle[class*="unread"]').removeClass('unread').addClass('read');

Re: Unread post and topic titles in different color - ajax.js changes required

Posted: Tue Jun 19, 2018 2:02 am
by Pilxy
I think I have managed to figure it out.

Above // Mark subforums read in line 28 I added this part of code

// Mark forumtitles read
$('a.forumtitle[class*="unread"]').removeClass('unread');


and in line 92, above // Remove link to first unread post I added thi part:

// Mark topictitles read
$('a.topictitle[class*="unread"]').removeClass('unread');


Tested it out and looks like it's working... :D