- Error: Cookies are blocked due to unexpected output. For help, please see this documentation or try the support forums.
/* * pagination.js 2.1.5 * A jQuery plugin to provide simple yet fully customisable pagination. * https://github.com/superRaytin/paginationjs * * Homepage: http://pagination.js.org * * Copyright 2014-2100, superRaytin * Released under the MIT license. */ (function(global, $) { if (typeof $ === 'undefined') { throwError('Pagination requires jQuery.'); } var pluginName = 'pagination'; var pluginHookMethod = 'addHook'; var eventPrefix = '__pagination-'; var isFunction = function(func){ return typeof func === "function"; } var isNumeric = function( obj ) { // As of jQuery 3.0, isNumeric is limited to // strings and numbers (primitives or objects) // that can be coerced to finite numbers (gh-2662) var type = typeof obj; return ( type === "number" || type === "string" ) && // parseFloat NaNs numeric-cast false positives ("") // ...but misinterprets leading-number strings, e.g. hex literals ("0x...") // subtraction forces infinities to NaN !isNaN( obj - parseFloat( obj ) ); }; // Conflict, use backup if ($.fn.pagination) { pluginName = 'pagination2'; } $.fn[pluginName] = function(options) { if (typeof options === 'undefined') { return this; } var container = $(this); var attributes = $.extend({}, $.fn[pluginName].defaults, options); var pagination = { initialize: function() { var self = this; // Cache attributes of current instance if (!container.data('pagination')) { container.data('pagination', {}); } if (self.callHook('beforeInit') === false) return; // Pagination has been initialized, destroy it if (container.data('pagination').initialized) { $('.paginationjs', container).remove(); } // Whether to disable Pagination at the initialization self.disabled = !!attributes.disabled; // Model will be passed to the callback function var model = self.model = { pageRange: attributes.pageRange, pageSize: attributes.pageSize }; // dataSource`s type is unknown, parse it to find true data self.parseDataSource(attributes.dataSource, function(dataSource) { // Currently in asynchronous mode self.isAsync = Helpers.isString(dataSource); if (Helpers.isArray(dataSource)) { model.totalNumber = attributes.totalNumber = dataSource.length; } // Currently in asynchronous mode and a totalNumberLocator is specified self.isDynamicTotalNumber = self.isAsync && attributes.totalNumberLocator; var el = self.render(true); // Add extra className to the pagination element if (attributes.className) { el.addClass(attributes.className); } model.el = el; // Append/prepend pagination element to the container container[attributes.position === 'bottom' ? 'append' : 'prepend'](el); // Bind events self.observer(); // Pagination is currently initialized container.data('pagination').initialized = true; // Will be invoked after initialized self.callHook('afterInit', el); }); }, render: function(isBoot) { var self = this; var model = self.model; var el = model.el || $('
'); var isForced = isBoot !== true; self.callHook('beforeRender', isForced); var currentPage = model.pageNumber || attributes.pageNumber; var pageRange = attributes.pageRange || 0; var totalPage = self.getTotalPage(); var rangeStart = currentPage - pageRange; var rangeEnd = currentPage + pageRange; if (rangeEnd > totalPage) { rangeEnd = totalPage; rangeStart = totalPage - pageRange * 2; rangeStart = rangeStart < 1 ? 1 : rangeStart; } if (rangeStart <= 1) { rangeStart = 1; rangeEnd = Math.min(pageRange * 2 + 1, totalPage); } el.html(self.generateHTML({ currentPage: currentPage, pageRange: pageRange, rangeStart: rangeStart, rangeEnd: rangeEnd })); // There is only one page if (attributes.hideWhenLessThanOnePage) { el[totalPage <= 1 ? 'hide' : 'show'](); } self.callHook('afterRender', isForced); return el; }, // Generate HTML of the pages generatePageNumbersHTML: function(args) { var self = this; var currentPage = args.currentPage; var totalPage = self.getTotalPage(); var rangeStart = args.rangeStart; var rangeEnd = args.rangeEnd; var html = ''; var i; var pageLink = attributes.pageLink; var ellipsisText = attributes.ellipsisText; var classPrefix = attributes.classPrefix; var activeClassName = attributes.activeClassName; var disableClassName = attributes.disableClassName; // Disable page range, display all the pages if (attributes.pageRange === null) { for (i = 1; i <= totalPage; i++) { if (i == currentPage) { html += 'Best Commerce Classes in Aligarh