Infinite Scroll

xrunner

  • Posts: 192
Re: Infinite Scroll
« Reply #60, on June 9th, 2013, 01:45 AM »
Quote from Arantor on June 9th, 2013, 01:41 AM
I can only imagine how annoying that would be :/
Yea I guess you would need a big red dividing line at the end. I'm just infatuated with it now. It doesn't take that much to entertain me. :)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Infinite Scroll
« Reply #61, on June 9th, 2013, 01:47 AM »
Wait until you see what I've been working on. It explains why I was so frustrated with jQuery UI breaking things... ;)
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

xrunner

  • Posts: 192
Re: Infinite Scroll
« Reply #62, on June 9th, 2013, 01:57 AM »
Quote from Arantor on June 9th, 2013, 01:47 AM
Wait until you see what I've been working on. It explains why I was so frustrated with jQuery UI breaking things... ;)
Cool. Can't wait. :cool:

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Infinite Scroll
« Reply #63, on June 13th, 2013, 09:11 PM »
Quote from xrunner on June 9th, 2013, 01:45 AM
Quote from Arantor on June 9th, 2013, 01:41 AM
I can only imagine how annoying that would be :/
Yea I guess you would need a big red dividing line at the end. I'm just infatuated with it now. It doesn't take that much to entertain me. :)
Only thing I could do, is also implement a reverse infinite scrolling, where scrolling to the top loads the previous pages...
It's possible to do, just annoying.

Also, I'd like to discuss an alternative implementation I made today, which I find really funny...
It all comes down to the fact that I'm not satisfied with having JS problems when loading posts. Really, infinite scrolling is a feature that's targeted to showing elements that don't need JavaScript to 'work'.
So, I went back to using an iframe... Except, instead of showing it, I simply detached the post list, and appended it to the main page. The trick is to use .detach() -- this will keep the events and data, something that even .clone(true, true) doesn't seem to be able to do in jQ when doing an iframe to parent move.

And here's the funny thing... While, for the first time, I managed to get a Dailymotion embed to show up, the scripts are actually STILL inside the iframe, even though I moved them too... So, whenever I click the Delete button on a new post, the confirm popup shows up... Inside the iframe, of course..! Ah ah, very funny, indeed...
Similarly, checking a mod checkbox on a new post will show the "Delete selected posts" option, but in the iframe, not in the main page... While doing the same on an 'old' post, will show the option in the main page, of course.

So, right now, I just don't know where to get, eh... I'm thinking, there MUST be a way to make JavaScript execute, and not conflict with the main page's scripts.
After all, Google Images have (some) JS in their infinite scrolling images, and Tumblr also has events & co. on their new posts/images. I looked into them a bit, and they seem to actually be using the Infinite Scrolling plugin for jQuery, which dates back to 5 years ago..! I didn't even remember jQuery existed at that point, ah ah... Well, I'm debugging through it, and can't see anything related to executing JS, so, hmm... I dunno.

I'm not losing hope; but, honestly, it's taken its toll on me, at least a bit...
Re: Infinite Scroll
« Reply #64, on June 13th, 2013, 09:25 PM »
NB, Tumblr blogs don't seem to have any JS in their posts, in the end... It's all about showing plain text links only, really... That's a cheat, I guess. :-/

I probably shouldn't bother too much, and disable mod checkboxes on infinity pages... Although it kinda defeats the purpose of being able to remove more than 15 posts in a row, doesn't it...?
As for external scripts like swfobject, it's still complicated. It's either I get it to execute and break quick edit (I forgot to mention that one...), or the other way around.

Or, I just rewrite quick edit and mod checkboxes to ensure they don't execute code on their own; rather, the main page 'monitors' all quick edit buttons, for instance, and calls the usual stuff when it's pressed. I don't know, is it realistic..?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Infinite Scroll
« Reply #65, on June 14th, 2013, 01:15 AM »
Well, Facebook does it, though I've never studied the methodology of how - but I think it's doing it by sending back new content as JSON to be included into page flow and appending events on demand.

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Infinite Scroll
« Reply #66, on June 14th, 2013, 05:06 PM »
Ah, yes... But then again, Facebook is super-scripted, just like Google there's a lot of handling happening behind the scenes, and since they have full control of their pages (unlike Wedge which has to deal with future plugins), it's not hard to imagine they could pull it off, I guess...

Although it's interesting to consider using JSON or XML or whatever to retrieve the posts; but that would also imply, I guess, doing the same even on non-infinite pages, i.e. we get the JSON data inside the page, and we inject it through JS... Hmm, not very realistic, I'd say... (But it certainly makes it harder to save the web page, for those interesting in protecting their content, I suppose... :^^;:)
Posted: June 14th, 2013, 05:05 PM

Where do you want me to go, then..?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Infinite Scroll
« Reply #67, on June 14th, 2013, 05:22 PM »
Well, on my todo list is the ability to do true AJAXive quick reply, as in submit the post, get the post in full display mode back and inject it into the page itself.

Problem 1: deferred events
Answer: for code requested via AJAX, don't defer the events. It uses slightly more bandwidth but since everything on the page will already be available, it's not like we're waiting for dependencies like jQuery.

