Soft merging of posts

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Soft merging of posts
« Reply #15, on July 29th, 2013, 08:10 PM »
Okay, looks like #new is fixed now, phew...

Oh, bugger, this is a 'opens up a new page' post... Was hoping to check the #new behavior when posting :lol:
It should work, though...

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Soft merging of posts
« Reply #17, on July 30th, 2013, 12:23 AM »
Yup ;)

I was going to commit tonight, but I got busy with a few quick improvements, and it'll have to wait until tomorrow.
I'll also commit the JS version.

Aaron

  • Posts: 356
Re: Soft merging of posts
« Reply #18, on August 6th, 2013, 01:07 AM »
Love the result so far... Had an idea: perhaps you could have the .poster box scroll with the posts? Especially useful when scrolling through topics with several long posts by the same user (e.g. the changelog topic).
"The entire British Empire was built on cups of tea … and if you think I'm going to war without one, mate, you're mistaken."

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Soft merging of posts
« Reply #19, on August 6th, 2013, 11:34 PM »
I think I discussed that a few days ago, but had no feedback on it, so I didn't explore the idea further.

The #1 problem with this, is that it's dependent on the userbox being a vertical layout, which isn't the case in any mobile skin, for instance... :-/
'course, could do something to prevent that from happening in horizontal layouts, but... How do I make the difference..? Hmm...

Aaron

  • Posts: 356
Re: Soft merging of posts
« Reply #20, on August 7th, 2013, 08:42 PM »
I'd assume it the scrolling to be tackled through JavaScript, so ... through a theme-specific piece of JavaScript that the vertical layout has, but the horizontal does not? I guess the horizontal could override the vertical one with a dummy if need be — not sure how Wedge tackles overriding internally, but I guess you've got that covered.

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Soft merging of posts
« Reply #21, on August 9th, 2013, 04:24 PM »
Quote from Aaron on August 7th, 2013, 08:42 PM
I'd assume it the scrolling to be tackled through JavaScript, so ... through a theme-specific piece of JavaScript that the vertical layout has, but the horizontal does not? I guess the horizontal could override the vertical one with a dummy if need be — not sure how Wedge tackles overriding internally, but I guess you've got that covered.
Yes, technically, I can add JavaScript to any specific skin, but I'm not fond of the idea.
I could simply add a variable, though, such as "post_layout_horizontal = true" or something, and test for (!window.post_layout_horizontal) to trigger the code, or even write a custom function for horizontal layouts, such as turning the userbox into a fixed div, but... I don't know, I'm not too fond of this idea...

My problem, right now, is that I'm starting to feel the HUGE weight of having an overpowered system like Wedge's skin + skeletons + Wess, and realizing you can't modify something without making sure it doesn't break anything else.

The simpler my underlying HTML/CSS/JS code is, the easier it is to add something onto it, but I don't like not giving people opportunities to make breaking changes to my layout, so... Well, it's hard to make decisions, at this point.

SMF has always had the problem, too, and that system is certainly less complex than Wedge, so...

PS: a good example is the 'upshrink' area... In Warm, it is hidden by default, so that you can't remove the header... But if you remove it while in Weaving, and then switch to Warm, err... Well, you don't get the header anymore, ah ah... How do I fix that, ehh??!!
Re: Soft merging of posts
« Reply #22, on August 18th, 2013, 12:54 AM »
So... I've had a quick stab at doing like Aaron suggested, and managed to get a 'working' thingy, but it's still a bit buggy.
Overall, I'm not happy with it.

I can get the userbox to move along with the window scroll, but it gets very complicated when I reach the end of the post, because it tends to increase the userbox size regardless, and thus increase the size of the post, and make it impossible to reach the next message, etc...
So, I added a few failsafes to ensure the userbox size never increases beyond the original height, but even then...

