ElkArte Community

Elk Development => Theme development => Topic started by: Joshua Dickerson on January 31, 2014, 11:06:21 am

Title: #new anchor
Post by: Joshua Dickerson on January 31, 2014, 11:06:21 am
Why does it use "#new" as the anchor instead of the message id if the new link already has the msg id in it? Doesn't that seem weird? You could remove some extra markup and make the links work the same for everyone, instead of having #new go to a different message for everyone. You could use some JS to check if the anchor/id doesn't exist and then look for #new. What's with new topics having "?topic=$topic.msg0"?

Some pseudo  This might actually work:
Code: [Select]
function moveToNew()
{
    var hash = url.substring(url.indexOf('#')+1);
    if($('#' + hash).length == 0) {
        location.hash = '#new';
    }
}
Title: Re: #new anchor
Post by: Nao on January 31, 2014, 06:19:49 pm
Food for thought: in Wedge, I changed the system to something simpler. If the current page has a message considered 'new', it shows the new anchor. BUT, if you access a page from a message ID (such as topic=35.msg123), the message #123 will always get a 'new' anchor, regardless of whether it's the first unread post. This way, you can always get to msg123 with a #new anchor, saving the need for a repetition in the URL. I fluctuated between #new and #msg (with no ID), but decided on #new to keep it consistent with existing conventions.
I have to change all ".msgXXXX" occurrences in the codebase, but all I can say is that it makes URLs cleaner.