Problem 2: menu items
Answer: When the post is retrieved, drop all existing mini-menus, splice the new post's items into the existing menu definition and re-call it. The returning fragment should deal with this rather than having it already in every page load (since not everyone is going to do this)

Problem 3: payload
Answer: It actually doesn't really matter whether it's JSON, XML or HTML in a light wrapper. As long as it comes through and can run scripts or whatever, it's fine.

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Infinite Scroll
« Reply #68, on June 14th, 2013, 07:04 PM »
Deferring is mandatory because some calls use the e parameter which is only available at defer time in the eves object.

Mini menus work fine because the existing code relies on post IDs, and they're different in the newly loaded posts.

Eh...

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Infinite Scroll
« Reply #69, on June 14th, 2013, 07:45 PM »
Huh, OK. Was just throwing stuff out there. Had forgotten about the way deferred events work in that situation.

Auk

  • Can I get a Box?
  • Posts: 64
Re: Infinite Scroll
« Reply #70, on June 15th, 2013, 04:35 PM »
OMG, I really hope this will be optional between users. I hate infinity scroll. I finally got used to google image search when they first implemented it, then began to like it.
If we're going to have infinity scroll, wouldn't it present a problem that you can never reach the bottom of the page for options like quick reply and 'Pages: « previous 1 … 3 4 5   Go UP'? I hope we will be able to access such options all the time.
Quote from Arantor on February 10th, 2013, 07:00 PM
Just as a thought, how about a compromise of 'load the next x items AJAXively' as a button, without having to actually go to the next page?
I like this idea here.

Posted: June 15th, 2013, 04:30 PM
Quote from xrunner on June 9th, 2013, 01:40 AM
Can you make it wrap back around to the first post when reaching the last post? That would be really trick. :)
That should not be automatic.

Nothing is more despicable than respect based on fear.

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: Infinite Scroll
« Reply #71, on June 15th, 2013, 06:14 PM »
No problem, Pete... We're all trying to find solutions.
Quote from Auk on June 15th, 2013, 04:35 PM
OMG, I really hope this will be optional between users.
Nope...
Quote from Auk on June 15th, 2013, 04:35 PM
I hate infinity scroll. I finally got used to google image search when they first implemented it, then began to like it.
Images are all different. Generic websites with tons of visual contents need a discovery feature, and for these, infinite scrolling is perfect. Absolutely perfect. In fact, adding infinite scrolling to Aeva Media is a given, to me...
Quote from Auk on June 15th, 2013, 04:35 PM
If we're going to have infinity scroll, wouldn't it present a problem that you can never reach the bottom of the page for options like quick reply and 'Pages: « previous 1 … 3 4 5   Go UP'? I hope we will be able to access such options all the time.
I hate that.
And, you don't have to do it that way...

99% of all infinite scrollers do it this way: they hook on the scroll event, determine the position within the page, and if it's > 90% or something, they trigger the load.
I don't know if other scrollers do it my way, but here's how I do it: I hook on the mouse wheel event, and when I register a wheel roll, I determine if we've already reached the end of the page. If yes, then I monitor the wheel to see if the users insists on going down. If yes, I trigger the load.

This is a HUGE difference, in terms of usability. The common solution is 'obvious', while the second solution forces the user to make a conscious choice to see more data. By attempting to scroll down even though the page is already at the bottom, it sends Wedge the message that, "yes, I really want more, can you please send me more, pretty please with sugar on top..?"

The only drawback of this method, is that it doesn't work on mobile devices, which don't have a mouse wheel, so I'm looking into hooking the swipe event, and trigger the load after a couple of swipes to the bottom when the page is at the end, or very close to. Unfortunately, I haven't reached that point yet, as I'm too busy fixing JS issues with the scroller in itself. (As I said, images are the winners in infinite scrolling, not only because these are quickly scanned by the human eye, but also because loading an image usually doesn't come with unexpected elements that require running JavaScript, like a video embed... Hmm.)

Anyway, as a conclusion, please note:

(click to show/hide)
The feature is already enabled here, and it's been that way for a week or so...! If you didn't notice it, then you have no grounds to complain, do you..?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Infinite Scroll
« Reply #72, on June 16th, 2013, 12:22 AM »
The thing is, if you're not aware of it, you probably won't ever actually trigger it in the current implementation... which is how we're at the stage we're at where it's live here and people think it isn't.

Auk

  • Can I get a Box?
  • Posts: 64
Re: Infinite Scroll
« Reply #73, on June 16th, 2013, 12:30 AM »
Hmm, I just noticed this and like the current implementation of it. I never think to just scroll further than the current page would allow me to. I tested this just now and it doesn't activate upon a tiny super minor mouse scroll which is a good thing. :D

I was wondering how everyone was testing this, I didn't think this would actually go live and I didn't bother to read ALL the posts. Anyway, great job on the implementation.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Infinite Scroll
« Reply #74, on June 16th, 2013, 12:34 AM »
Nao and I have to do even more to actually trigger it ourselves on this site because we have debug information turned on (and we have it set to show-admins only), so there's a ton extra content under the footer... ;)