Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

## 2.1.1

* Changed argument of `load` event from url to event object
* Fixed `prev()` return value

## 2.1.0

* Added History extension
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Infinite Ajax Scroll 2
======================
Infinite Ajax Scroll
====================

A jQuery plugin to turn your paginated pages into infinite scrolling pages with ease.

Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "jquery-ias",
"version": "2.1.0",
"version": "2.1.1",
"homepage": "http://infiniteajaxscroll.com",
"main": "src/jquery.ias.js",
"main": "src/jquery-ias.js",
"ignore": [
"**/.*",
"node_modules",
Expand Down
2 changes: 1 addition & 1 deletion ias.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ias",
"title": "Infinite Ajax Scroll",
"description": "jQuery plugin that progressively enhances your server-side pagination",
"version": "2.1.0",
"version": "2.1.1",
"homepage": "http://infiniteajaxscroll.com",
"download": "http://infiniteajaxscroll.com/download.html",
"docs": "http://infiniteajaxscroll.com/docs/getting-started.html",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jquery-ias",
"title": "Infinite Ajax Scroll",
"version": "2.1.0",
"version": "2.1.1",
"description": "A jQuery plugin that turns your server-side pagination into an infinite scrolling one using AJAX",
"homepage": "http://infiniteajaxscroll.com",
"main": "src/jquery-ias.js",
Expand Down
10 changes: 7 additions & 3 deletions src/jquery-ias.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Infinite Ajax Scroll v2.1.0
* Infinite Ajax Scroll v2.1.1
* A jQuery plugin for infinite scrolling
* http://infiniteajaxscroll.com
*
Expand Down Expand Up @@ -171,9 +171,13 @@

delay = delay || this.defaultDelay;

self.fire('load', [url]);
var loadEvent = {
url: url
};

self.fire('load', [loadEvent]);

return $.get(url, null, $.proxy(function(data) {
return $.get(loadEvent.url, null, $.proxy(function(data) {
$itemContainer = $(this.itemsContainerSelector, data).eq(0);
if (0 === $itemContainer.length) {
$itemContainer = $(data).filter(this.itemsContainerSelector).eq(0);
Expand Down
32 changes: 32 additions & 0 deletions test/02-listeners-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,38 @@ describe("IAS", function () {
return deferred.promise;
});

it("should allow url to be changed in load event", function() {
var deferred = when.defer();

jQuery.ias({
container : '.listing',
item: '.post',
pagination: '.navigation',
next: '.next-posts a'
});

// first listener changes the url
jQuery.ias().on('load', function (loadEvent) {
// assert that it isn't already there
buster.refute.contains(loadEvent.url, "ajax=1");

loadEvent.url = loadEvent.url + "?ajax=1";
});

// second listener asserts the url is changed
jQuery.ias().on('load', function (loadEvent) {
buster.assert.contains(loadEvent.url, "ajax=1");
});

scrollDown().then(function() {
wait(2000).then(function() {
deferred.resolve();
});
});

return deferred.promise;
});

it("should call render listeners when render is complete", function() {
var deferred = when.defer();
var spy1 = this.spy();
Expand Down
14 changes: 12 additions & 2 deletions test/buster.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
var config = module.exports;
var config = module.exports,
fs = require('fs'),
bower = {
jquery: {
main: 'jquery.js'
}
};

if (fs.existsSync('bower_components/jquery/bower.json')) {
bower.jquery = JSON.parse(fs.readFileSync('bower_components/jquery/bower.json', 'utf8'))
}

config["My tests"] = {
rootPath: "../",
environment: "browser", // or "node"
libs: [
"bower_components/jquery/jquery.min.js"
"bower_components/jquery/" + bower.jquery.main.replace(/^\.\//, ''),
],
sources: [
"src/callbacks.js",
Expand Down