diff --git a/package.json b/package.json index 87e652e..d3cc569 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "senzill-pagination", - "version": "2.0.0", + "version": "2.0.1", "description": "Senzill-Pagination is an easy to integrate jQuery pagination plugin.", "main": "senzill-pagination.js", "scripts": { diff --git a/senzill-pagination.js b/senzill-pagination.js index 8d026b2..cdaa885 100644 --- a/senzill-pagination.js +++ b/senzill-pagination.js @@ -1,13 +1,12 @@ /************************************************************/ -/* senzill-pagination v2.0.0 */ +/* senzill-pagination v2.0.1 */ /* Author: yak0d3 */ /* Github: https://github.com/yak0d3/senzill-pagination */ /* Licence: MIT */ /******************************************************/ - -(function($){ +(function($) { $.fn.extend({ - + senzill: function(settings) { var defaults = { @@ -18,35 +17,34 @@ showOptions: [5, 10, 15, 20, 30] } - var settings = $.extend({}, defaults, settings); - - this.destroy = function(){ - $(settings.nav).remove(); - $(settings.panel).remove(); + var settings = $.extend({}, defaults, settings); + + this.destroy = function() { + $(settings.nav).empty(); + $(settings.panel).empty(); $('#sen-next, #sen-prev, #sen-select, #sen-searchBox, .numBtn').off(); - - return; + + return; } - this.elemLimit = function(num){ + this.elemLimit = function(num) { setShowElems(num); }; - var checkSettings = function(){ - if($(settings.nav) == undefined){ + var checkSettings = function() { + if ($(settings.nav) == undefined) { throw new Error('navBar proprety is missing: a navbar container id has not been specified.'); - } - else if($(settings.panel) === undefined){ + } else if ($(settings.panel) === undefined) { throw new Error('panel proprety is missing: a panel container id has not been specified.'); } }; - var loadStyles = function(){ + var loadStyles = function() { $('#sen-current').css({ 'background-color': '#8d8c8c', 'font-weight': '800', 'font-size': '.75rem' - }); + }); }; - return this.each(function(){ + return this.each(function() { checkSettings(); var $element = $(this); var elPerPage = settings.elPerPage; @@ -59,120 +57,120 @@ var _panel = (settings.panel != null) ? settings.panel : false; var showOptions = settings.showOptions; var items = elems; - if($.inArray(elPerPage, showOptions == false)){ + if ($.inArray(elPerPage, showOptions == false)) { showOptions.push(elPerPage); } - showOptions.sort(function(x, y){ + showOptions.sort(function(x, y) { return x - y; }); - var setShowElems = function(num){ - if(typeof num != 'number'){ + var setShowElems = function(num) { + if (typeof num != 'number') { throw new Error('The argument given to the setShowRes function is not a valid number.'); } elPerPage = num; totalPages = Math.ceil(items.length / elPerPage); }; - var navbar = function(current, showPerPage, total){ + var navbar = function(current, showPerPage, total) { $nav.empty(); var $bar = $nav.append('