inital commit
This commit is contained in:
9
public/plugins/bootstrap/buttons.print.min.js
vendored
Normal file
9
public/plugins/bootstrap/buttons.print.min.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
Print button for Buttons and DataTables.
|
||||
2016 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
(function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(c){return b(c,window,document)}):"object"===typeof exports?module.exports=function(c,g){c||(c=window);g&&g.fn.dataTable||(g=require("datatables.net")(c,g).$);g.fn.dataTable.Buttons||require("datatables.net-buttons")(c,g);return b(g,c,c.document)}:b(jQuery,window,document)})(function(b,c,g,y){var u=b.fn.dataTable,n=g.createElement("a"),v=function(a){n.href=a;a=n.host;-1===a.indexOf("/")&&
|
||||
0!==n.pathname.indexOf("/")&&(a+="/");return n.protocol+"//"+a+n.pathname+n.search};u.ext.buttons.print={className:"buttons-print",text:function(a){return a.i18n("buttons.print","Print")},action:function(a,k,p,h){a=k.buttons.exportData(b.extend({decodeEntities:!1},h.exportOptions));p=k.buttons.exportInfo(h);var w=k.columns(h.exportOptions.columns).flatten().map(function(d){return k.settings()[0].aoColumns[k.column(d).index()].sClass}).toArray(),r=function(d,e){for(var x="<tr>",l=0,z=d.length;l<z;l++)x+=
|
||||
"<"+e+" "+(w[l]?'class="'+w[l]+'"':"")+">"+(null===d[l]||d[l]===y?"":d[l])+"</"+e+">";return x+"</tr>"},m='<table class="'+k.table().node().className+'">';h.header&&(m+="<thead>"+r(a.header,"th")+"</thead>");m+="<tbody>";for(var t=0,A=a.body.length;t<A;t++)m+=r(a.body[t],"td");m+="</tbody>";h.footer&&a.footer&&(m+="<tfoot>"+r(a.footer,"th")+"</tfoot>");m+="</table>";var f=c.open("","");f.document.close();var q="<title>"+p.title+"</title>";b("style, link").each(function(){var d=q,e=b(this).clone()[0];
|
||||
"link"===e.nodeName.toLowerCase()&&(e.href=v(e.href));q=d+e.outerHTML});try{f.document.head.innerHTML=q}catch(d){b(f.document.head).html(q)}f.document.body.innerHTML="<h1>"+p.title+"</h1><div>"+(p.messageTop||"")+"</div>"+m+"<div>"+(p.messageBottom||"")+"</div>";b(f.document.body).addClass("dt-print-view");b("img",f.document.body).each(function(d,e){e.setAttribute("src",v(e.getAttribute("src")))});h.customize&&h.customize(f,h,k);a=function(){h.autoPrint&&(f.print(),f.close())};navigator.userAgent.match(/Trident\/\d.\d/)?
|
||||
a():f.setTimeout(a,1E3)},title:"*",messageTop:"*",messageBottom:"*",exportOptions:{},header:!0,footer:!1,autoPrint:!0,customize:null};return u.Buttons});
|
||||
7
public/plugins/bootstrap/chartjs-plugin-datalabels.min.js
vendored
Normal file
7
public/plugins/bootstrap/chartjs-plugin-datalabels.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8
public/plugins/bootstrap/jquery.counterup.min.js
vendored
Normal file
8
public/plugins/bootstrap/jquery.counterup.min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* jquery.counterup.js 1.0
|
||||
*
|
||||
* Copyright 2013, Benjamin Intal http://gambit.ph @bfintal
|
||||
* Released under the GPL v2 License
|
||||
*
|
||||
* Date: Nov 26, 2013
|
||||
*/(function(e){"use strict";e.fn.counterUp=function(t){var n=e.extend({time:400,delay:10},t);return this.each(function(){var t=e(this),r=n,i=function(){var e=[],n=r.time/r.delay,i=t.text(),s=/[0-9]+,[0-9]+/.test(i);i=i.replace(/,/g,"");var o=/^[0-9]+$/.test(i),u=/^[0-9]+\.[0-9]+$/.test(i),a=u?(i.split(".")[1]||[]).length:0;for(var f=n;f>=1;f--){var l=parseInt(i/n*f);u&&(l=parseFloat(i/n*f).toFixed(a));if(s)while(/(\d+)(\d{3})/.test(l.toString()))l=l.toString().replace(/(\d+)(\d{3})/,"$1,$2");e.unshift(l)}t.data("counterup-nums",e);t.text("0");var c=function(){t.text(t.data("counterup-nums").shift());if(t.data("counterup-nums").length)setTimeout(t.data("counterup-func"),r.delay);else{delete t.data("counterup-nums");t.data("counterup-nums",null);t.data("counterup-func",null)}};t.data("counterup-func",c);setTimeout(t.data("counterup-func"),r.delay)};t.waypoint(i,{offset:"100%",triggerOnce:!0})})}})(jQuery);
|
||||
47
public/plugins/bootstrap/jquery.paginate.css
Normal file
47
public/plugins/bootstrap/jquery.paginate.css
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
jquery.paginate.css
|
||||
Version 0.1.1
|
||||
*/
|
||||
|
||||
.paginate-pagination ul {
|
||||
|
||||
margin: 20px 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
|
||||
}
|
||||
|
||||
.paginate-pagination ul:after {
|
||||
|
||||
content: ' ';
|
||||
display: table;
|
||||
clear: both;
|
||||
|
||||
}
|
||||
|
||||
.paginate-pagination ul > li {
|
||||
|
||||
float: left;
|
||||
margin-right: 3px;
|
||||
|
||||
}
|
||||
|
||||
.paginate-pagination ul > li > a.page {
|
||||
|
||||
display: block;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
text-align: center;
|
||||
line-height: 30px;
|
||||
border: 1px solid #ddd;
|
||||
background: white;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
|
||||
.paginate-pagination ul > li > a.page:hover { opacity: 0.7; }
|
||||
.paginate-pagination ul > li > a.page.active { opacity: 0.7; cursor: default; }
|
||||
|
||||
.paginate-pagination ul > li > a.page-next.deactive,
|
||||
.paginate-pagination ul > li > a.page-prev.deactive { opacity: 0.7; cursor: default; }
|
||||
211
public/plugins/bootstrap/jquery.paginate.js
Normal file
211
public/plugins/bootstrap/jquery.paginate.js
Normal file
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
jquery.paginate
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
Description: Add a pagination to everything.
|
||||
Version: Version 0.3.0
|
||||
Author: Kevin Eichhorn (https://github.com/neighbordog)
|
||||
*/
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
$.paginate = function(element, options) {
|
||||
|
||||
/*
|
||||
#Defaults
|
||||
*/
|
||||
var defaults = {
|
||||
perPage: 3, //how many items per page
|
||||
autoScroll: true, //boolean: scroll to top of the container if a user clicks on a pagination link
|
||||
scope: '', //which elements to target
|
||||
paginatePosition: ['bottom'], //defines where the pagination will be displayed
|
||||
containerTag: 'nav',
|
||||
paginationTag: 'ul',
|
||||
itemTag: 'li',
|
||||
linkTag: 'a',
|
||||
useHashLocation: true, //Determines whether or not the plugin makes use of hash locations
|
||||
onPageClick: function() {} //Triggered when a pagination link is clicked
|
||||
|
||||
};
|
||||
|
||||
var plugin = this;
|
||||
var plugin_index = $('.paginate').length;
|
||||
|
||||
plugin.settings = {};
|
||||
|
||||
var $element = $(element);
|
||||
|
||||
var curPage, items, offset, maxPage;
|
||||
|
||||
/*
|
||||
#Initliazes plugin
|
||||
*/
|
||||
plugin.init = function() {
|
||||
plugin.settings = $.extend({}, defaults, options);
|
||||
|
||||
curPage = 1;
|
||||
items = $element.children(plugin.settings.scope);
|
||||
maxPage = Math.ceil( items.length / plugin.settings.perPage ); //determines how many pages exist
|
||||
|
||||
var paginationHTML = generatePagination(); //generate HTML for pageination
|
||||
|
||||
if($.inArray('top', plugin.settings.paginatePosition) > -1) {
|
||||
$element.before(paginationHTML);
|
||||
}
|
||||
|
||||
if($.inArray('bottom', plugin.settings.paginatePosition) > -1) {
|
||||
$element.after(paginationHTML);
|
||||
}
|
||||
|
||||
$element.addClass("paginate");
|
||||
$element.addClass("paginate-" + plugin_index);
|
||||
|
||||
var hash = location.hash.match(/\#paginate\-(\d)/i);
|
||||
|
||||
//Check if URL has matching location hash
|
||||
if(hash && plugin.settings.useHashLocation) {
|
||||
plugin.switchPage(hash[1]);
|
||||
} else {
|
||||
plugin.switchPage(1); //go to initial page
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
#Switch to Page > 'page'
|
||||
*/
|
||||
plugin.switchPage = function(page) {
|
||||
|
||||
if(page == "next") {
|
||||
page = curPage + 1;
|
||||
}
|
||||
|
||||
if(page == "prev") {
|
||||
page = curPage - 1;
|
||||
}
|
||||
|
||||
//If page is out of range return false
|
||||
if(page < 1 || page > maxPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(page > maxPage) {
|
||||
$('.paginate-pagination-' + plugin_index).find('.page-next').addClass("deactive");
|
||||
return false;
|
||||
} else {
|
||||
$('.paginate-pagination-' + plugin_index).find('.page-next').removeClass("deactive");
|
||||
}
|
||||
|
||||
$('.paginate-pagination-' + plugin_index).find('.active').removeClass('active');
|
||||
$('.paginate-pagination-' + plugin_index).find('.page-' + page).addClass('active');
|
||||
|
||||
offset = (page - 1) * plugin.settings.perPage;
|
||||
|
||||
$( items ).hide();
|
||||
|
||||
//Display items of page
|
||||
for(i = 0; i < plugin.settings.perPage; i++) {
|
||||
if($( items[i + offset] ).length)
|
||||
$( items[i + offset] ).fadeTo(100, 1);
|
||||
}
|
||||
|
||||
//Deactive prev button
|
||||
if(page == 1) {
|
||||
$('.paginate-pagination-' + plugin_index).find('.page-prev').addClass("deactive");
|
||||
} else {
|
||||
$('.paginate-pagination-' + plugin_index).find('.page-prev').removeClass("deactive");
|
||||
}
|
||||
|
||||
//Deactive next button
|
||||
if(page == maxPage) {
|
||||
$('.paginate-pagination-' + plugin_index).find('.page-next').addClass("deactive");
|
||||
} else {
|
||||
$('.paginate-pagination-' + plugin_index).find('.page-next').removeClass("deactive");
|
||||
}
|
||||
|
||||
curPage = page;
|
||||
|
||||
return curPage;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
#Kills plugin
|
||||
*/
|
||||
plugin.kill = function() {
|
||||
|
||||
$( items ).show();
|
||||
$('.paginate-pagination-' + plugin_index).remove();
|
||||
$element.removeClass('paginate');
|
||||
$element.removeData('paginate');
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
#Generates HTML for pagination (nav)
|
||||
*/
|
||||
var generatePagination = function() {
|
||||
|
||||
var paginationEl = '<' + plugin.settings.containerTag + ' class="paginate-pagination paginate-pagination-' + plugin_index + '" data-parent="' + plugin_index + '">';
|
||||
paginationEl += '<' + plugin.settings.paginationTag + '>';
|
||||
|
||||
paginationEl += '<' + plugin.settings.itemTag + '>';
|
||||
paginationEl += '<' + plugin.settings.linkTag + ' href="#" data-page="prev" class="page page-prev">«</' + plugin.settings.linkTag + '>';
|
||||
paginationEl += '</' + plugin.settings.itemTag + '>';
|
||||
|
||||
for(i = 1; i <= maxPage; i++) {
|
||||
paginationEl += '<' + plugin.settings.itemTag + '>';
|
||||
paginationEl += '<' + plugin.settings.linkTag + ' href="#paginate-' + i + '" data-page="' + i + '" class="page page-' + i + '">' + i + '</' + plugin.settings.linkTag + '>';
|
||||
paginationEl += '</' + plugin.settings.itemTag + '>';
|
||||
}
|
||||
|
||||
paginationEl += '<' + plugin.settings.itemTag + '>';
|
||||
paginationEl += '<' + plugin.settings.linkTag + ' href="#" data-page="next" class="page page-next">»</' + plugin.settings.linkTag + '>';
|
||||
paginationEl += '</' + plugin.settings.itemTag + '>';
|
||||
|
||||
paginationEl += '</' + plugin.settings.paginationTag + '>';
|
||||
paginationEl += '</' + plugin.settings.containerTag + '>';
|
||||
|
||||
//Adds event listener for the buttons
|
||||
$(document).on('click', '.paginate-pagination-' + plugin_index + ' .page', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var page = $(this).data('page');
|
||||
var paginateParent = $(this).parents('.paginate-pagination').data('parent');
|
||||
|
||||
//Call onPageClick callback function
|
||||
$('.paginate-' + paginateParent).data('paginate').settings.onPageClick();
|
||||
|
||||
page = $('.paginate-' + paginateParent).data('paginate').switchPage(page);
|
||||
|
||||
if(page) {
|
||||
if(plugin.settings.useHashLocation)
|
||||
location.hash = '#paginate-' + page; //set location hash
|
||||
|
||||
if(plugin.settings.autoScroll)
|
||||
$('html, body').animate({scrollTop: $('.paginate-' + paginateParent).offset().top}, 'slow');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return paginationEl;
|
||||
|
||||
};
|
||||
|
||||
plugin.init();
|
||||
|
||||
};
|
||||
|
||||
$.fn.paginate = function(options) {
|
||||
|
||||
return this.each(function() {
|
||||
if (undefined === $(this).data('paginate')) {
|
||||
var plugin = new $.paginate(this, options);
|
||||
$(this).data('paginate', plugin);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
}( jQuery ));
|
||||
7134
public/plugins/bootstrap/js/bootstrap.bundle.js
vendored
Normal file
7134
public/plugins/bootstrap/js/bootstrap.bundle.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
public/plugins/bootstrap/js/bootstrap.bundle.js.map
Normal file
1
public/plugins/bootstrap/js/bootstrap.bundle.js.map
Normal file
File diff suppressed because one or more lines are too long
7
public/plugins/bootstrap/js/bootstrap.bundle.min.js
vendored
Normal file
7
public/plugins/bootstrap/js/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/plugins/bootstrap/js/bootstrap.bundle.min.js.map
Normal file
1
public/plugins/bootstrap/js/bootstrap.bundle.min.js.map
Normal file
File diff suppressed because one or more lines are too long
4521
public/plugins/bootstrap/js/bootstrap.js
vendored
Normal file
4521
public/plugins/bootstrap/js/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
public/plugins/bootstrap/js/bootstrap.js.map
Normal file
1
public/plugins/bootstrap/js/bootstrap.js.map
Normal file
File diff suppressed because one or more lines are too long
7
public/plugins/bootstrap/js/bootstrap.min.js
vendored
Normal file
7
public/plugins/bootstrap/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/plugins/bootstrap/js/bootstrap.min.js.map
Normal file
1
public/plugins/bootstrap/js/bootstrap.min.js.map
Normal file
File diff suppressed because one or more lines are too long
7
public/plugins/bootstrap/js/chartjs-plugin-datalabels.min.js
vendored
Normal file
7
public/plugins/bootstrap/js/chartjs-plugin-datalabels.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
243
public/plugins/bootstrap/pagination.js
Normal file
243
public/plugins/bootstrap/pagination.js
Normal file
@@ -0,0 +1,243 @@
|
||||
/**
|
||||
* jquery-rpmPagination - v2.0
|
||||
* A jQuery plugin for simple dynamic frontend pagination with Bootstrap CSS
|
||||
* https://github.com/sabbir-rupom/pagination-jquery
|
||||
*
|
||||
* Copyright 2019, Sabbir Hossain Rupom
|
||||
*/
|
||||
|
||||
/* jshint esversion: 6 */
|
||||
(function ($) {
|
||||
"use strict";
|
||||
/**
|
||||
* Plugin root function rpmPagination()
|
||||
*
|
||||
* @param object options Option parameter for intializing pagination plugin
|
||||
* *-----* {property} limit Pagination item limit, [ optional ] default is 10
|
||||
* *-----* {property} total Pagination item count in total [ optional ]
|
||||
* *-----* {property} currentPage Current/Active page number of pagination
|
||||
* *-----* {property} domElement Html element [tag/class] which will be count as Pagination item
|
||||
* *-------------------------------[ must be provided for dynamic pagination without page refresh, optional otherwise ]
|
||||
* *-----* {property} refresh Page refresh flag, if enabled- page will be refreshed with query/get/post parameters [ optional ]
|
||||
* *-----* {property} link Page refresh link [ must be provided if refresh flag is enabled, optional otherwise ]
|
||||
* *-----* {property} formElement Pagination item filter form identity element [ optional ]
|
||||
* *-------------------------------[ If page has custom item search filter form, the pagination function will use the form to refresh the page with limit/offset parameters ]
|
||||
*
|
||||
* @returns boolean true
|
||||
*/
|
||||
|
||||
var bsVersion = 3;
|
||||
if(typeof $.fn.tooltip !== 'undefined') {
|
||||
bsVersion = $.fn.tooltip.Constructor.VERSION.split('.')[0];
|
||||
}
|
||||
var rpmListClass = 'page-item',
|
||||
rpmAnchorClass = 'page-link', rpmHideClass = 'hide';
|
||||
|
||||
$.fn.rpmPagination = function (options) {
|
||||
var settings = $.extend({
|
||||
limit: 10,
|
||||
total: 0,
|
||||
currentPage: 1,
|
||||
domElement: '.p-item',
|
||||
refresh: false,
|
||||
link: null,
|
||||
formElement: null
|
||||
}, options);
|
||||
|
||||
let $this = $(this),
|
||||
pages = 1,
|
||||
rpmPageNext = settings.limit,
|
||||
rpmPageTotal = settings.total,
|
||||
tBool = false,
|
||||
rpmPageDomElem = settings.domElement, rpmCustomDomElem = 'p-' + Math.random().toString(36).substr(2, 6),
|
||||
version = bsVersion[0];
|
||||
|
||||
if (version == 4) {
|
||||
rpmListClass = 'page-item ' + rpmListClass;
|
||||
rpmHideClass = 'd-none', rpmAnchorClass = 'page-link';
|
||||
}
|
||||
|
||||
if (rpmPageTotal <= 0) {
|
||||
tBool = true;
|
||||
}
|
||||
|
||||
$(rpmPageDomElem).each(function (i, obj) {
|
||||
if (tBool) {
|
||||
rpmPageTotal = i + 1;
|
||||
}
|
||||
$(obj).addClass(rpmCustomDomElem);
|
||||
$(obj).addClass(rpmCustomDomElem + '-' + parseInt(i + 1));
|
||||
});
|
||||
|
||||
if (rpmPageTotal > settings.limit) {
|
||||
pages = parseInt((rpmPageTotal / settings.limit) + 1);
|
||||
}
|
||||
|
||||
preparePageMenus(settings.currentPage, pages, $this);
|
||||
|
||||
[settings.currentPage, rpmPageNext] = preparePageItems(settings.currentPage, rpmPageNext, settings.limit, rpmCustomDomElem, 'page-item');
|
||||
|
||||
if (settings.refresh && $('.' + rpmCustomDomElem).length > 0) {
|
||||
$('.' + rpmCustomDomElem).removeClass(rpmHideClass)
|
||||
}
|
||||
|
||||
/**
|
||||
* Process html pagination on pagination-menu click
|
||||
*/
|
||||
$(document).on('click', '.page-item > a', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
if ($(this).parent().hasClass('disabled') || $(this).parent($this).length === 0) {
|
||||
return false;
|
||||
} else {
|
||||
if (settings.refresh === true) {
|
||||
refreshPageforItems($(this), settings.currentPage, settings.limit, settings.link, settings.formElement);
|
||||
} else {
|
||||
if ($(this).parent().hasClass('prev')) {
|
||||
[settings.currentPage, rpmPageNext] = preparePageItems(settings.currentPage, rpmPageNext, settings.limit, rpmCustomDomElem, 'prev');
|
||||
} else if ($(this).parent().hasClass('next')) {
|
||||
[settings.currentPage, rpmPageNext] = preparePageItems(settings.currentPage, rpmPageNext, settings.limit, rpmCustomDomElem, 'next');
|
||||
} else {
|
||||
let cl = $(this).data('page_no');
|
||||
settings.currentPage = parseInt(cl);
|
||||
[settings.currentPage, rpmPageNext] = preparePageItems(settings.currentPage, rpmPageNext, settings.limit, rpmCustomDomElem, 'page-item');
|
||||
}
|
||||
}
|
||||
|
||||
preparePageMenus(settings.currentPage, pages, $this);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {obj} obj Pagination item anchor object
|
||||
* @param {int} current Current page number
|
||||
* @param {int} limit Pagination item limit
|
||||
* @param {string} url Custom source url for passing query parameters
|
||||
* @param {string} form Query-Element-String to determined existing form
|
||||
* @returns {} nothing
|
||||
*/
|
||||
function refreshPageforItems(obj, current, limit, url, form) {
|
||||
let offset = 0;
|
||||
|
||||
if (obj.parent().hasClass('prev')) {
|
||||
offset = limit * (current - 2);
|
||||
} else if (obj.parent().hasClass('next')) {
|
||||
offset = limit * current;
|
||||
|
||||
} else {
|
||||
let cl = obj.data('page_no');
|
||||
current = parseInt(cl);
|
||||
offset = limit * (current - 1);
|
||||
}
|
||||
|
||||
let ap;
|
||||
if (form === null || form === '' || $(form).length <= 0) {
|
||||
ap = '?';
|
||||
if (url.includes('?')) {
|
||||
ap = '&';
|
||||
}
|
||||
|
||||
window.location.href = url + ap + 'limit=' + limit + '&offset=' + offset;
|
||||
} else {
|
||||
form = $(form);
|
||||
}
|
||||
|
||||
form.append($("<input />").attr("type", "hidden").attr("name", "limit").attr("value", limit));
|
||||
form.append($("<input />").attr("type", "hidden").attr("name", "offset").attr("value", offset)).submit();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show / Hide pagination items based on current page-menu
|
||||
*
|
||||
* @param {num} current_page Current page number
|
||||
* @param {num} next Number of next pagination item
|
||||
* @param {num} limit Pagination item limit to show in frontend
|
||||
* @param {string} element Pagination item element
|
||||
* @param {string} type Type of pagination menu
|
||||
* @returns {Array} [ Current page number and Number of next pagination item ]
|
||||
*/
|
||||
var preparePageItems = function (current_page, next, limit, element, type) {
|
||||
|
||||
$('.' + element).addClass(rpmHideClass)
|
||||
|
||||
var current = 0;
|
||||
|
||||
if (type === 'prev') {
|
||||
next = next - limit;
|
||||
current = next - limit + 1;
|
||||
for (let i = current; i <= next; i++) {
|
||||
$('.' + element + '-' + i).removeClass(rpmHideClass);
|
||||
}
|
||||
current_page--;
|
||||
|
||||
} else if (type === 'next') {
|
||||
current = next + 1;
|
||||
next = next + limit;
|
||||
for (let i = current; i <= next; i++) {
|
||||
$('.' + element + '-' + i).removeClass(rpmHideClass);
|
||||
}
|
||||
current_page++;
|
||||
} else if (type === 'page-item') {
|
||||
current = (limit * (current_page - 1)) + 1;
|
||||
next = (limit * (current_page - 1)) + limit;
|
||||
for (let i = current; i <= next; i++) {
|
||||
$('.' + element + '-' + i).removeClass(rpmHideClass);
|
||||
}
|
||||
}
|
||||
|
||||
return [current_page, next];
|
||||
};
|
||||
|
||||
/**
|
||||
* Rearrage pagination menu after each pagination item list transition
|
||||
*
|
||||
* @param {num} current_page
|
||||
* @param {num} pages
|
||||
* @param {string} element
|
||||
* @returns {boolean} true
|
||||
*/
|
||||
var preparePageMenus = function (current_page, pages, element) {
|
||||
|
||||
$(element).html('');
|
||||
let pageArray = [], fp = 1, lp = (pages - 1);
|
||||
let menuHtml = '';
|
||||
|
||||
if (Math.abs(current_page - fp) < 3) {
|
||||
pageArray = [1, 2, 3, 4, '...', lp];
|
||||
} else if (Math.abs(current_page - lp) < 3) {
|
||||
pageArray = [1, '...', lp - 3, lp - 2, lp - 1, lp];
|
||||
} else if (lp <= 6) {
|
||||
for (let i = 1; i <= lp; i++) {
|
||||
pageArray.push(i);
|
||||
}
|
||||
} else {
|
||||
pageArray = [1, '...', current_page - 1, current_page, current_page + 1, '...', lp];
|
||||
}
|
||||
|
||||
menuHtml = '<li class="' + rpmListClass + ' prev ' + (current_page === fp ? 'disabled' : '') + '"><a class="' + rpmAnchorClass + '" href="#">prev</a></li>';
|
||||
for (let i = 0; i < pageArray.length; i++) {
|
||||
if (lp <= i) {
|
||||
break;
|
||||
} else {
|
||||
|
||||
if (pageArray[i] === '...') {
|
||||
menuHtml += '<li class="' + rpmListClass + ' page-inf disabled"><a class="' + rpmAnchorClass + '" data-page_no="..." href="#">...</a></li>';
|
||||
} else {
|
||||
menuHtml += '<li class="' + rpmListClass + ' page-' + pageArray[i] + ' ' + (pageArray[i] === current_page ? 'disabled' : '') + '"><a class="' + rpmAnchorClass + '" data-page_no="' + pageArray[i] + '" href="#">' + pageArray[i] + '</a></li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
menuHtml += '<li class="' + rpmListClass + ' next ' + (current_page === lp ? 'disabled' : '') + '"><a class="' + rpmAnchorClass + '" href="#">next</a></li>';
|
||||
$(element).append(menuHtml);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user