Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I changed the module to support a different jQuery Infinite Scroll library. I found the following library that adds a lot more features to the current library: https://github.com/webcreate/infinite-ajax-scroll
The library should as git clone or unpacked in the libraries directory in 'infinite-ajax-scroll' so for example: sites/all/libraries/infinite-ajax-scroll. The module expects the library in the dist directory.
With this the following features are added:
- Keep track of history #2012910: Infinite scrolling should have a periodic load more link., #1989144: Permalink to scrolled content, #1460406: When return on Search page should scroll page to see the node I opened priviously, #1986788: Create a browser history
- Load earlier #2016653: Load more earlier then when view hits the bottom?
- AJAX Support #1121530: Make the ajax loading more lightweight with menu callback., #1121530: Make the ajax loading more lightweight with menu callback.
Almost all the settings provided by the library can be set using the settings form of the pager.
Comments
Comment #1
h3rj4n CreditAttribution: h3rj4n commentedAnd the patch.
Comment #2
h3rj4n CreditAttribution: h3rj4n commentedFixed some bugs and typo's.
Comment #3
swim CreditAttribution: swim commentedThis is a fantastic idea +1.
Comment #4
Paul Lomax CreditAttribution: Paul Lomax commentedThis is awsome, works flawlessly so far. RTBC +1
I think the problem is to switch it over would break a lot of peoples sites in a straight upgrade, but this is a huge improvement so probably worth it in the long run.
Comment #5
hefox CreditAttribution: hefox commentedThe loading gif is broken
Not that this is for the 1.x version; there's now a 2.x
Comment #6
hefox CreditAttribution: hefox commentedfixing image bath to use base_url instead of url(, which gets the current language added and breaks. Also removing the part about only supporting one per page -- I think that's an outdated requirment?
Comment #7
hefox CreditAttribution: hefox commentedIt's positioning the load more items after the last views-row, which is a hassle for themeing, and mean user can't effect where's it's placed, so small patch to add it after the pager.
Comment #8
hefox CreditAttribution: hefox commented1) drupal.attachBehaviors wasn't being called
2) all the stuff about changing the path to not use ajax isn't relavent for this js library, as it works without needing to do that.
Comment #9
Lukas von BlarerOh wow! Finally this module gets the threshold feature back! This was a big problem for a few websites I created. Lets get this committed!
Comment #10
vintorg CreditAttribution: vintorg commentedI applied the patch in #8. I'm getting the JS error:
Uncaught ReferenceError: IASCallbacks is not defined
Comment #11
pacome CreditAttribution: pacome commentedi'm also getting this error : Uncaught TypeError: Cannot call method 'Deferred' of undefined in jquery-ias.min.js
Comment #12
hefox CreditAttribution: hefox commentedUsing the 1.x version of the library?
Comment #13
pacome CreditAttribution: pacome commentedOeps !
Thanks hefox, i forgot to download that one..
No more errors with 1.x library
Thanks for the great work !
Comment #14
pacome CreditAttribution: pacome commenteda quick question : i was hoping the use of this new library could solve the issue here https://drupal.org/node/2164235, where javascript included in the view get stripped after the first page, but it doesn't seem to work (all the rest works perfectly).
Is that a bug that should be fixed with the patches up here ? (just trying to figure out if i'm missing something here or not ;) )
thx
Comment #15
vintorg CreditAttribution: vintorg commentedThe new library didn't work for me when I tried it. I had to use the original version.
I have the duplicating rows problem at the end of my view scroll, so I don't know what solution to try with that.
Comment #16
hefox CreditAttribution: hefox commentedadding a filter_xss and t around the trigger text
"didn't work for me" isn't really a good bug report :( unless you mean the bug was that it was causing duplicates? unclear comment
Comment #17
vintorg CreditAttribution: vintorg commentedI ended up figuring out my issue. I'm using Responsive Grid with Views, and the Views Infinite Scroll module doesn't support it. I'm using some jQuery to hold it together right now, but after I finish this project, I'll go back and submit a patch for that support, if one doesn't exist at that time.
Comment #18
hefox CreditAttribution: hefox commentedQuick reroll to remove div from selectors as they are not needed and limit the markup that can be used when themeing the view.
Comment #19
hefox CreditAttribution: hefox commentedReroll with correct files
Comment #20
jmdall CreditAttribution: jmdall commentedHi,
I've added an option in the view infinite scroll options, to set the scrollContainer :
By default, scroll events are listened from the $(window) object. You can use this setting to specify a custom container, for example a div with overflow.
Comment #21
claudiu.cristea@jmdall, can you post an interdiff too? It's so hard to track changes
Comment #22
jmdall CreditAttribution: jmdall commentedSomething went wrong with my last patch (corrupted), here's a new one.
I'll try to do an interdiff.
Comment #23
jmdall CreditAttribution: jmdall commentedHere's the interdiff of my last patch in #22
Ok sorry again, it's my first time/patch/interdiff and the interdiff is missing some changes...
Comment #24
hefox CreditAttribution: hefox commentedThis is incorrect syntex as far as coding standards go, else should be on it's own line. Other than that looks fine
Comment #25
jmdall CreditAttribution: jmdall commentedOk, new patch working correctly respecting coding standard and with interdiff with #19.
Like I've said on #20, it add the possibility to set the scrollContainer
Thanks hefox.
Comment #26
jmdall CreditAttribution: jmdall commentedAdding missing line ending at the end of the patch that could cause troubles to apply.
Comment #27
jmdall CreditAttribution: jmdall commentedComment #28
claudiu.cristeaApplying the patch from #26 gives next error
So, it doesn't work having no scroll container
Comment #29
jmdall CreditAttribution: jmdall commentedHere's a new patch that add a check to fix this Notice, even though I'm surprised that it doesn't work with this notice. I couldn't reproduce with no scroll container set.
Comment #30
claudiu.cristeaWhat version of PHP?
Comment #31
jmdall CreditAttribution: jmdall commentedVersion 5.4.4
Comment #32
caminadaf CreditAttribution: caminadaf commentedThe notice reported happened because you had to set a default for scroll_container on option_definition, or else this default would not be set and would return NULL. You probably didn't get this error because you had already set it once, so the variable $options['ias]['scroll_container'] was already set.
I fixed this issue and also updated the patch with the current HEAD for branch 7.x-1.x. Also did some minor coding standard fixes.
Comment #33
larjohn CreditAttribution: larjohn commentedI am not able to apply this patch... either with git or with patch. What release are they aimed at?
Comment #34
hackwater CreditAttribution: hackwater commented@larjohn, I had to manually apply the .info file changes and remove that part of the patch to get it to apply to the 7.x-1.x-dev release; the patch applies cleanly against the 7.x-1.x Git branch for me (
git clone --branch 7.x-1.x http://git.drupal.org/project/views_infinite_scroll.git
if you haven't cloned the repo already, orgit checkout -b 7.x-1.x --track origin/7.x-1.x
to switch to the branch in your existing repo).Comment #35
caminadaf CreditAttribution: caminadaf commented@hackwater and larjohn, did you manage to apply this patch? If so, can we move this to Review?
Comment #36
hackwater CreditAttribution: hackwater commented@caminadaf I applied it via the method I outlined in #34, and it's working on a client site, but it's very lightly tested.
Comment #37
ron_s CreditAttribution: ron_s commentedThis patch needs to be reworked as an option, rather than a replacement, for the existing library.
I'm not sure if anyone has realized this, but the library used in this patch is only free for personal use. It cannot be used on any website that sells anything without purchasing a license:
https://infiniteajaxscroll.com/download.html
Comment #38
Honza Pobořil CreditAttribution: Honza Pobořil as a volunteer commented7.x-1.x will receive no work. Migrate to 7.x-2.x.