inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,853
December 2005
horace
|
Post by Chris on Sept 7, 2015 22:22:08 GMT -8
Note: the reply number is also a link to the post making it easier and more efficient to just right click and copy the link address Drop this in your global footer, it should affect all themes. code:<script type="text/javascript">
$(function(){ if(window.listMan && listMan.item_type == "post"){ var p = listMan.options, r = proboards.data("route") $('.content-head .info .date', listMan.content).each(function(i,e){ var post = {element:$(e), index: i, id: $(e).closest('tr.item.post').attr('id').split("-").pop(), page: listMan.pagination.data("pagination").page}, search = /search/i.test(r.name) || p.data.search || p.data.posts_search || p.data.post_query || p.data.hash.q || p.data.recent_page?1:0; post.element.before('<span class="post-method post-number" />').prev() .html( '<a href="/post/' + post.id + '/thread" title="Link to Post" >' + ((i+post.page+search) == 1 ? 'Thread ' : (search?'Result':'Reply') + ' #' + ((post.page - 1) * p.limit + i + search)) + '</a> ' + (i+post.page+search == 1 ?'started ' : 'posted ')) }) } if($.inArray(arguments.callee, proboards.events.afterSearch) == -1)proboards.on("afterSearch",arguments.callee); }) </script> Updates:- June 2, 2013 - added recognition of recent posts as a search result
- June 9, 2013 - added newer pagination event handler
- Sept 14, 2013 - added recognition of newer List Manager data structure
|
|
inherit
224888
0
Sept 7, 2015 14:26:12 GMT -8
sparkwriter
2
September 2015
sparkwriter
|
Post by sparkwriter on Oct 16, 2015 13:07:28 GMT -8
This is really great and exactly what I was looking for! Is there any way to add the total number of replies in the thread to that, as in: "Reply #XXXX of XXXX."
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,853
December 2005
horace
|
Post by Chris on Oct 16, 2015 21:53:55 GMT -8
That is sorta doable but you should be aware that there is something akin to a currency exchange problem with the system currently in place, the total posts requested may not match the total posts returned. Proboard's backend system seems to deal in pages while the pagination widget that creates that page flipper at the top of the forum deals in items/posts. So a perfect example of the problem would be viewing a user's recent posts from the link on their profile (somebody with over 1000 posts). At a setting of 15 posts per page and with a capped total of 1000 posts requested by the widget you should end up with 67 pages (minus 5 posts) but as mentioned the backend feels compelled to fill out that page so you would end up with 1005 posts total meaning you could conceivably end up with something like "post #1003 of 1000" being reported. To fix that, we could instead multiply the number of pages by the post_per_page to reach a backend total but that would be even worse because if the number of posts were not exactly on a page boundary that total would be much more frequently inaccurate. $(function(){ if(window.listMan && listMan.item_type == "post"){ var p = listMan.options, r = proboards.data("route") $('.content-head .info .date', listMan.content).each(function(i,e){ var post = {element:$(e), index: i, id: $(e).closest('tr.item.post').attr('id').split("-").pop(), page: listMan.pagination.data("pagination").page, total: listMan.pagination.data("pagination").options.total}, search = /search/i.test(r.name) || p.data.search || p.data.posts_search || p.data.post_query || p.data.hash.q || p.data.recent_page?1:0; post.element.before('<span class="post-method post-number" />').prev() .html( '<a href="/post/' + post.id + '/thread" title="Link to Post" >' + ((i+post.page+search) == 1 ? 'Thread </a> ' : (search?'Result':'Reply') + ' #' + ((post.page - 1) * p.limit + i + search) + '</a> '+ ' of ' + post.total) + (i+post.page+search == 1 ?' started ' : ' posted ')) }) } if($.inArray(arguments.callee, proboards.events.afterSearch) == -1)proboards.on("afterSearch",arguments.callee); }) add script tags and let simmer for 15 nanoseconds then serve while still hot
|
|
inherit
224888
0
Sept 7, 2015 14:26:12 GMT -8
sparkwriter
2
September 2015
sparkwriter
|
Post by sparkwriter on Oct 17, 2015 6:01:05 GMT -8
OK--I think I get that, and that issue would definitely apply to my forum. We have very few threads, with each serving as a running conversation on a set topic. Each thread could potentially have (and did on the previous platform) many, many thousands of replies. At this point in the new forum, we don't have that many posts, but that will change quickly. I think I will just led the numbered replies stand as is, and direct them to other places where they can see the total reply count in a thread.
Thanks so much for your response.
|
|