Expand quotes overflow when page loaded for first time

Started by Julius_2000, December 09, 2022, 10:10:51 AM

Previous topic - Next topic

Julius_2000

Hi all,

I have set a height limit for long quotes. When I load the forum for the first time, open a topic and want to expand such a quote, the content most of the time would overflow and go outside its post area, spilling over into posts below.

You cannot view this attachment.

When I reload the page and expand again, the post area would properly adjust its height.

Now, I did some small changes to blockquotes in Subs.php where I added a div  after <cite></cite> and an and an i-element inside the <cite>. Would that have any impact on that?


Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Julius_2000

#2
Quote from: Kindred on December 09, 2022, 02:08:47 PMYes.   You apparentky broke the markup

Hm.

/*Changed: added the class to the div after <cite></cite> in quotes to separate author from text*/
array(
'tag' => 'quote',
'before' => '<blockquote><cite>' . $txt['quote'] . '</cite><div class="quote_post">',
'after' => '</div></blockquote>',
'trim' => 'both',
'block_level' => true,
),
array(
'tag' => 'quote',
'parameters' => array(
'author' => array('match' => '(.{1,192}?)', 'quoted' => true),
),
'before' => '<blockquote><cite>' . $txt['quote_from'] . ': {author}</cite><div class="quote_post">',
'after' => '</div></blockquote>',
'trim' => 'both',
'block_level' => true,
),
array(
'tag' => 'quote',
'type' => 'parsed_equals',
'before' => '<blockquote><cite>' . $txt['quote_from'] . ': $1</cite><div class="quote_post">',
'after' => '</div></blockquote>',
'trim' => 'both',
'quoted' => 'optional',
// Don't allow everything to be embedded with the author name.
'parsed_tags_allowed' => array('url', 'iurl', 'ftp'),
'block_level' => true,
),
array(
'tag' => 'quote',
'parameters' => array(
'author' => array('match' => '([^<>]{1,192}?)'),
'link' => array('match' => '(?:board=\d+;)?((?:topic|threadid)=[\dmsg#\./]{1,40}(?:;start=[\dmsg#\./]{1,40})?|msg=\d+?|action=profile;u=\d+)'),
'date' => array('match' => '(\d+)', 'validate' => 'timeformat'),
),

'before' => '<blockquote><cite><a href="' . $scripturl . '?{link}">' . $txt['quote_from'] . ': {author} ' . $txt['search_on'] . ' {date}</a></cite><div class="quote_post">',
'after' => '</div></blockquote>',
'trim' => 'both',
'block_level' => true,
),
array(
'tag' => 'quote',
'parameters' => array(
'author' => array('match' => '(.{1,192}?)'),
),
'before' => '<blockquote><cite>' . $txt['quote_from'] . ': {author}</cite><div class="quote_post">',
'after' => '</div></blockquote>',
'trim' => 'both',
'block_level' => true,
),

This how I edited it: I added <div class="quote_post"> in all the "before" and closed them in the "after" sections. Why would it break the markup or why would it work then the page is refreshed and the quote expands properly? (I have removed the i-element).

Julius_2000

#3
I had a closer look at what is happening and it seems that the expand-javascript calculates a wrong max-height value for the bbc_standard_quote the first time the site is loaded.

<blockquote class="bbc_standard_quote" style="overflow-y: visible; max-height: 612px;">
When I reload it, the value is correct.

<blockquote class="bbc_standard_quote" style="overflow-y: visible; max-height: 1965px;">
Does anyone of you know why that is?


Edit:

The java code for expanding looks like this:
if (smf_quote_expand < parseInt($(item).height())) {
    cite.find('a.expand').text(' [' + smf_txt_expand + ']');
    $(item).css({
      'overflow-y': 'hidden',
      'max-height': smf_quote_expand + 'px'
    });
  } else {
    cite.find('a.expand').text(' [' + smf_txt_shrink + ']');
    $(item).css({
      'overflow-y': 'visible',
      'max-height': (quote_height + 10) + 'px'
    });
Is there a reason why for "expand" the max-height isn't defined as 100% or something along those lines?

Edit 2: I replaced it with 100% and it seems working. Could this have a negative impact on other things?

Julius_2000

Quote from: Julius_2000 on December 10, 2022, 04:18:26 PMIs there a reason why for "expand" the max-height isn't defined as 100% or something along those lines?

Sorry for the bump, but I'm quite curious if there's an answer to this so I can understand the reasoning behind the way it's been written. Thanks!

Advertisement: