expand.js: adjust to post_thread.html

This commit is contained in:
Zankaria 2024-08-29 18:02:10 +02:00 committed by Zankaria
parent 210423ec0a
commit cb35582450

View File

@ -20,8 +20,8 @@ $(document).ready(function() {
let doExpand = function() { let doExpand = function() {
$(this) $(this)
.html($(this).text().replace(_("Click reply to view."), '<a href="javascript:void(0)">' + _("Click to expand") + '</a>.')) .html($(this).text().concat(' <a href="javascript:void(0)">' + _('Click to expand') + '</a>.'))
.find('a').click(window.expandFun = function() { .find('a').click(window.expand_fun = function() {
let thread = $(this).parents('[id^="thread_"]'); let thread = $(this).parents('[id^="thread_"]');
$.ajax({ $.ajax({
url: thread.find('p.intro a.post_no:first').attr('href'), url: thread.find('p.intro a.post_no:first').attr('href'),
@ -35,7 +35,8 @@ $(document).ready(function() {
if (lastExpanded) { if (lastExpanded) {
$(this).addClass('expanded').insertAfter(lastExpanded).before('<br class="expanded">'); $(this).addClass('expanded').insertAfter(lastExpanded).before('<br class="expanded">');
} else { } else {
$(this).addClass('expanded').insertAfter(thread.find('div.post:first')).after('<br class="expanded">'); let opBr = thread.find('div.post').first().next();
$(this).addClass('expanded').insertAfter(opBr).after('<br class="expanded">');
} }
lastExpanded = $(this); lastExpanded = $(this);
$(document).trigger('new_post', this); $(document).trigger('new_post', this);