Skip to main content
Topic: Dynamic load pages [JS Snipet] (Read 7239 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Dynamic load pages [JS Snipet]

This is not actually an addon but I didn't know where to post it.

This JavaScript code will dynamically load and display the contents when changing pages.
Here is a quick demo: https://i.imgur.com/hj9Oet3.gifv

Code:
Spoiler (click to show/hide)

Just edit your script_elk.js and insert this code.

Changelog:
Spoiler (click to show/hide)
Last Edit: January 12, 2017, 10:21:29 am by Dynamo

Re: Dynamic load pages [JS Snipet]

Reply #1

Nice!

Re: Dynamic load pages [JS Snipet]

Reply #2

Very cool!  It would be nice if all forum navigation behaved in a similar fashion so ya don't always feel like it's a complete page load.

Re: Dynamic load pages [JS Snipet]

Reply #3

Cool!  8)

More need to add the page load as you scroll.

@ahrasis what do you think?
Sorry for my English

Re: Dynamic load pages [JS Snipet]

Reply #4

Cool!

One thing: are the scripts in the page still working? (For example the likes and the quick edit.)
Bugs creator.
Features destroyer.
Template killer.

Re: Dynamic load pages [JS Snipet]

Reply #5

Quote from: emanuele – Cool!

One thing: are the scripts in the page still working? (For example the likes and the quick edit.)
Yes they do work, I also made an update, so it also works when browsing board topics.

Probably I will make an update so all forum navigation behaves on a similar manner. (suggestion by @badmonkey)

Re: Dynamic load pages [JS Snipet]

Reply #6

Super wow!  Thanks for sharing this.  Perhaps this should be part of the stock code?   :D

Re: Dynamic load pages [JS Snipet]

Reply #7

I have just seen its demo. Great stuff I'd say. Thanks for sharing it.

Re: Dynamic load pages [JS Snipet]

Reply #8

Hello,

My English is very bad, sorry.

I have tried this great modification. Found a problem with latéral Top and Bottom buttons. Sometimes all work fine, bat I don't no why, sometimes the bottom button don't do anything.
Elkarte 1.09

Edit:
Il will remove this mod at the end of the week.
You can try:
Go https://forum.mpdb.tv/index.php/topic,35559.0.html
then go on page 2
Bottom button don't responde.
Last Edit: February 01, 2017, 06:27:52 am by shaitan
My Tailor is rich

Re: Dynamic load pages [JS Snipet]

Reply #9

Quote// jQuery hates parsing body content. Surely there is a better way (eg regex)
Unlikely: https://jsperf.com/regex-vs-split/2

I haven't tried this, but I would assume it's incompatible with the way I call my quick quote script https://github.com/Frenzie/elk-quick-quote/blob/da6090639d63ff1b51f67891723a85a28eab012e/quickQuote.js#L384

Off the top of my head I'm thinking something like
Code: [Select]
var dynamicLoadPagesEvent = document.createEvent('Event');
dynamicLoadPagesEvent.initEvent('dynamic-load-pages:load-next', true, true);

document.body.dispatchEvent(dynamicLoadPagesEvent);

Then we should be able to act on it like this:

Code: [Select]
document.body.addEventListener('dynamic-load-pages:load-next', initializeQuickQuote, false);

Re: Dynamic load pages [JS Snipet]

Reply #10

I can only see its working just fine @shaitan. This addon target page changes by numbers or next button, not up and down arrow / button. I do however think it can be extended with some more modification to the original code. If you ask me, I like all button leading to another page or position to use the same effect. Better still, several options of it. But that's just me.

Re: Dynamic load pages [JS Snipet]

Reply #11

Hello Ahrasis,
I will try to explain better the problem I encounter.
The addon work like a charm. Dynamic effect when changing page, that's nice, all is OK.

BUT it broke the latéral button (action=.....#bot). Nothing happpens when I press on it.
If I remove the addon, the button work again well





Last Edit: February 01, 2017, 02:49:50 pm by shaitan
My Tailor is rich

Re: Dynamic load pages [JS Snipet]

Reply #12

I did go to the bottom just fine when I clicked bottom arrow button aka #bot. So, that doesn't seem broken to me.


Re: Dynamic load pages [JS Snipet]

Reply #14

Where's the bottom arrow button? It works for me if I add #bot to the addressbar manually.