ElkArte Community

Extending Elk => Addons => Addons ideas and questions => Topic started by: badmonkey on November 11, 2016, 10:35:33 am

Title: Ajax toys
Post by: badmonkey on November 11, 2016, 10:35:33 am
@ahrasis

Didn't you write a couple of SMF add ons based on ajax?  Specifically continuous post scrolling and instant reply? 

How hard would it be to port those to Elk?  I'd be willing to try to help, though my coding knowledge is about enough to be dangerous.  Please don't go to much trouble over it though.  In all truth I would like to test mods like these and keep them if they don't cause excess server load or other issues.  What are your thoughts?
Title: Re: Ajax toys
Post by: emanuele on November 11, 2016, 06:11:42 pm
Infinite scrolling should be easier than SMF's one (there is no need to bother about alternating classes and markup is more structured and easier to deal with). IIRC the most painful thing to "port" to the infinite scrolling was the quick-edit because it's a js attached to "certain" posts and that was a bit tricky. I don't remember how it was fixed at the end (if it was fixed at all lol).
As for SMF, there is the problem of the quick reply and the footer, but some kind of fixed container should do the trick.
Title: Re: Ajax toys
Post by: ahrasis on November 11, 2016, 07:15:20 pm
If I remember correctly, the one in SMF is a pack of @emanuele tips and tricks and was not really mine. I think I did mention that in the mod.

There is one similar addon here which emanule help in rewriting that mod the Elk's way, if I am not mistaken, Endless. I lost the working copy of it but I think it is still here in the forum. I'll search for it then.

As for ajax, in FlarumStyle addon, there is a similiar function demonstrated by @inter where it can show / list more posts upon a click, almost similar to Endless. This is also good stuff.
Title: Re: Ajax toys
Post by: badmonkey on November 11, 2016, 07:22:42 pm
I will look for Endless when I get home.  That's cool!  Thanks guys!
Title: Re: Ajax toys
Post by: ahrasis on November 11, 2016, 07:40:03 pm
I found it. It is in this post: http://www.elkarte.net/community/index.php?topic=127.msg21625#msg21625 but no addon topic is opened for this.
Title: Re: Ajax toys
Post by: badmonkey on November 11, 2016, 11:07:10 pm
Sweet!  I'll try it out.  Thank you!  I'll also report back in case it helps someone else. 
Title: Re: Ajax toys
Post by: badmonkey on November 11, 2016, 11:56:45 pm
That is awesome!!  The only thing I can see it needs is to hide the "load moar" link when the last page is reached.  There may be a bug there - it will display the last page twice if you click it again.  Do you have any suggestions on a fix?
Title: Re: Ajax toys
Post by: ahrasis on November 12, 2016, 12:07:09 am
I already noted that and I think it is fixable. @emanuele also noted something more of which you can read in that topic.
Title: Re: Ajax toys
Post by: badmonkey on November 12, 2016, 11:19:43 pm
Quote from: ahrasis – I already noted that and I think it is fixable. @emanuele also noted something more of which you can read in that topic.

Indeed you did.  Somehow I didn't grasp that first read.  Perhaps excitement got the better of me.  lol

Title: Re: Ajax toys
Post by: emanuele on November 13, 2016, 07:30:40 am
It was a while ago, but I may have left that on purpose: if you reach the end it may or may not be the end depending if someone posts new messages while you are reading, so if you leave the page open and.... in an hour wants to see new messages, you can just click on "load more", but if you hide the load more you are done, the only solution is to refresh the entire page to see if there is any new message.
Title: Re: Ajax toys
Post by: badmonkey on November 13, 2016, 11:00:47 am
Could the page ajax back periodically to check for new posts, and if there are, automatically add them with a highlighted background so the user knows they're new?  Not that I'd have any clue how to begin to do that....lol.