mirror of
https://github.com/evilhero/mylar
synced 2025-01-03 05:24:43 +00:00
FIX: main page/manage comics missing js for pagination to work
This commit is contained in:
parent
54c8d78496
commit
0fe8ab7ad8
1 changed files with 41 additions and 0 deletions
41
data/js/libs/full_numbers_no_ellipses.js
Normal file
41
data/js/libs/full_numbers_no_ellipses.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
$.fn.DataTable.ext.pager.simple_numbers = function(page, pages){
|
||||||
|
var numbers = [];
|
||||||
|
var buttons = $.fn.DataTable.ext.pager.numbers_length;
|
||||||
|
var half = Math.floor( buttons / 2 );
|
||||||
|
|
||||||
|
var _range = function ( len, start ){
|
||||||
|
var end;
|
||||||
|
|
||||||
|
if ( typeof start === "undefined" ){
|
||||||
|
start = 0;
|
||||||
|
end = len;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
end = start;
|
||||||
|
start = len;
|
||||||
|
}
|
||||||
|
|
||||||
|
var out = [];
|
||||||
|
for ( var i = start ; i < end; i++ ){ out.push(i); }
|
||||||
|
|
||||||
|
return out;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
if ( pages <= buttons ) {
|
||||||
|
numbers = _range( 0, pages );
|
||||||
|
|
||||||
|
} else if ( page <= half ) {
|
||||||
|
numbers = _range( 0, buttons);
|
||||||
|
|
||||||
|
} else if ( page >= pages - 1 - half ) {
|
||||||
|
numbers = _range( pages - buttons, pages );
|
||||||
|
|
||||||
|
} else {
|
||||||
|
numbers = _range( page - half, page + half + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
numbers.DT_el = 'span';
|
||||||
|
|
||||||
|
return [ 'first', 'previous', numbers, 'next', 'last' ];
|
||||||
|
};
|
Loading…
Reference in a new issue