Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pagination

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pagination - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

example/web.html

42

lib/pagination.js

@@ -1,3 +0,29 @@

var util = require('util');
var util;
/* Check if clientside or serverside */
if( typeof module == "undefined" && typeof window == "object") {
window.pagination = {};
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;
}
}
};
} else {
util = require('util');
}
var translations = {

@@ -196,3 +222,3 @@ 'NEXT' : 'Next',

this.set('pageLinks', 1);
};

@@ -204,10 +230,7 @@ module.exports.ItemPaginator = ItemPaginator;

ItemPaginator.prototype.renderCurrentPageReport = function(fromResult, toResult, totalResult) {
if (!this.options.translationCache) {
if(!this.options.translationCache) {
return this.options.translator('CURRENT_PAGE_REPORT').replace('{FromResult}', fromResult).replace('{ToResult}', toResult).replace('{TotalResult}', totalResult);
}
if (!translationCache.CURRENT_PAGE_REPORT) {
var template = "return '" + (this.options.translator('CURRENT_PAGE_REPORT').replace("'", "\'")
.replace('{FromResult}', "' + fromResult + '")
.replace('{ToResult}', "' + toResult + '")
.replace('{TotalResult}', "' + totalResult + '")) + "';";
if(!translationCache.CURRENT_PAGE_REPORT) {
var template = "return '" + (this.options.translator('CURRENT_PAGE_REPORT').replace("'", "\'").replace('{FromResult}', "' + fromResult + '").replace('{ToResult}', "' + toResult + '").replace('{TotalResult}', "' + totalResult + '")) + "';";
translationCache.CURRENT_PAGE_REPORT = new Function('fromResult, toResult, totalResult', template);

@@ -226,3 +249,3 @@ }

html += '</span>';
if(result.first) {

@@ -251,3 +274,2 @@ html += '<a href="' + prelink + 'page=' + result.first + '" class="paginator-first">' + this.options.translator('FIRST') + '</a>';

}
html += '</div>';

@@ -254,0 +276,0 @@ return html;

@@ -13,3 +13,3 @@ {

},
"version": "0.2.1"
"version": "0.3.0"
}

@@ -50,3 +50,22 @@ ## pagination

pageCount: 51 }
## Pagination on client side
<html>
<head>
<script src="../lib/pagination.js"></script>
</head>
<body>
<div id="paging"></div>
<script type="text/javascript">
(function() {
var paginator = new pagination.ItemPaginator({prelink:'/', current: 3, rowsPerPage: 200, totalResult: 10020});
var html = paginator.render();
var paginator = pagination.create('search', {prelink:'/', current: 1, rowsPerPage: 200, totalResult: 10020});
html += paginator.render();
document.getElementById("paging").innerHTML = html;
})();
</script>
</body>
</html>
## Options

@@ -53,0 +72,0 @@ Object to pass to paginator classes (second argument when using create function)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc