pagination
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -13,3 +13,2 @@ #! /usr/bin/env node | ||
.option('-t, --template', 'Include TemplatePaginator') | ||
//.option('-r, --release', 'Building release versions') | ||
.option('-a, --all', 'Include all: Template Engine, ItemPaginator, SearchPaginator, TemplatePaginator') | ||
@@ -38,2 +37,3 @@ .parse(process.argv); | ||
releaseContent.push(fs.readFileSync('./lib/browser.js')); | ||
releaseContent.push(fs.readFileSync('./lib/pagination.js')); | ||
@@ -44,3 +44,4 @@ pkgs.forEach(function(m) { | ||
}); | ||
var minified = uglifyJs.minify(releaseContent.join(";"), {fromString: true}); | ||
var content = releaseContent.join(";"); | ||
var minified = uglifyJs.minify(content, {fromString: true}); | ||
@@ -50,4 +51,5 @@ if (program.output) { | ||
} else { | ||
console.log(content); | ||
console.log(minified.code); | ||
} | ||
@@ -20,4 +20,7 @@ #! /usr/bin/env node | ||
var paginationContent = fs.readFileSync('./lib/pagination.js'); | ||
var minified = uglifyJs.minify(paginationContent + ';', {fromString: true}); | ||
var paginationContent = []; | ||
paginationContent.push(fs.readFileSync('./lib/browser.js')); | ||
paginationContent.push(fs.readFileSync('./lib/pagination.js')); | ||
var minified = uglifyJs.minify(paginationContent.join(';'), {fromString: true}); | ||
if (program.dry) { | ||
@@ -30,5 +33,4 @@ console.log(minified.code); | ||
Object.keys(versions).forEach(function(v) { | ||
var releaseContent = []; | ||
var releaseContent = paginationContent.slice(0); | ||
var output = './release/pagination.' + v + '.min.js'; | ||
releaseContent.push(paginationContent); | ||
versions[v].forEach(function(m) { | ||
@@ -41,2 +43,3 @@ releaseContent.push(fs.readFileSync('./lib/' + m + '.js')); | ||
if (program.dry) { | ||
console.log(releaseContent.join(";")); | ||
console.log(minified.code); | ||
@@ -43,0 +46,0 @@ } else { |
var pkgs = ['item_paginator', 'search_paginator', 'template_paginator', 'template']; | ||
var pagination = require('./lib/pagination.js'); | ||
util = require('util'); | ||
var i, len; | ||
var util = require('util'); | ||
var i, len, pkg; | ||
for (i = 0, len = pkgs.length; i < len; i++) { | ||
var pkg = require('./lib/' + pkgs[i] + '.js'); | ||
pkg = require('./lib/' + pkgs[i] + '.js'); | ||
pkg.module(pagination, util); | ||
@@ -8,0 +8,0 @@ } |
@@ -1,44 +0,4 @@ | ||
(function(module) { | ||
(function(exports) { | ||
"use strict"; | ||
var util, factories = {}; | ||
/* Check if clientside or serverside */ | ||
if( typeof module === 'undefined') { | ||
window.pagination = {}; | ||
window.exports = {}; | ||
module = { | ||
exports : window.pagination | ||
}; | ||
util = { | ||
inherits : function(subc, superc) { | ||
if(!superc || !subc) { | ||
throw new Error("extend failed, please check that all dependencies are included."); | ||
} | ||
var F = function() {}; | ||
F.prototype = superc.prototype; | ||
subc.prototype = new F(); | ||
subc.prototype.constructor = subc; | ||
subc.superclass = superc.prototype; | ||
if(superc.prototype.constructor === Object.prototype.constructor) { | ||
superc.prototype.constructor = superc; | ||
} | ||
} | ||
}; | ||
module.exports.util = util; | ||
if(!Object.keys) { | ||
Object.keys = function(o) { | ||
var rt = [], p, hasOwnProperty = Object.prototype.hasOwnProperty; | ||
if(o !== Object(o)) { | ||
throw new TypeError('Object.keys called on a non-object'); | ||
} | ||
for(p in o) { | ||
if(hasOwnProperty.call(o, p)) { | ||
rt.push(p); | ||
} | ||
} | ||
return rt; | ||
}; | ||
} | ||
} else { | ||
util = require('util'); | ||
} | ||
var factories = {}; | ||
@@ -53,3 +13,3 @@ var translations = { | ||
var translationKeys = module.exports.translationKeys = Object.keys(translations); | ||
var translationKeys = exports.translationKeys = Object.keys(translations); | ||
@@ -84,3 +44,3 @@ var translationCache = { | ||
module.exports.Paginator = Paginator; | ||
exports.Paginator = Paginator; | ||
@@ -223,3 +183,3 @@ Paginator.prototype = { | ||
}; | ||
module.exports.registerFactory = function(type, factory) { | ||
exports.registerFactory = function(type, factory) { | ||
if (factories.hasOwnProperty(type)) { | ||
@@ -230,3 +190,3 @@ throw new Error(type + ' already exists'); | ||
}; | ||
module.exports.create = function(type, options) { | ||
exports.create = function(type, options) { | ||
if (factories.hasOwnProperty(type)) { | ||
@@ -238,2 +198,2 @@ return new factories[type](options); | ||
}; | ||
})(( typeof module !== 'undefined' && module.exports) ? module : undefined); | ||
})(exports); |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"scripts": { | ||
@@ -17,0 +17,0 @@ "test": "vows --spec tests/*" |
@@ -200,1 +200,5 @@ ## pagination | ||
The compiled function will be called with an object as argument. | ||
## Acknowledgements | ||
Template engine is taking mostly from https://github.com/vanng822/ejs which is a fork of https://github.com/visionmedia/ejs |
@@ -1,1 +0,1 @@ | ||
!function(t){"use strict";var e,r={};"undefined"==typeof t?(window.pagination={},window.exports={},t={exports:window.pagination},e={inherits:function(t,e){if(!e||!t)throw new Error("extend failed, please check that all dependencies are included.");var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor===Object.prototype.constructor&&(e.prototype.constructor=e)}},t.exports.util=e,Object.keys||(Object.keys=function(t){var e,r=[],n=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(e in t)n.call(t,e)&&r.push(e);return r})):e=require("util");var n={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},o=(t.exports.translationKeys=Object.keys(n),function(t){return n[t]}),a=function(t){var e,r,n;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:o,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},e=Object.keys(t),r=0,n=e.length;n>r;r++)this.set(e[r],t[e[r]]);this._result=null};t.exports.Paginator=a,a.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,e,r,n,o,a=this.options.totalResult,s=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,u=s%2===0?1:0,p={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:a,pageCount:null};if(0>=i)return p;if(r=Math.ceil(a/i),p.pageCount=r,2>r)return p.fromResult=1,p.toResult=a,p;for(l>r&&(l=r,p.current=l),o=Math.floor(s/2),t=l-o,e=l+o-u,1>t&&(t=1,e=t+s-1,e>r&&(e=r)),e>r&&(e=r,t=e-s+1,1>t&&(t=1)),n=t;e>=n;n++)p.range.push(n);return l>1&&(p.first=1,p.previous=l-1),r>l&&(p.last=r,p.next=l+1),p.fromResult=(l-1)*i+1,p.toResult=l===r?a:p.fromResult+i-1,p},set:function(t,e){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(e=parseInt(e,10),isNaN(e))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(e&&e.constructor&&e.call&&e.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":e=String(e)}this.options[t]=e,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.exports.registerFactory=function(t,e){if(r.hasOwnProperty(t))throw new Error(t+" already exists");r[t]=e},t.exports.create=function(t,e){if(r.hasOwnProperty(t))return new r[t](e);throw new Error("Paginator type"+t+" not found in register")}}("undefined"!=typeof module&&module.exports?module:void 0),exports.module=function(t){"use strict";var e={},r=function(t,e){var r,n,o,a,s,i,l,u,e=e||{},p=e.open||"<%",c=e.close||"%>",h=["var buf = [];","\nwith (paginationData) {","\n buf.push('"];for(o=0,s=t.length;s>o;++o)if(t.slice(o,p.length+o)===p){switch(o+=p.length,t.substr(o,1)){case"=":r="', escape(",n="), '",++o;break;case"-":r="', (",n="), '",++o;break;default:r="');",n="; buf.push('"}for(a=t.indexOf(c,o),i=t.substring(o,a),l=o,u=0;~(u=i.indexOf("\n",u));)u++;h.push(r,i,n),o+=a-l+c.length-1}else h.push("\\"===t.substr(o,1)?"\\\\":"'"===t.substr(o,1)?"\\'":"\r"===t.substr(o,1)?" ":"\n"===t.substr(o,1)?"\\n":t.substr(o,1));return h.push("');\n}\nreturn buf.join('');"),h.join("")},n=function(t){return String(t).replace(/&(?!\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},o=function(t,e){var o=new Function("paginationData",r(t,e));return function(t){return o.call(this,t,n)}},a=function(t,r){var n,r=r||{};if(r.cache){if(!r.id)throw new Error('"cache" option requires "id"');n=e[r.id]||(e[r.id]=o(t,r))}else n=o(t,r);return n};t.TemplateEngine={parse:r,compile:a}},exports.module(pagination,pagination.util),exports.module=function(t,e){"use strict";var r=t.TemplatePaginator=function(e){var r=e.template;if(!r)throw new Error("Template compile to function needed");r.constructor&&r.call&&r.apply||(r=t.TemplateEngine.compile(String(r),e)),t.Paginator.call(this,e),this.renderer=r};e.inherits(r,t.Paginator),r.prototype.render=function(){var e,r,n=this.getPaginationData();for(n.preparedPreLink=this.preparePreLink(n.prelink),n.translations={},e=0,r=t.translationKeys.length;r>e;e++)n.translations[t.translationKeys[e]]=this.options.translator(t.translationKeys[e]);return this.renderer(n)},t.registerFactory("template",r)},exports.module(pagination,pagination.util); | ||
window.pagination={},window.exports=pagination,window.pagination.util={inherits:function(t,e){if(!e||!t)throw new Error("extend failed, please check that all dependencies are included.");var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor===Object.prototype.constructor&&(e.prototype.constructor=e)}},Object.keys||(Object.keys=function(t){var e,r=[],n=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(e in t)n.call(t,e)&&r.push(e);return r}),function(t){"use strict";var e={},r={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},n=(t.translationKeys=Object.keys(r),function(t){return r[t]}),o=function(t){var e,r,o;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:n,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},e=Object.keys(t),r=0,o=e.length;o>r;r++)this.set(e[r],t[e[r]]);this._result=null};t.Paginator=o,o.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,e,r,n,o,a=this.options.totalResult,s=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,u=s%2===0?1:0,p={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:a,pageCount:null};if(0>=i)return p;if(r=Math.ceil(a/i),p.pageCount=r,2>r)return p.fromResult=1,p.toResult=a,p;for(l>r&&(l=r,p.current=l),o=Math.floor(s/2),t=l-o,e=l+o-u,1>t&&(t=1,e=t+s-1,e>r&&(e=r)),e>r&&(e=r,t=e-s+1,1>t&&(t=1)),n=t;e>=n;n++)p.range.push(n);return l>1&&(p.first=1,p.previous=l-1),r>l&&(p.last=r,p.next=l+1),p.fromResult=(l-1)*i+1,p.toResult=l===r?a:p.fromResult+i-1,p},set:function(t,e){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(e=parseInt(e,10),isNaN(e))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(e&&e.constructor&&e.call&&e.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":e=String(e)}this.options[t]=e,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.registerFactory=function(t,r){if(e.hasOwnProperty(t))throw new Error(t+" already exists");e[t]=r},t.create=function(t,r){if(e.hasOwnProperty(t))return new e[t](r);throw new Error("Paginator type"+t+" not found in register")}}(exports),exports.module=function(t){"use strict";var e={},r=function(t,e){var r,n,o,a,s,i,l,u,e=e||{},p=e.open||"<%",c=e.close||"%>",h=["var buf = [];","\nwith (paginationData) {","\n buf.push('"];for(o=0,s=t.length;s>o;++o)if(t.slice(o,p.length+o)===p){switch(o+=p.length,t.substr(o,1)){case"=":r="', escape(",n="), '",++o;break;case"-":r="', (",n="), '",++o;break;default:r="');",n="; buf.push('"}for(a=t.indexOf(c,o),i=t.substring(o,a),l=o,u=0;~(u=i.indexOf("\n",u));)u++;h.push(r,i,n),o+=a-l+c.length-1}else h.push("\\"===t.substr(o,1)?"\\\\":"'"===t.substr(o,1)?"\\'":"\r"===t.substr(o,1)?" ":"\n"===t.substr(o,1)?"\\n":t.substr(o,1));return h.push("');\n}\nreturn buf.join('');"),h.join("")},n=function(t){return String(t).replace(/&(?!\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},o=function(t,e){var o=new Function("paginationData",r(t,e));return function(t){return o.call(this,t,n)}},a=function(t,r){var n,r=r||{};if(r.cache){if(!r.id)throw new Error('"cache" option requires "id"');n=e[r.id]||(e[r.id]=o(t,r))}else n=o(t,r);return n};t.TemplateEngine={parse:r,compile:a}},exports.module(pagination,pagination.util),exports.module=function(t,e){"use strict";var r=t.TemplatePaginator=function(e){var r=e.template;if(!r)throw new Error("Template compile to function needed");r.constructor&&r.call&&r.apply||(r=t.TemplateEngine.compile(String(r),e)),t.Paginator.call(this,e),this.renderer=r};e.inherits(r,t.Paginator),r.prototype.render=function(){var e,r,n=this.getPaginationData();for(n.preparedPreLink=this.preparePreLink(n.prelink),n.translations={},e=0,r=t.translationKeys.length;r>e;e++)n.translations[t.translationKeys[e]]=this.options.translator(t.translationKeys[e]);return this.renderer(n)},t.registerFactory("template",r)},exports.module(pagination,pagination.util); |
@@ -1,1 +0,1 @@ | ||
!function(t){"use strict";var r,e={};"undefined"==typeof t?(window.pagination={},window.exports={},t={exports:window.pagination},r={inherits:function(t,r){if(!r||!t)throw new Error("extend failed, please check that all dependencies are included.");var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t,t.superclass=r.prototype,r.prototype.constructor===Object.prototype.constructor&&(r.prototype.constructor=r)}},t.exports.util=r,Object.keys||(Object.keys=function(t){var r,e=[],n=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(r in t)n.call(t,r)&&e.push(r);return e})):r=require("util");var n={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},a=(t.exports.translationKeys=Object.keys(n),function(t){return n[t]}),o=function(t){var r,e,n;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:a,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},r=Object.keys(t),e=0,n=r.length;n>e;e++)this.set(r[e],t[r[e]]);this._result=null};t.exports.Paginator=o,o.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,r,e,n,a,o=this.options.totalResult,s=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,p=s%2===0?1:0,u={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:o,pageCount:null};if(0>=i)return u;if(e=Math.ceil(o/i),u.pageCount=e,2>e)return u.fromResult=1,u.toResult=o,u;for(l>e&&(l=e,u.current=l),a=Math.floor(s/2),t=l-a,r=l+a-p,1>t&&(t=1,r=t+s-1,r>e&&(r=e)),r>e&&(r=e,t=r-s+1,1>t&&(t=1)),n=t;r>=n;n++)u.range.push(n);return l>1&&(u.first=1,u.previous=l-1),e>l&&(u.last=e,u.next=l+1),u.fromResult=(l-1)*i+1,u.toResult=l===e?o:u.fromResult+i-1,u},set:function(t,r){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(r=parseInt(r,10),isNaN(r))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(r&&r.constructor&&r.call&&r.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":r=String(r)}this.options[t]=r,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.exports.registerFactory=function(t,r){if(e.hasOwnProperty(t))throw new Error(t+" already exists");e[t]=r},t.exports.create=function(t,r){if(e.hasOwnProperty(t))return new e[t](r);throw new Error("Paginator type"+t+" not found in register")}}("undefined"!=typeof module&&module.exports?module:void 0),exports.module=function(t){"use strict";var r={},e=function(t,r){var e,n,a,o,s,i,l,p,r=r||{},u=r.open||"<%",c=r.close||"%>",h=["var buf = [];","\nwith (paginationData) {","\n buf.push('"];for(a=0,s=t.length;s>a;++a)if(t.slice(a,u.length+a)===u){switch(a+=u.length,t.substr(a,1)){case"=":e="', escape(",n="), '",++a;break;case"-":e="', (",n="), '",++a;break;default:e="');",n="; buf.push('"}for(o=t.indexOf(c,a),i=t.substring(a,o),l=a,p=0;~(p=i.indexOf("\n",p));)p++;h.push(e,i,n),a+=o-l+c.length-1}else h.push("\\"===t.substr(a,1)?"\\\\":"'"===t.substr(a,1)?"\\'":"\r"===t.substr(a,1)?" ":"\n"===t.substr(a,1)?"\\n":t.substr(a,1));return h.push("');\n}\nreturn buf.join('');"),h.join("")},n=function(t){return String(t).replace(/&(?!\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},a=function(t,r){var a=new Function("paginationData",e(t,r));return function(t){return a.call(this,t,n)}},o=function(t,e){var n,e=e||{};if(e.cache){if(!e.id)throw new Error('"cache" option requires "id"');n=r[e.id]||(r[e.id]=a(t,e))}else n=a(t,e);return n};t.TemplateEngine={parse:e,compile:o}},exports.module(pagination,pagination.util),exports.module=function(t,r){"use strict";var e=t.TemplatePaginator=function(r){var e=r.template;if(!e)throw new Error("Template compile to function needed");e.constructor&&e.call&&e.apply||(e=t.TemplateEngine.compile(String(e),r)),t.Paginator.call(this,r),this.renderer=e};r.inherits(e,t.Paginator),e.prototype.render=function(){var r,e,n=this.getPaginationData();for(n.preparedPreLink=this.preparePreLink(n.prelink),n.translations={},r=0,e=t.translationKeys.length;e>r;r++)n.translations[t.translationKeys[r]]=this.options.translator(t.translationKeys[r]);return this.renderer(n)},t.registerFactory("template",e)},exports.module(pagination,pagination.util),exports.module=function(t,r){"use strict";var e=function(r){t.Paginator.call(this,r)};t.SearchPaginator=e,r.inherits(e,t.Paginator),e.prototype.render=function(){var t,r,e,n,a=this.getPaginationData(),o='<div class="paginator">';if(a.pageCount<2)return o+="</div>";if(n=this.preparePreLink(a.prelink),a.previous&&(o+='<a href="'+n+a.previous+'" class="paginator-previous">'+this.options.translator("PREVIOUS")+"</a>"),a.range.length)for(t=0,r=a.range.length;r>t;t++)e="paginator-page",a.range[t]===a.current&&(e="paginator-current"),0===t?e+=" paginator-page-first":t===r-1&&(e+=" paginator-page-last"),o+='<a href="'+n+a.range[t]+'" class="'+e+'">'+a.range[t]+"</a>";return a.next&&(o+='<a href="'+n+a.next+'" class="paginator-next">'+this.options.translator("NEXT")+"</a>"),o+="</div>"},t.registerFactory("search",e)},exports.module(pagination,pagination.util),exports.module=function(t,r){"use strict";var e={CURRENT_PAGE_REPORT:{}},n=t.ItemPaginator=function(r){t.Paginator.call(this,r),this.set("pageLinks",1)};r.inherits(n,t.Paginator),n.prototype.renderCurrentPageReport=function(t,r,n){var a;return this.options.translationCache?(e.CURRENT_PAGE_REPORT.hasOwnProperty(this.options.translationCacheKey)||(a="return '"+this.options.translator("CURRENT_PAGE_REPORT").replace("'","'").replace("{FromResult}","' + fromResult + '").replace("{ToResult}","' + toResult + '").replace("{TotalResult}","' + totalResult + '")+"';",e.CURRENT_PAGE_REPORT[this.options.translationCacheKey]=new Function("fromResult, toResult, totalResult",a)),e.CURRENT_PAGE_REPORT[this.options.translationCacheKey](t,r,n)):this.options.translator("CURRENT_PAGE_REPORT").replace("{FromResult}",t).replace("{ToResult}",r).replace("{TotalResult}",n)},n.prototype.render=function(){var t=this.getPaginationData(),r=this.preparePreLink(t.prelink),e='<div class="paginator">';return e+='<span class="paginator-current-report">',e+=this.renderCurrentPageReport(t.fromResult,t.toResult,t.totalResult),e+="</span>",e+=t.first?'<a href="'+r+t.first+'" class="paginator-first">'+this.options.translator("FIRST")+"</a>":'<span class="paginator-first">'+this.options.translator("FIRST")+"</span>",e+=t.previous?'<a href="'+r+t.previous+'" class="paginator-previous">'+this.options.translator("PREVIOUS")+"</a>":'<span class="paginator-previous">'+this.options.translator("PREVIOUS")+"</span>",e+=t.next?'<a href="'+r+t.next+'" class="paginator-next">'+this.options.translator("NEXT")+"</a>":'<span class="paginator-next">'+this.options.translator("NEXT")+"</span>",e+=t.last?'<a href="'+r+t.last+'" class="paginator-last">'+this.options.translator("LAST")+"</a>":'<span class="paginator-last">'+this.options.translator("LAST")+"</span>",e+="</div>"},t.registerFactory("item",n)},exports.module(pagination,pagination.util); | ||
window.pagination={},window.exports=pagination,window.pagination.util={inherits:function(t,r){if(!r||!t)throw new Error("extend failed, please check that all dependencies are included.");var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t,t.superclass=r.prototype,r.prototype.constructor===Object.prototype.constructor&&(r.prototype.constructor=r)}},Object.keys||(Object.keys=function(t){var r,e=[],n=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(r in t)n.call(t,r)&&e.push(r);return e}),function(t){"use strict";var r={},e={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},n=(t.translationKeys=Object.keys(e),function(t){return e[t]}),a=function(t){var r,e,a;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:n,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},r=Object.keys(t),e=0,a=r.length;a>e;e++)this.set(r[e],t[r[e]]);this._result=null};t.Paginator=a,a.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,r,e,n,a,o=this.options.totalResult,s=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,p=s%2===0?1:0,u={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:o,pageCount:null};if(0>=i)return u;if(e=Math.ceil(o/i),u.pageCount=e,2>e)return u.fromResult=1,u.toResult=o,u;for(l>e&&(l=e,u.current=l),a=Math.floor(s/2),t=l-a,r=l+a-p,1>t&&(t=1,r=t+s-1,r>e&&(r=e)),r>e&&(r=e,t=r-s+1,1>t&&(t=1)),n=t;r>=n;n++)u.range.push(n);return l>1&&(u.first=1,u.previous=l-1),e>l&&(u.last=e,u.next=l+1),u.fromResult=(l-1)*i+1,u.toResult=l===e?o:u.fromResult+i-1,u},set:function(t,r){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(r=parseInt(r,10),isNaN(r))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(r&&r.constructor&&r.call&&r.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":r=String(r)}this.options[t]=r,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.registerFactory=function(t,e){if(r.hasOwnProperty(t))throw new Error(t+" already exists");r[t]=e},t.create=function(t,e){if(r.hasOwnProperty(t))return new r[t](e);throw new Error("Paginator type"+t+" not found in register")}}(exports),exports.module=function(t){"use strict";var r={},e=function(t,r){var e,n,a,o,s,i,l,p,r=r||{},u=r.open||"<%",c=r.close||"%>",h=["var buf = [];","\nwith (paginationData) {","\n buf.push('"];for(a=0,s=t.length;s>a;++a)if(t.slice(a,u.length+a)===u){switch(a+=u.length,t.substr(a,1)){case"=":e="', escape(",n="), '",++a;break;case"-":e="', (",n="), '",++a;break;default:e="');",n="; buf.push('"}for(o=t.indexOf(c,a),i=t.substring(a,o),l=a,p=0;~(p=i.indexOf("\n",p));)p++;h.push(e,i,n),a+=o-l+c.length-1}else h.push("\\"===t.substr(a,1)?"\\\\":"'"===t.substr(a,1)?"\\'":"\r"===t.substr(a,1)?" ":"\n"===t.substr(a,1)?"\\n":t.substr(a,1));return h.push("');\n}\nreturn buf.join('');"),h.join("")},n=function(t){return String(t).replace(/&(?!\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},a=function(t,r){var a=new Function("paginationData",e(t,r));return function(t){return a.call(this,t,n)}},o=function(t,e){var n,e=e||{};if(e.cache){if(!e.id)throw new Error('"cache" option requires "id"');n=r[e.id]||(r[e.id]=a(t,e))}else n=a(t,e);return n};t.TemplateEngine={parse:e,compile:o}},exports.module(pagination,pagination.util),exports.module=function(t,r){"use strict";var e=t.TemplatePaginator=function(r){var e=r.template;if(!e)throw new Error("Template compile to function needed");e.constructor&&e.call&&e.apply||(e=t.TemplateEngine.compile(String(e),r)),t.Paginator.call(this,r),this.renderer=e};r.inherits(e,t.Paginator),e.prototype.render=function(){var r,e,n=this.getPaginationData();for(n.preparedPreLink=this.preparePreLink(n.prelink),n.translations={},r=0,e=t.translationKeys.length;e>r;r++)n.translations[t.translationKeys[r]]=this.options.translator(t.translationKeys[r]);return this.renderer(n)},t.registerFactory("template",e)},exports.module(pagination,pagination.util),exports.module=function(t,r){"use strict";var e=function(r){t.Paginator.call(this,r)};t.SearchPaginator=e,r.inherits(e,t.Paginator),e.prototype.render=function(){var t,r,e,n,a=this.getPaginationData(),o='<div class="paginator">';if(a.pageCount<2)return o+="</div>";if(n=this.preparePreLink(a.prelink),a.previous&&(o+='<a href="'+n+a.previous+'" class="paginator-previous">'+this.options.translator("PREVIOUS")+"</a>"),a.range.length)for(t=0,r=a.range.length;r>t;t++)e="paginator-page",a.range[t]===a.current&&(e="paginator-current"),0===t?e+=" paginator-page-first":t===r-1&&(e+=" paginator-page-last"),o+='<a href="'+n+a.range[t]+'" class="'+e+'">'+a.range[t]+"</a>";return a.next&&(o+='<a href="'+n+a.next+'" class="paginator-next">'+this.options.translator("NEXT")+"</a>"),o+="</div>"},t.registerFactory("search",e)},exports.module(pagination,pagination.util),exports.module=function(t,r){"use strict";var e={CURRENT_PAGE_REPORT:{}},n=t.ItemPaginator=function(r){t.Paginator.call(this,r),this.set("pageLinks",1)};r.inherits(n,t.Paginator),n.prototype.renderCurrentPageReport=function(t,r,n){var a;return this.options.translationCache?(e.CURRENT_PAGE_REPORT.hasOwnProperty(this.options.translationCacheKey)||(a="return '"+this.options.translator("CURRENT_PAGE_REPORT").replace("'","'").replace("{FromResult}","' + fromResult + '").replace("{ToResult}","' + toResult + '").replace("{TotalResult}","' + totalResult + '")+"';",e.CURRENT_PAGE_REPORT[this.options.translationCacheKey]=new Function("fromResult, toResult, totalResult",a)),e.CURRENT_PAGE_REPORT[this.options.translationCacheKey](t,r,n)):this.options.translator("CURRENT_PAGE_REPORT").replace("{FromResult}",t).replace("{ToResult}",r).replace("{TotalResult}",n)},n.prototype.render=function(){var t=this.getPaginationData(),r=this.preparePreLink(t.prelink),e='<div class="paginator">';return e+='<span class="paginator-current-report">',e+=this.renderCurrentPageReport(t.fromResult,t.toResult,t.totalResult),e+="</span>",e+=t.first?'<a href="'+r+t.first+'" class="paginator-first">'+this.options.translator("FIRST")+"</a>":'<span class="paginator-first">'+this.options.translator("FIRST")+"</span>",e+=t.previous?'<a href="'+r+t.previous+'" class="paginator-previous">'+this.options.translator("PREVIOUS")+"</a>":'<span class="paginator-previous">'+this.options.translator("PREVIOUS")+"</span>",e+=t.next?'<a href="'+r+t.next+'" class="paginator-next">'+this.options.translator("NEXT")+"</a>":'<span class="paginator-next">'+this.options.translator("NEXT")+"</span>",e+=t.last?'<a href="'+r+t.last+'" class="paginator-last">'+this.options.translator("LAST")+"</a>":'<span class="paginator-last">'+this.options.translator("LAST")+"</span>",e+="</div>"},t.registerFactory("item",n)},exports.module(pagination,pagination.util); |
@@ -1,1 +0,1 @@ | ||
!function(t){"use strict";var e,r={};"undefined"==typeof t?(window.pagination={},window.exports={},t={exports:window.pagination},e={inherits:function(t,e){if(!e||!t)throw new Error("extend failed, please check that all dependencies are included.");var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor===Object.prototype.constructor&&(e.prototype.constructor=e)}},t.exports.util=e,Object.keys||(Object.keys=function(t){var e,r=[],o=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(e in t)o.call(t,e)&&r.push(e);return r})):e=require("util");var o={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},s=(t.exports.translationKeys=Object.keys(o),function(t){return o[t]}),a=function(t){var e,r,o;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:s,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},e=Object.keys(t),r=0,o=e.length;o>r;r++)this.set(e[r],t[e[r]]);this._result=null};t.exports.Paginator=a,a.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,e,r,o,s,a=this.options.totalResult,n=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,p=n%2===0?1:0,u={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:a,pageCount:null};if(0>=i)return u;if(r=Math.ceil(a/i),u.pageCount=r,2>r)return u.fromResult=1,u.toResult=a,u;for(l>r&&(l=r,u.current=l),s=Math.floor(n/2),t=l-s,e=l+s-p,1>t&&(t=1,e=t+n-1,e>r&&(e=r)),e>r&&(e=r,t=e-n+1,1>t&&(t=1)),o=t;e>=o;o++)u.range.push(o);return l>1&&(u.first=1,u.previous=l-1),r>l&&(u.last=r,u.next=l+1),u.fromResult=(l-1)*i+1,u.toResult=l===r?a:u.fromResult+i-1,u},set:function(t,e){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(e=parseInt(e,10),isNaN(e))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(e&&e.constructor&&e.call&&e.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":e=String(e)}this.options[t]=e,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.exports.registerFactory=function(t,e){if(r.hasOwnProperty(t))throw new Error(t+" already exists");r[t]=e},t.exports.create=function(t,e){if(r.hasOwnProperty(t))return new r[t](e);throw new Error("Paginator type"+t+" not found in register")}}("undefined"!=typeof module&&module.exports?module:void 0),exports.module=function(t,e){"use strict";var r={CURRENT_PAGE_REPORT:{}},o=t.ItemPaginator=function(e){t.Paginator.call(this,e),this.set("pageLinks",1)};e.inherits(o,t.Paginator),o.prototype.renderCurrentPageReport=function(t,e,o){var s;return this.options.translationCache?(r.CURRENT_PAGE_REPORT.hasOwnProperty(this.options.translationCacheKey)||(s="return '"+this.options.translator("CURRENT_PAGE_REPORT").replace("'","'").replace("{FromResult}","' + fromResult + '").replace("{ToResult}","' + toResult + '").replace("{TotalResult}","' + totalResult + '")+"';",r.CURRENT_PAGE_REPORT[this.options.translationCacheKey]=new Function("fromResult, toResult, totalResult",s)),r.CURRENT_PAGE_REPORT[this.options.translationCacheKey](t,e,o)):this.options.translator("CURRENT_PAGE_REPORT").replace("{FromResult}",t).replace("{ToResult}",e).replace("{TotalResult}",o)},o.prototype.render=function(){var t=this.getPaginationData(),e=this.preparePreLink(t.prelink),r='<div class="paginator">';return r+='<span class="paginator-current-report">',r+=this.renderCurrentPageReport(t.fromResult,t.toResult,t.totalResult),r+="</span>",r+=t.first?'<a href="'+e+t.first+'" class="paginator-first">'+this.options.translator("FIRST")+"</a>":'<span class="paginator-first">'+this.options.translator("FIRST")+"</span>",r+=t.previous?'<a href="'+e+t.previous+'" class="paginator-previous">'+this.options.translator("PREVIOUS")+"</a>":'<span class="paginator-previous">'+this.options.translator("PREVIOUS")+"</span>",r+=t.next?'<a href="'+e+t.next+'" class="paginator-next">'+this.options.translator("NEXT")+"</a>":'<span class="paginator-next">'+this.options.translator("NEXT")+"</span>",r+=t.last?'<a href="'+e+t.last+'" class="paginator-last">'+this.options.translator("LAST")+"</a>":'<span class="paginator-last">'+this.options.translator("LAST")+"</span>",r+="</div>"},t.registerFactory("item",o)},exports.module(pagination,pagination.util); | ||
window.pagination={},window.exports=pagination,window.pagination.util={inherits:function(t,r){if(!r||!t)throw new Error("extend failed, please check that all dependencies are included.");var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t,t.superclass=r.prototype,r.prototype.constructor===Object.prototype.constructor&&(r.prototype.constructor=r)}},Object.keys||(Object.keys=function(t){var r,e=[],a=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(r in t)a.call(t,r)&&e.push(r);return e}),function(t){"use strict";var r={},e={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},a=(t.translationKeys=Object.keys(e),function(t){return e[t]}),s=function(t){var r,e,s;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:a,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},r=Object.keys(t),e=0,s=r.length;s>e;e++)this.set(r[e],t[r[e]]);this._result=null};t.Paginator=s,s.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,r,e,a,s,o=this.options.totalResult,n=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,p=n%2===0?1:0,u={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:o,pageCount:null};if(0>=i)return u;if(e=Math.ceil(o/i),u.pageCount=e,2>e)return u.fromResult=1,u.toResult=o,u;for(l>e&&(l=e,u.current=l),s=Math.floor(n/2),t=l-s,r=l+s-p,1>t&&(t=1,r=t+n-1,r>e&&(r=e)),r>e&&(r=e,t=r-n+1,1>t&&(t=1)),a=t;r>=a;a++)u.range.push(a);return l>1&&(u.first=1,u.previous=l-1),e>l&&(u.last=e,u.next=l+1),u.fromResult=(l-1)*i+1,u.toResult=l===e?o:u.fromResult+i-1,u},set:function(t,r){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(r=parseInt(r,10),isNaN(r))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(r&&r.constructor&&r.call&&r.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":r=String(r)}this.options[t]=r,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.registerFactory=function(t,e){if(r.hasOwnProperty(t))throw new Error(t+" already exists");r[t]=e},t.create=function(t,e){if(r.hasOwnProperty(t))return new r[t](e);throw new Error("Paginator type"+t+" not found in register")}}(exports),exports.module=function(t,r){"use strict";var e={CURRENT_PAGE_REPORT:{}},a=t.ItemPaginator=function(r){t.Paginator.call(this,r),this.set("pageLinks",1)};r.inherits(a,t.Paginator),a.prototype.renderCurrentPageReport=function(t,r,a){var s;return this.options.translationCache?(e.CURRENT_PAGE_REPORT.hasOwnProperty(this.options.translationCacheKey)||(s="return '"+this.options.translator("CURRENT_PAGE_REPORT").replace("'","'").replace("{FromResult}","' + fromResult + '").replace("{ToResult}","' + toResult + '").replace("{TotalResult}","' + totalResult + '")+"';",e.CURRENT_PAGE_REPORT[this.options.translationCacheKey]=new Function("fromResult, toResult, totalResult",s)),e.CURRENT_PAGE_REPORT[this.options.translationCacheKey](t,r,a)):this.options.translator("CURRENT_PAGE_REPORT").replace("{FromResult}",t).replace("{ToResult}",r).replace("{TotalResult}",a)},a.prototype.render=function(){var t=this.getPaginationData(),r=this.preparePreLink(t.prelink),e='<div class="paginator">';return e+='<span class="paginator-current-report">',e+=this.renderCurrentPageReport(t.fromResult,t.toResult,t.totalResult),e+="</span>",e+=t.first?'<a href="'+r+t.first+'" class="paginator-first">'+this.options.translator("FIRST")+"</a>":'<span class="paginator-first">'+this.options.translator("FIRST")+"</span>",e+=t.previous?'<a href="'+r+t.previous+'" class="paginator-previous">'+this.options.translator("PREVIOUS")+"</a>":'<span class="paginator-previous">'+this.options.translator("PREVIOUS")+"</span>",e+=t.next?'<a href="'+r+t.next+'" class="paginator-next">'+this.options.translator("NEXT")+"</a>":'<span class="paginator-next">'+this.options.translator("NEXT")+"</span>",e+=t.last?'<a href="'+r+t.last+'" class="paginator-last">'+this.options.translator("LAST")+"</a>":'<span class="paginator-last">'+this.options.translator("LAST")+"</span>",e+="</div>"},t.registerFactory("item",a)},exports.module(pagination,pagination.util); |
@@ -1,1 +0,1 @@ | ||
!function(t){"use strict";var r,e={};"undefined"==typeof t?(window.pagination={},window.exports={},t={exports:window.pagination},r={inherits:function(t,r){if(!r||!t)throw new Error("extend failed, please check that all dependencies are included.");var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t,t.superclass=r.prototype,r.prototype.constructor===Object.prototype.constructor&&(r.prototype.constructor=r)}},t.exports.util=r,Object.keys||(Object.keys=function(t){var r,e=[],a=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(r in t)a.call(t,r)&&e.push(r);return e})):r=require("util");var a={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},n=(t.exports.translationKeys=Object.keys(a),function(t){return a[t]}),o=function(t){var r,e,a;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:n,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},r=Object.keys(t),e=0,a=r.length;a>e;e++)this.set(r[e],t[r[e]]);this._result=null};t.exports.Paginator=o,o.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,r,e,a,n,o=this.options.totalResult,s=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,p=s%2===0?1:0,u={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:o,pageCount:null};if(0>=i)return u;if(e=Math.ceil(o/i),u.pageCount=e,2>e)return u.fromResult=1,u.toResult=o,u;for(l>e&&(l=e,u.current=l),n=Math.floor(s/2),t=l-n,r=l+n-p,1>t&&(t=1,r=t+s-1,r>e&&(r=e)),r>e&&(r=e,t=r-s+1,1>t&&(t=1)),a=t;r>=a;a++)u.range.push(a);return l>1&&(u.first=1,u.previous=l-1),e>l&&(u.last=e,u.next=l+1),u.fromResult=(l-1)*i+1,u.toResult=l===e?o:u.fromResult+i-1,u},set:function(t,r){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(r=parseInt(r,10),isNaN(r))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(r&&r.constructor&&r.call&&r.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":r=String(r)}this.options[t]=r,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.exports.registerFactory=function(t,r){if(e.hasOwnProperty(t))throw new Error(t+" already exists");e[t]=r},t.exports.create=function(t,r){if(e.hasOwnProperty(t))return new e[t](r);throw new Error("Paginator type"+t+" not found in register")}}("undefined"!=typeof module&&module.exports?module:void 0),exports.module=function(t,r){"use strict";var e={CURRENT_PAGE_REPORT:{}},a=t.ItemPaginator=function(r){t.Paginator.call(this,r),this.set("pageLinks",1)};r.inherits(a,t.Paginator),a.prototype.renderCurrentPageReport=function(t,r,a){var n;return this.options.translationCache?(e.CURRENT_PAGE_REPORT.hasOwnProperty(this.options.translationCacheKey)||(n="return '"+this.options.translator("CURRENT_PAGE_REPORT").replace("'","'").replace("{FromResult}","' + fromResult + '").replace("{ToResult}","' + toResult + '").replace("{TotalResult}","' + totalResult + '")+"';",e.CURRENT_PAGE_REPORT[this.options.translationCacheKey]=new Function("fromResult, toResult, totalResult",n)),e.CURRENT_PAGE_REPORT[this.options.translationCacheKey](t,r,a)):this.options.translator("CURRENT_PAGE_REPORT").replace("{FromResult}",t).replace("{ToResult}",r).replace("{TotalResult}",a)},a.prototype.render=function(){var t=this.getPaginationData(),r=this.preparePreLink(t.prelink),e='<div class="paginator">';return e+='<span class="paginator-current-report">',e+=this.renderCurrentPageReport(t.fromResult,t.toResult,t.totalResult),e+="</span>",e+=t.first?'<a href="'+r+t.first+'" class="paginator-first">'+this.options.translator("FIRST")+"</a>":'<span class="paginator-first">'+this.options.translator("FIRST")+"</span>",e+=t.previous?'<a href="'+r+t.previous+'" class="paginator-previous">'+this.options.translator("PREVIOUS")+"</a>":'<span class="paginator-previous">'+this.options.translator("PREVIOUS")+"</span>",e+=t.next?'<a href="'+r+t.next+'" class="paginator-next">'+this.options.translator("NEXT")+"</a>":'<span class="paginator-next">'+this.options.translator("NEXT")+"</span>",e+=t.last?'<a href="'+r+t.last+'" class="paginator-last">'+this.options.translator("LAST")+"</a>":'<span class="paginator-last">'+this.options.translator("LAST")+"</span>",e+="</div>"},t.registerFactory("item",a)},exports.module(pagination,pagination.util),exports.module=function(t,r){"use strict";var e=function(r){t.Paginator.call(this,r)};t.SearchPaginator=e,r.inherits(e,t.Paginator),e.prototype.render=function(){var t,r,e,a,n=this.getPaginationData(),o='<div class="paginator">';if(n.pageCount<2)return o+="</div>";if(a=this.preparePreLink(n.prelink),n.previous&&(o+='<a href="'+a+n.previous+'" class="paginator-previous">'+this.options.translator("PREVIOUS")+"</a>"),n.range.length)for(t=0,r=n.range.length;r>t;t++)e="paginator-page",n.range[t]===n.current&&(e="paginator-current"),0===t?e+=" paginator-page-first":t===r-1&&(e+=" paginator-page-last"),o+='<a href="'+a+n.range[t]+'" class="'+e+'">'+n.range[t]+"</a>";return n.next&&(o+='<a href="'+a+n.next+'" class="paginator-next">'+this.options.translator("NEXT")+"</a>"),o+="</div>"},t.registerFactory("search",e)},exports.module(pagination,pagination.util); | ||
window.pagination={},window.exports=pagination,window.pagination.util={inherits:function(t,r){if(!r||!t)throw new Error("extend failed, please check that all dependencies are included.");var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t,t.superclass=r.prototype,r.prototype.constructor===Object.prototype.constructor&&(r.prototype.constructor=r)}},Object.keys||(Object.keys=function(t){var r,e=[],a=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(r in t)a.call(t,r)&&e.push(r);return e}),function(t){"use strict";var r={},e={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},a=(t.translationKeys=Object.keys(e),function(t){return e[t]}),n=function(t){var r,e,n;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:a,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},r=Object.keys(t),e=0,n=r.length;n>e;e++)this.set(r[e],t[r[e]]);this._result=null};t.Paginator=n,n.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,r,e,a,n,o=this.options.totalResult,s=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,p=s%2===0?1:0,u={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:o,pageCount:null};if(0>=i)return u;if(e=Math.ceil(o/i),u.pageCount=e,2>e)return u.fromResult=1,u.toResult=o,u;for(l>e&&(l=e,u.current=l),n=Math.floor(s/2),t=l-n,r=l+n-p,1>t&&(t=1,r=t+s-1,r>e&&(r=e)),r>e&&(r=e,t=r-s+1,1>t&&(t=1)),a=t;r>=a;a++)u.range.push(a);return l>1&&(u.first=1,u.previous=l-1),e>l&&(u.last=e,u.next=l+1),u.fromResult=(l-1)*i+1,u.toResult=l===e?o:u.fromResult+i-1,u},set:function(t,r){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(r=parseInt(r,10),isNaN(r))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(r&&r.constructor&&r.call&&r.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":r=String(r)}this.options[t]=r,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.registerFactory=function(t,e){if(r.hasOwnProperty(t))throw new Error(t+" already exists");r[t]=e},t.create=function(t,e){if(r.hasOwnProperty(t))return new r[t](e);throw new Error("Paginator type"+t+" not found in register")}}(exports),exports.module=function(t,r){"use strict";var e={CURRENT_PAGE_REPORT:{}},a=t.ItemPaginator=function(r){t.Paginator.call(this,r),this.set("pageLinks",1)};r.inherits(a,t.Paginator),a.prototype.renderCurrentPageReport=function(t,r,a){var n;return this.options.translationCache?(e.CURRENT_PAGE_REPORT.hasOwnProperty(this.options.translationCacheKey)||(n="return '"+this.options.translator("CURRENT_PAGE_REPORT").replace("'","'").replace("{FromResult}","' + fromResult + '").replace("{ToResult}","' + toResult + '").replace("{TotalResult}","' + totalResult + '")+"';",e.CURRENT_PAGE_REPORT[this.options.translationCacheKey]=new Function("fromResult, toResult, totalResult",n)),e.CURRENT_PAGE_REPORT[this.options.translationCacheKey](t,r,a)):this.options.translator("CURRENT_PAGE_REPORT").replace("{FromResult}",t).replace("{ToResult}",r).replace("{TotalResult}",a)},a.prototype.render=function(){var t=this.getPaginationData(),r=this.preparePreLink(t.prelink),e='<div class="paginator">';return e+='<span class="paginator-current-report">',e+=this.renderCurrentPageReport(t.fromResult,t.toResult,t.totalResult),e+="</span>",e+=t.first?'<a href="'+r+t.first+'" class="paginator-first">'+this.options.translator("FIRST")+"</a>":'<span class="paginator-first">'+this.options.translator("FIRST")+"</span>",e+=t.previous?'<a href="'+r+t.previous+'" class="paginator-previous">'+this.options.translator("PREVIOUS")+"</a>":'<span class="paginator-previous">'+this.options.translator("PREVIOUS")+"</span>",e+=t.next?'<a href="'+r+t.next+'" class="paginator-next">'+this.options.translator("NEXT")+"</a>":'<span class="paginator-next">'+this.options.translator("NEXT")+"</span>",e+=t.last?'<a href="'+r+t.last+'" class="paginator-last">'+this.options.translator("LAST")+"</a>":'<span class="paginator-last">'+this.options.translator("LAST")+"</span>",e+="</div>"},t.registerFactory("item",a)},exports.module(pagination,pagination.util),exports.module=function(t,r){"use strict";var e=function(r){t.Paginator.call(this,r)};t.SearchPaginator=e,r.inherits(e,t.Paginator),e.prototype.render=function(){var t,r,e,a,n=this.getPaginationData(),o='<div class="paginator">';if(n.pageCount<2)return o+="</div>";if(a=this.preparePreLink(n.prelink),n.previous&&(o+='<a href="'+a+n.previous+'" class="paginator-previous">'+this.options.translator("PREVIOUS")+"</a>"),n.range.length)for(t=0,r=n.range.length;r>t;t++)e="paginator-page",n.range[t]===n.current&&(e="paginator-current"),0===t?e+=" paginator-page-first":t===r-1&&(e+=" paginator-page-last"),o+='<a href="'+a+n.range[t]+'" class="'+e+'">'+n.range[t]+"</a>";return n.next&&(o+='<a href="'+a+n.next+'" class="paginator-next">'+this.options.translator("NEXT")+"</a>"),o+="</div>"},t.registerFactory("search",e)},exports.module(pagination,pagination.util); |
@@ -1,1 +0,1 @@ | ||
!function(t){"use strict";var e,r={};"undefined"==typeof t?(window.pagination={},window.exports={},t={exports:window.pagination},e={inherits:function(t,e){if(!e||!t)throw new Error("extend failed, please check that all dependencies are included.");var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor===Object.prototype.constructor&&(e.prototype.constructor=e)}},t.exports.util=e,Object.keys||(Object.keys=function(t){var e,r=[],o=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(e in t)o.call(t,e)&&r.push(e);return r})):e=require("util");var o={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},n=(t.exports.translationKeys=Object.keys(o),function(t){return o[t]}),s=function(t){var e,r,o;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:n,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},e=Object.keys(t),r=0,o=e.length;o>r;r++)this.set(e[r],t[e[r]]);this._result=null};t.exports.Paginator=s,s.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,e,r,o,n,s=this.options.totalResult,a=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,u=a%2===0?1:0,p={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:s,pageCount:null};if(0>=i)return p;if(r=Math.ceil(s/i),p.pageCount=r,2>r)return p.fromResult=1,p.toResult=s,p;for(l>r&&(l=r,p.current=l),n=Math.floor(a/2),t=l-n,e=l+n-u,1>t&&(t=1,e=t+a-1,e>r&&(e=r)),e>r&&(e=r,t=e-a+1,1>t&&(t=1)),o=t;e>=o;o++)p.range.push(o);return l>1&&(p.first=1,p.previous=l-1),r>l&&(p.last=r,p.next=l+1),p.fromResult=(l-1)*i+1,p.toResult=l===r?s:p.fromResult+i-1,p},set:function(t,e){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(e=parseInt(e,10),isNaN(e))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(e&&e.constructor&&e.call&&e.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":e=String(e)}this.options[t]=e,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.exports.registerFactory=function(t,e){if(r.hasOwnProperty(t))throw new Error(t+" already exists");r[t]=e},t.exports.create=function(t,e){if(r.hasOwnProperty(t))return new r[t](e);throw new Error("Paginator type"+t+" not found in register")}}("undefined"!=typeof module&&module.exports?module:void 0); | ||
window.pagination={},window.exports=pagination,window.pagination.util={inherits:function(t,e){if(!e||!t)throw new Error("extend failed, please check that all dependencies are included.");var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor===Object.prototype.constructor&&(e.prototype.constructor=e)}},Object.keys||(Object.keys=function(t){var e,r=[],n=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(e in t)n.call(t,e)&&r.push(e);return r}),function(t){"use strict";var e={},r={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},n=(t.translationKeys=Object.keys(r),function(t){return r[t]}),o=function(t){var e,r,o;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:n,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},e=Object.keys(t),r=0,o=e.length;o>r;r++)this.set(e[r],t[e[r]]);this._result=null};t.Paginator=o,o.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,e,r,n,o,s=this.options.totalResult,a=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,u=a%2===0?1:0,p={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:s,pageCount:null};if(0>=i)return p;if(r=Math.ceil(s/i),p.pageCount=r,2>r)return p.fromResult=1,p.toResult=s,p;for(l>r&&(l=r,p.current=l),o=Math.floor(a/2),t=l-o,e=l+o-u,1>t&&(t=1,e=t+a-1,e>r&&(e=r)),e>r&&(e=r,t=e-a+1,1>t&&(t=1)),n=t;e>=n;n++)p.range.push(n);return l>1&&(p.first=1,p.previous=l-1),r>l&&(p.last=r,p.next=l+1),p.fromResult=(l-1)*i+1,p.toResult=l===r?s:p.fromResult+i-1,p},set:function(t,e){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(e=parseInt(e,10),isNaN(e))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(e&&e.constructor&&e.call&&e.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":e=String(e)}this.options[t]=e,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.registerFactory=function(t,r){if(e.hasOwnProperty(t))throw new Error(t+" already exists");e[t]=r},t.create=function(t,r){if(e.hasOwnProperty(t))return new e[t](r);throw new Error("Paginator type"+t+" not found in register")}}(exports); |
@@ -1,1 +0,1 @@ | ||
!function(t){"use strict";var e,r={};"undefined"==typeof t?(window.pagination={},window.exports={},t={exports:window.pagination},e={inherits:function(t,e){if(!e||!t)throw new Error("extend failed, please check that all dependencies are included.");var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor===Object.prototype.constructor&&(e.prototype.constructor=e)}},t.exports.util=e,Object.keys||(Object.keys=function(t){var e,r=[],n=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(e in t)n.call(t,e)&&r.push(e);return r})):e=require("util");var n={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},o=(t.exports.translationKeys=Object.keys(n),function(t){return n[t]}),a=function(t){var e,r,n;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:o,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},e=Object.keys(t),r=0,n=e.length;n>r;r++)this.set(e[r],t[e[r]]);this._result=null};t.exports.Paginator=a,a.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,e,r,n,o,a=this.options.totalResult,s=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,p=s%2===0?1:0,u={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:a,pageCount:null};if(0>=i)return u;if(r=Math.ceil(a/i),u.pageCount=r,2>r)return u.fromResult=1,u.toResult=a,u;for(l>r&&(l=r,u.current=l),o=Math.floor(s/2),t=l-o,e=l+o-p,1>t&&(t=1,e=t+s-1,e>r&&(e=r)),e>r&&(e=r,t=e-s+1,1>t&&(t=1)),n=t;e>=n;n++)u.range.push(n);return l>1&&(u.first=1,u.previous=l-1),r>l&&(u.last=r,u.next=l+1),u.fromResult=(l-1)*i+1,u.toResult=l===r?a:u.fromResult+i-1,u},set:function(t,e){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(e=parseInt(e,10),isNaN(e))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(e&&e.constructor&&e.call&&e.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":e=String(e)}this.options[t]=e,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.exports.registerFactory=function(t,e){if(r.hasOwnProperty(t))throw new Error(t+" already exists");r[t]=e},t.exports.create=function(t,e){if(r.hasOwnProperty(t))return new r[t](e);throw new Error("Paginator type"+t+" not found in register")}}("undefined"!=typeof module&&module.exports?module:void 0),exports.module=function(t,e){"use strict";var r=function(e){t.Paginator.call(this,e)};t.SearchPaginator=r,e.inherits(r,t.Paginator),r.prototype.render=function(){var t,e,r,n,o=this.getPaginationData(),a='<div class="paginator">';if(o.pageCount<2)return a+="</div>";if(n=this.preparePreLink(o.prelink),o.previous&&(a+='<a href="'+n+o.previous+'" class="paginator-previous">'+this.options.translator("PREVIOUS")+"</a>"),o.range.length)for(t=0,e=o.range.length;e>t;t++)r="paginator-page",o.range[t]===o.current&&(r="paginator-current"),0===t?r+=" paginator-page-first":t===e-1&&(r+=" paginator-page-last"),a+='<a href="'+n+o.range[t]+'" class="'+r+'">'+o.range[t]+"</a>";return o.next&&(a+='<a href="'+n+o.next+'" class="paginator-next">'+this.options.translator("NEXT")+"</a>"),a+="</div>"},t.registerFactory("search",r)},exports.module(pagination,pagination.util); | ||
window.pagination={},window.exports=pagination,window.pagination.util={inherits:function(t,r){if(!r||!t)throw new Error("extend failed, please check that all dependencies are included.");var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t,t.superclass=r.prototype,r.prototype.constructor===Object.prototype.constructor&&(r.prototype.constructor=r)}},Object.keys||(Object.keys=function(t){var r,e=[],n=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(r in t)n.call(t,r)&&e.push(r);return e}),function(t){"use strict";var r={},e={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},n=(t.translationKeys=Object.keys(e),function(t){return e[t]}),a=function(t){var r,e,a;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:n,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},r=Object.keys(t),e=0,a=r.length;a>e;e++)this.set(r[e],t[r[e]]);this._result=null};t.Paginator=a,a.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,r,e,n,a,o=this.options.totalResult,s=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,p=s%2===0?1:0,u={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:o,pageCount:null};if(0>=i)return u;if(e=Math.ceil(o/i),u.pageCount=e,2>e)return u.fromResult=1,u.toResult=o,u;for(l>e&&(l=e,u.current=l),a=Math.floor(s/2),t=l-a,r=l+a-p,1>t&&(t=1,r=t+s-1,r>e&&(r=e)),r>e&&(r=e,t=r-s+1,1>t&&(t=1)),n=t;r>=n;n++)u.range.push(n);return l>1&&(u.first=1,u.previous=l-1),e>l&&(u.last=e,u.next=l+1),u.fromResult=(l-1)*i+1,u.toResult=l===e?o:u.fromResult+i-1,u},set:function(t,r){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(r=parseInt(r,10),isNaN(r))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(r&&r.constructor&&r.call&&r.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":r=String(r)}this.options[t]=r,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.registerFactory=function(t,e){if(r.hasOwnProperty(t))throw new Error(t+" already exists");r[t]=e},t.create=function(t,e){if(r.hasOwnProperty(t))return new r[t](e);throw new Error("Paginator type"+t+" not found in register")}}(exports),exports.module=function(t,r){"use strict";var e=function(r){t.Paginator.call(this,r)};t.SearchPaginator=e,r.inherits(e,t.Paginator),e.prototype.render=function(){var t,r,e,n,a=this.getPaginationData(),o='<div class="paginator">';if(a.pageCount<2)return o+="</div>";if(n=this.preparePreLink(a.prelink),a.previous&&(o+='<a href="'+n+a.previous+'" class="paginator-previous">'+this.options.translator("PREVIOUS")+"</a>"),a.range.length)for(t=0,r=a.range.length;r>t;t++)e="paginator-page",a.range[t]===a.current&&(e="paginator-current"),0===t?e+=" paginator-page-first":t===r-1&&(e+=" paginator-page-last"),o+='<a href="'+n+a.range[t]+'" class="'+e+'">'+a.range[t]+"</a>";return a.next&&(o+='<a href="'+n+a.next+'" class="paginator-next">'+this.options.translator("NEXT")+"</a>"),o+="</div>"},t.registerFactory("search",e)},exports.module(pagination,pagination.util); |
@@ -1,1 +0,1 @@ | ||
!function(t){"use strict";var e,r={};"undefined"==typeof t?(window.pagination={},window.exports={},t={exports:window.pagination},e={inherits:function(t,e){if(!e||!t)throw new Error("extend failed, please check that all dependencies are included.");var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor===Object.prototype.constructor&&(e.prototype.constructor=e)}},t.exports.util=e,Object.keys||(Object.keys=function(t){var e,r=[],n=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(e in t)n.call(t,e)&&r.push(e);return r})):e=require("util");var n={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},o=(t.exports.translationKeys=Object.keys(n),function(t){return n[t]}),a=function(t){var e,r,n;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:o,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},e=Object.keys(t),r=0,n=e.length;n>r;r++)this.set(e[r],t[e[r]]);this._result=null};t.exports.Paginator=a,a.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,e,r,n,o,a=this.options.totalResult,s=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,p=s%2===0?1:0,u={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:a,pageCount:null};if(0>=i)return u;if(r=Math.ceil(a/i),u.pageCount=r,2>r)return u.fromResult=1,u.toResult=a,u;for(l>r&&(l=r,u.current=l),o=Math.floor(s/2),t=l-o,e=l+o-p,1>t&&(t=1,e=t+s-1,e>r&&(e=r)),e>r&&(e=r,t=e-s+1,1>t&&(t=1)),n=t;e>=n;n++)u.range.push(n);return l>1&&(u.first=1,u.previous=l-1),r>l&&(u.last=r,u.next=l+1),u.fromResult=(l-1)*i+1,u.toResult=l===r?a:u.fromResult+i-1,u},set:function(t,e){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(e=parseInt(e,10),isNaN(e))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(e&&e.constructor&&e.call&&e.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":e=String(e)}this.options[t]=e,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.exports.registerFactory=function(t,e){if(r.hasOwnProperty(t))throw new Error(t+" already exists");r[t]=e},t.exports.create=function(t,e){if(r.hasOwnProperty(t))return new r[t](e);throw new Error("Paginator type"+t+" not found in register")}}("undefined"!=typeof module&&module.exports?module:void 0),exports.module=function(t,e){"use strict";var r=t.TemplatePaginator=function(e){var r=e.template;if(!r)throw new Error("Template compile to function needed");r.constructor&&r.call&&r.apply||(r=t.TemplateEngine.compile(String(r),e)),t.Paginator.call(this,e),this.renderer=r};e.inherits(r,t.Paginator),r.prototype.render=function(){var e,r,n=this.getPaginationData();for(n.preparedPreLink=this.preparePreLink(n.prelink),n.translations={},e=0,r=t.translationKeys.length;r>e;e++)n.translations[t.translationKeys[e]]=this.options.translator(t.translationKeys[e]);return this.renderer(n)},t.registerFactory("template",r)},exports.module(pagination,pagination.util); | ||
window.pagination={},window.exports=pagination,window.pagination.util={inherits:function(t,e){if(!e||!t)throw new Error("extend failed, please check that all dependencies are included.");var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor===Object.prototype.constructor&&(e.prototype.constructor=e)}},Object.keys||(Object.keys=function(t){var e,r=[],n=Object.prototype.hasOwnProperty;if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");for(e in t)n.call(t,e)&&r.push(e);return r}),function(t){"use strict";var e={},r={NEXT:"Next",PREVIOUS:"Previous",FIRST:"First",LAST:"Last",CURRENT_PAGE_REPORT:"Results {FromResult} - {ToResult} of {TotalResult}"},n=(t.translationKeys=Object.keys(r),function(t){return r[t]}),o=function(t){var e,r,o;for(this.options={totalResult:0,prelink:"",rowsPerPage:10,pageLinks:5,current:1,translator:n,translationCache:!1,translationCacheKey:"en",pageParamName:"page",slashSeparator:!1},e=Object.keys(t),r=0,o=e.length;o>r;r++)this.set(e[r],t[e[r]]);this._result=null};t.Paginator=o,o.prototype={getPaginationData:function(){return this._result||(this._result=this.calc()),this._result},calc:function(){var t,e,r,n,o,a=this.options.totalResult,s=this.options.pageLinks,i=this.options.rowsPerPage,l=this.options.current,p=s%2===0?1:0,u={prelink:this.options.prelink,current:l,previous:null,next:null,first:null,last:null,range:[],fromResult:null,toResult:null,totalResult:a,pageCount:null};if(0>=i)return u;if(r=Math.ceil(a/i),u.pageCount=r,2>r)return u.fromResult=1,u.toResult=a,u;for(l>r&&(l=r,u.current=l),o=Math.floor(s/2),t=l-o,e=l+o-p,1>t&&(t=1,e=t+s-1,e>r&&(e=r)),e>r&&(e=r,t=e-s+1,1>t&&(t=1)),n=t;e>=n;n++)u.range.push(n);return l>1&&(u.first=1,u.previous=l-1),r>l&&(u.last=r,u.next=l+1),u.fromResult=(l-1)*i+1,u.toResult=l===r?a:u.fromResult+i-1,u},set:function(t,e){if(this.options.hasOwnProperty(t)){switch(t){case"current":case"totalResult":case"pageLinks":case"rowsPerPage":if(e=parseInt(e,10),isNaN(e))throw new Error('Invalid value for "'+t+'", expected an integer');break;case"translator":if(!(e&&e.constructor&&e.call&&e.apply))throw new Error("Translator must be a function");break;case"translationCacheKey":case"pageParamName":case"prelink":e=String(e)}this.options[t]=e,this._result&&(this._result=null)}},preparePreLink:function(t){return this.options.slashSeparator?("/"!==t[t.length-1]&&(t+="/"),t+this.options.pageParamName+"/"):(-1!==t.indexOf("?")?"?"!==t[t.length-1]&&"&"!==t[t.length-1]&&(t+="&"):t+="?",t+this.options.pageParamName+"=")},render:function(){throw new Error("Implement")}},t.registerFactory=function(t,r){if(e.hasOwnProperty(t))throw new Error(t+" already exists");e[t]=r},t.create=function(t,r){if(e.hasOwnProperty(t))return new e[t](r);throw new Error("Paginator type"+t+" not found in register")}}(exports),exports.module=function(t,e){"use strict";var r=t.TemplatePaginator=function(e){var r=e.template;if(!r)throw new Error("Template compile to function needed");r.constructor&&r.call&&r.apply||(r=t.TemplateEngine.compile(String(r),e)),t.Paginator.call(this,e),this.renderer=r};e.inherits(r,t.Paginator),r.prototype.render=function(){var e,r,n=this.getPaginationData();for(n.preparedPreLink=this.preparePreLink(n.prelink),n.translations={},e=0,r=t.translationKeys.length;r>e;e++)n.translations[t.translationKeys[e]]=this.options.translator(t.translationKeys[e]);return this.renderer(n)},t.registerFactory("template",r)},exports.module(pagination,pagination.util); |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
37
1
203
0
87580
1295