It becomes *jerky*. A bit jerky when I'm scrolling with the keyboard or mouse wheel (like, 1 out of 10 times, you can see the avatar scroll up, then suddenly be restored), and a LOT jerky with the mouse, especially when scrolling through with the mouse, i.e. smoothly: probably because there are too many event triggers, it not only shows the jump effect too much, but it also fails to correctly *scroll the screen* (even though I don't manipulate this!) when transitioning between posts.
Additionally, I think that this animation, while fun at the beginning, will probably get tiresome quickly enough, unless it's replaced with just the user name instead of the entire user box, I don't know, but in this case, it means I'll have to do a position:fixed item... Hmm, well at least it'll solve the jerkiness issue, I guess..?!

If you want to test, I'll paste the code for you. I'd really, REALLY appreciate any feedback.

Open scripts/topic.js
On line 45, add this (or just add it anywhere inside the $(window).load() event):

Code: [Select]
var poster_padding = parseInt($('.poster').first().css('padding-top'));
if (!isNaN(poster_padding))
{
$(window).scroll(function ()
{
var top = $(window).scrollTop(), $poster = null, poster_top, ex_poster_top, last = true;
$('.poster').each(function ()
{
if ($poster === null)
{
$poster = $(this);
poster_top = $poster.offset().top;
return;
}
ex_poster_top = poster_top;
poster_top = $(this).offset().top;
if (poster_top >= top)
return last = false;
$poster = $(this);
});
if (last)
{
var swap = ex_poster_top;
ex_poster_top = poster_top;
poster_top = swap + $poster.height();
}
$poster.css('padding-top', Math.min(Math.max(0, top - ex_poster_top) + poster_padding, poster_top - ex_poster_top - $poster.find('.column').height()));
$('.poster').not($post).css('padding-top', poster_padding);
});
}

I can probably upload it here too, but I'm wary of alienating users, ah ah...

:edit: Also, in Msg.template.php, find <div class="poster"> and immediately add <div class="column"> after it... Then find the </div> that matches it, and replace with two </div>.

Aaron

  • Posts: 356
Re: Soft merging of posts
« Reply #23, on August 18th, 2013, 01:24 PM »
Hmm, would it be an idea to switch to 'position: fixed' when the scrollTop is within a given boundary? That way, the browser can handle the positioning directly in its render engine, so things should be much smoother.

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Soft merging of posts
« Reply #24, on August 18th, 2013, 03:17 PM »
Quote from Aaron on August 18th, 2013, 01:24 PM
Hmm, would it be an idea to switch to 'position: fixed' when the scrollTop is within a given boundary? That way, the browser can handle the positioning directly in its render engine, so things should be much smoother.
I dunno, it can probably be optimized later, but I managed to rewrite the thing with position: fixed, and it actually also fixes the problem I had with mouse scrolling, so it's all good.
It only gets a bit jerky when the userbox is is in process of being hidden from view (i.e. you're scrolling into the next post), because at this point, I have to reset the top position on every frame, obviously...

I think it's commit material at this point, but it's also very, very much something I think people will want to have a setting for, with said setting being OFF by default, dunno...
Re: Soft merging of posts
« Reply #25, on August 18th, 2013, 03:28 PM »
Just for fun...
I uploaded the code here.

It doesn't work as well as on my local site, though... Far from it!
I probably forgot to update something.
Posted: August 18th, 2013, 03:21 PM

Can't seem to find what causes this to happen, unfortunately.
Also, it's currently applied to mobile skins as well, which isn't the case locally -- because of my recent rewrite, which has yet to be applied here.
While I'm (in the long run) hoping to ready it for mobile skins as well, currently it's not possible, because I need to rewrite the mini-menu code to account for position: fixed parents, which isn't done right now.

Aaron

  • Posts: 356
Re: Soft merging of posts
« Reply #26, on August 18th, 2013, 04:20 PM »
I'm loving it in the Weaving theme. Great work, even if you're not fully satisfied yet! :)

Nao

  • Dadman with a boy
  • Posts: 16,079

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Soft merging of posts
« Reply #29, on August 18th, 2013, 06:33 PM »
Position fixed has its issues.
Generally, any changes to the page layout will break it.

That's why it's not possible to do this kind of trick on a site with a lot of js like here.
Same with infinite scrolling: always happy to have done it, always thinking it's not realistic to keep it in.