Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug with multiple call onPageClick fixed (issue josecebe#9) + remove …
…initial onPageClick call + remove unnecessary method
  • Loading branch information
Eugene Simakin committed Jul 16, 2014
1 parent c6d928b commit 9f33a21
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 39 deletions.
21 changes: 2 additions & 19 deletions jquery.twbsPagination.js
@@ -1,5 +1,5 @@
/**
* jQuery pagination plugin v1.1.1
* jQuery pagination plugin v1.1.2
* http://esimakin.github.io/twbs-pagination/
*
* Copyright 2014, Eugene Simakin
Expand Down Expand Up @@ -41,7 +41,7 @@
}

if (this.options.onPageClick instanceof Function) {
this.$element.bind('page', this.options.onPageClick);
this.$element.first().bind('page', this.options.onPageClick);
}

var tagName = (typeof this.$element.prop === 'function') ?
Expand All @@ -62,8 +62,6 @@
this.render(this.getPages(this.options.startPage));
this.setupEvents();

this.$element.trigger('page', this.options.startPage);

return this;
},

Expand Down Expand Up @@ -212,17 +210,6 @@
});
},

equals: function (arr1, arr2) {
var i = 0;
while ((i < arr1.length) || (i < arr2.length)) {
if (arr1[i] !== arr2[i]) {
return false;
}
i++;
}
return true;
},

href: function (c) {
return this.options.href.replace(this.options.hrefVariable, c);
}
Expand All @@ -244,10 +231,6 @@

return ( methodReturn === undefined ) ? $this : methodReturn;
};

$.fn.resetPaging = function () {
$(this).data('twbs-pagination', null);
};

$.fn.twbsPagination.defaults = {
totalPages: 0,
Expand Down
10 changes: 1 addition & 9 deletions jquery.twbsPagination.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions tests/test.js
Expand Up @@ -5,17 +5,6 @@
totalPages: 30
});

test("Test 'equals' method", function () {
var a1 = [5, 4, 5, 8, 7, 9, 1, 70];
var a2 = [5, 4, 5, 8, 7, 9, 1, 70];
var b = [1, 4, 8];
var real = [1, 4, 8, 9, 0, undefined, 5000];
ok(pag1.twbsPagination('equals', a1, a1), "Check the same array");
ok(pag1.twbsPagination('equals', a1, a2), "Check separate equals array");
ok(!pag1.twbsPagination('equals', a1, b), "Check not equal array");
ok(!pag1.twbsPagination('equals', b, real), "Dirty test");
});

test("Test 'getPages' method (EVEN visible pages number)", function () {
var expected1 = {currentPage: 1, numeric: [1, 2, 3, 4, 5]};
deepEqual(pag1.twbsPagination('getPages', 1), expected1);
Expand Down

0 comments on commit 9f33a21

Please sign in to comment.