inherit
262183
0
Nov 20, 2024 20:09:49 GMT -8
Funkytown
63
September 2020
funkytown
|
Post by Funkytown on Mar 17, 2022 0:01:55 GMT -8
An option to sticky an original post to the top of each page (like polls are stickied)? I wouldn't want this for every thread, but an option for the ones that are considered original content. That way when it's page 3, 4, 5, etc. people can easily see the OP without having to skim through all of the comments if they don't want to. An example of an OP that I would want stickied on top of each page in the thread, if possible. Thanks.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Mar 18, 2022 4:48:17 GMT -8
|
|
inherit
262183
0
Nov 20, 2024 20:09:49 GMT -8
Funkytown
63
September 2020
funkytown
|
Post by Funkytown on Mar 21, 2022 9:27:13 GMT -8
|
|
inherit
256235
0
Oct 24, 2024 15:19:07 GMT -8
Reignman
32
August 2018
reignman
|
Post by Reignman on Mar 21, 2022 15:23:17 GMT -8
The code works except the page needs to be refreshed each time to actually see the OP, kinda defeating the purpose as most people aren't going to refresh the page immediately after going to a new page lol. Is there anything we can add/change to have it show up without refreshing?
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Mar 21, 2022 16:45:20 GMT -8
Oh, I see what you mean! I fixed this problem too. Here is the new and improved version of the Post List Layout template, allowing you to sticky a post (note you only need to change this, no other template):
ummabdurrahman , Sorry, in a word, no. Well, especially in the way that you asked "one particular post". However, there have been a couple work arounds that would allow the first post of the thread to remain at the top of the page if there are multiple pages. Here they are, just review them both and see if either will work for you. Brian's solutionDavid's solution I used David's fix because I only need it for select threads....But only the last page has the first post of the thread as the first post on that page.... ummabdurrahman Ah, I see the problem. Looks like you needed both templates for it work properly (or just Brians solution alone would work). If you just used Davids, you would have to manually refresh the page (after changing the page) for the first post to appear. Went ahead and fixed it. Should be good now Updated Numbered Posts Code for this Sticky First Post Modification:<script> $(function () { function add_post_numbers() { if (window.listMan && listMan.item_type == "post") { var p = listMan.options, r = proboards.data("route"), sticky = 0 $('.content-head .info .date', listMan.content).each(function (i, e) { var post = { date: $(e), index: i, element: $(e).closest('tr.item.post'), 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, first_post = (i + post.page + search == 1 || post.element.hasClass('first-post')); if (post.page > 1 && post.element.hasClass('first-post')) sticky = post.page; post.date.before('<span class="post-method post-number" />').prev() .html('<a href="/post/' + post.id + '/thread" title="Link to Post" >' + (first_post ? 'Thread ' : (search ? 'Result' : 'Reply') + ' #' + ((post.page - 1) * p.limit + i + search + (sticky ? -1 : 0))) + '</a> ' + (first_post ? 'started ' : 'posted ')) }) } return add_post_numbers; } pb.events.on('afterSearch', add_post_numbers()); })
</script>
|
|
inherit
256235
0
Oct 24, 2024 15:19:07 GMT -8
Reignman
32
August 2018
reignman
|
Post by Reignman on Mar 26, 2022 11:31:39 GMT -8
Excellent, thanks Chris. Making progress now. There's still several issues I've spotted, I was wondering if I should continue asking here, or should I go ask Ulises on the original post?
The first being, there seems to be some leftover code here, which I removed myself no problem.
The next problem is it adds the OP to the first page too, so the first post is essentially double posted.
Also I've noticed the "likes" get a little bugged on the OP. They disappear, until you like the post again, but then they disappear after a refresh.
And the last problems I've noticed is an extra admin button (cog) gets added to the OP, and only the OP.
Like so:
And it's missing on the duplicate post below the OP.
It's the same on chrome and firefox. All the other posts on the thread seem to be fine, likes, and no extra buttons etc.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Mar 26, 2022 16:12:08 GMT -8
Excellent, thanks Chris . Making progress now. There's still several issues I've spotted, I was wondering if I should continue asking here, or should I go ask Ulises on the original post? The first being, there seems to be some leftover code here, which I removed myself no problem. The next problem is it adds the OP to the first page too, so the first post is essentially double posted. Also I've noticed the "likes" get a little bugged on the OP. They disappear, until you like the post again, but then they disappear after a refresh. And the last problems I've noticed is an extra admin button (cog) gets added to the OP, and only the OP.
Like so: And it's missing on the duplicate post below the OP.
It's the same on chrome and firefox. All the other posts on the thread seem to be fine, likes, and no extra buttons etc.
The .first_post.likes variable appears to return a consistently empty span.likes element as you've pointed out but I am not seeing the cog menu issue you are describing after installing the layout mod unedited on a clean forum. Perhaps you can create a new test theme then ovewrite the post list layout in that new theme using Ulises 's code posted in the spoiler above to rule out any theme embedded codes or modifications being the cause of the issue you are seeing. You can also temporarily uncheck any plugins to test. The OP on the first page is also not doubled for me so it would be in everyone's interest to post a forum URL especially if you are using codes not being discussed here.
|
|
inherit
256235
0
Oct 24, 2024 15:19:07 GMT -8
Reignman
32
August 2018
reignman
|
Post by Reignman on Apr 15, 2022 11:27:55 GMT -8
The .first_post.likes variable appears to return a consistently empty span.likes element as you've pointed out but I am not seeing the cog menu issue you are describing after installing the layout mod unedited on a clean forum. Perhaps you can create a new test theme then ovewrite the post list layout in that new theme using Ulises 's code posted in the spoiler above to rule out any theme embedded codes or modifications being the cause of the issue you are seeing. You can also temporarily uncheck any plugins to test. The OP on the first page is also not doubled for me so it would be in everyone's interest to post a forum URL especially if you are using codes not being discussed here. Yep, stupid me. I had modified the "Thread" layout template with Davids code earlier, and then the "Post List" template with Ulises code later without removing Davids code xD. Seems to work as intended now, other than the "likes" disappearing, which isn't a priority atm. Thanks again!
|
|