Announcement

Collapse
No announcement yet.

Go to First Unread Post Inside Topic

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Go to First Unread Post Inside Topic

    Is there any html/javascript that could be used to mimic the 2 blue down arrow function on the channel page?

    Our old forum had the capability. I dug through and found a way to have the same double blue down arrow button on each individual topic page but cannot find any javascript to find the first unread post by a user.

    Code:
    <form>
    <input type="button" value="Go To First Unread" onclick="window.location.href="'{vb:url {vb:raw topic.routeid}, {vb:raw topic}, {vb:raw querystring}}" class="go-to-first-unread b-icon b-icon__double-arrow-down--blue js-go-to-first-unread" title="{vb:phrase 'go_to_first_new_post'}"&nbsp;/>
    </form>
    I know it's out there and I've been digging all day. I just can't find the javascript that the site uses in an attempt to mirror it.

    Got any ideas on where I could start with this one?

    #2
    If you've already opened the topic, then all the unread posts in it had been marked read.

    But to answer your question, if you add ?goto=newpost querystring in the current topic URL, that will navigate you to the first new post in that topic.
    Helpful? Donate. Thanks!
    Buy me a coffeePayPal QR Code
    Fast VPS Host for vBulletin:
    A2 Hosting & IONOS

    Comment


      #3
      ok, still having issues with this one...here's my button html and script

      Code:
      <button id="button" onclick="updateURL();">First Unread Post</button>
      Code:
      <script>
      // onclick event is assigned to the #button element.
      document.getElementById("button").onclick = updateURL() {
        window.location.href = window.location.href + window.location.pathname + "?goto=newpost";
      };
      </script>
      but when I click the button neither the URL is updated or a refresh is done...

      the way this functionality is meant to work is say someone refreshes the page within the topic itself, they can click on a button to take them to the new post on the page or if when they refresh the next new post is on the next page so it will take them to the new post on that next page

      any thoughts? thinking it has something to do with window.location.href as maybe I'm not understanding how to place it properly

      Comment


        #4
        Here's another attempt that I think is closer but still not updating the URL and redirecting the page

        Code:
        <script type="text/javascript">
           var url = window.location.href + "?goto=newpost";
        </script>
        <input value="First Unread Post" onclick="document.location(url)" type="button" />

        Comment


          #5
          Try:
          HTML Code:
          <button id="button" type="button" class="b-button">First Unread Post</button>
          <script>
          document.getElementById("button").onclick = function() {
            window.location.href += "?goto=newpost";
          };
          </script>
          But as I mentioned, it may not find the new posts because when the topic is loaded, all the unread posts in that topic had been marked read already.
          Helpful? Donate. Thanks!
          Buy me a coffeePayPal QR Code
          Fast VPS Host for vBulletin:
          A2 Hosting & IONOS

          Comment


            #6
            Thank you Glenn but that seems to take me to the last post of the thread. Say I have 50 posts per page and in a certain thread I had only read to page 3, it took me to page 17 and the very last post in the thread.

            Is that part of the issue you were speaking with? I guess I'm more concerned with navigating to first new post on next page now that I think about it and not going to the last post in the thread if that means skipping 14 pages etc.

            Comment


              #7
              It looks like if there are no new posts in a topic and you added ?goto=newpost, it redirects to the last post. That's the issue I was talking about. There are no more unread posts once the topic is opened.
              Helpful? Donate. Thanks!
              Buy me a coffeePayPal QR Code
              Fast VPS Host for vBulletin:
              A2 Hosting & IONOS

              Comment


              • pgreenway
                pgreenway commented
                Editing a comment
                I see, so if I have never opened a thread before and it has 250 posts which would be 5 pages on my forum, then I opened page 1 it means all 250 posts are now read?

                Because that's what happened essentially when I clicked the button on page 1. It would just take me to post 250 and skip posts 51 to 249

              • glennrocksvb
                glennrocksvb commented
                Editing a comment
                Yes. To confirm, go to vbulletin.com and navigate to a channel you've never read before. Click the blue double arrow next to one of the unread topics. Click on it to and it will redirect you to the first unread post. Press the browser back button. Notice that the double arrow button is gone even if you had multiple unread posts in that topic.

              • pgreenway
                pgreenway commented
                Editing a comment
                yeah you're right, just did that...was that the way it worked on vB 4? We used to use vB 4 software and our old site had the functionality to do just that without going to the last post and I believe we had the ability to go to first unread post each time

                Is this something that is worth a JIRA? I feel like the feature is missing something

              • glennrocksvb
                glennrocksvb commented
                Editing a comment
                Yes that's worth a JIRA. I think it works correctly on vB4.

              #8
              Also, thanks for the help. 2 coffees on me today so you can stay focused haha

              Comment


              • glennrocksvb
                glennrocksvb commented
                Editing a comment
                Thank you! ☕

              #9
              Here's the JIRA for it:

              Comment


              • glennrocksvb
                glennrocksvb commented
                Editing a comment
                Voted!

            Users Viewing This Page

            Collapse

            There is 1 user viewing this forum topic.

            • Guest Guest

            Latest Posts

            Collapse

            Working...
            X
            Searching...Please wait.
            An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

            Please push the back button and reload the previous window.'
            An unexpected error was returned: 'Your submission could not be processed because the token has expired.

            Please push the back button and reload the previous window.'
            An internal error has occurred and the module cannot be displayed.
            There are no results that meet this criteria.
            Search Result for "|||"