New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jquery.page-it

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery.page-it - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

57

jquery.page-it.js

@@ -1,2 +0,2 @@

(function ($, window, document, undefined) {
(function($, window, document, undefined) {

@@ -41,6 +41,5 @@ var pluginName = 'pageIt';

this.pageLoadData = {};
this.requestData = {};
return this.init();
};

@@ -54,3 +53,3 @@

**/
init: function () {
init: function() {

@@ -61,3 +60,2 @@ if (!!this.settings.initPage)

this.trigger(pluginName + '.ready');
},

@@ -68,3 +66,3 @@

**/
to: function (pageIndex) {
to: function(pageIndex) {

@@ -82,10 +80,10 @@ if (!pageIndex || pageIndex > this.pageMeta.last)

/*
* reset pageLoadData object before triggering the beforeLoad,
* reset requestData object before triggering the beforeLoad,
* so the programer can replace it.
* Auto set the pageIndex that will be requested.
*/
this.pageLoadData = {};
this.pageLoadData.pageIndex = pageIndex;
this.requestData = {};
this.requestData.pageIndex = pageIndex;
this.trigger('page.load.before', this.pageLoadData);
this.trigger('page.load.before', this.requestData);

@@ -98,5 +96,5 @@ var that = this;

method: this.settings.method,
data: this.pageLoadData,
data: this.requestData,
dataType: this.settings.dataType,
success: function (data) {
success: function(data) {

@@ -132,7 +130,7 @@ that.pages[pageIndex] = data;

},
error: function (response) {
error: function(response) {
console.error('Erro ao carregar página.');
console.log(response);
},
complete: function (response) {
complete: function(response) {

@@ -169,3 +167,2 @@ // plugin .trigger method

return this;
},

@@ -176,3 +173,3 @@

**/
first: function () {
first: function() {
this.trigger('page.first', this.pageMeta.first);

@@ -185,3 +182,3 @@ return this.to(this.pageMeta.first);

**/
prev: function () {
prev: function() {
this.trigger('page.prev', this.pageMeta.next);

@@ -194,3 +191,3 @@ return this.to(this.pageMeta.prev);

**/
next: function () {
next: function() {
this.trigger('page.next', this.pageMeta.next);

@@ -203,3 +200,3 @@ return this.to(this.pageMeta.next);

**/
last: function () {
last: function() {
this.trigger('page.last', this.pageMeta.last);

@@ -215,3 +212,3 @@ return this.to(this.pageMeta.last);

**/
on: function (eventName, fn) {
on: function(eventName, fn) {

@@ -224,5 +221,3 @@ if (this.events[eventName]) {

return this;
},

@@ -236,3 +231,3 @@

**/
trigger: function (eventName) {
trigger: function(eventName) {

@@ -244,3 +239,3 @@ if (this.events[eventName] && this.events[eventName].length) {

this.events[eventName].map(function (fnName) {
this.events[eventName].map(function(fnName) {

@@ -254,3 +249,2 @@ fnName.apply(that, Array.prototype.slice.call(args, 1)); // Array.prototype.slice will convert the arguments object

return this;
},

@@ -261,3 +255,3 @@

**/
updateMeta: function () {
updateMeta: function() {

@@ -272,3 +266,3 @@ var that = this;

dataType: 'json',
success: function (data) {
success: function(data) {

@@ -291,7 +285,7 @@ that.trigger('page.meta.loaded', data);

},
error: function (response) {
error: function(response) {
console.error('Erro ao carregar meta dados.');
console.log(response);
},
complete: function (response) {
complete: function(response) {
console.groupEnd();

@@ -302,8 +296,7 @@ }

return this;
},
setData: function (object) {
setData: function(object) {
$.extend(this.pageLoadData, object);
$.extend(this.requestData, object);

@@ -310,0 +303,0 @@ }

(function(c,f,h,e){if(!c)return console.error("pageIt: N\u00e3o foi poss\u00edvel reconhecer o jQuery, inicializa\u00e7\u00e3o cancelada!"),!1;var g={url:"",method:"get",dataType:"html",initPage:1,cacheAjax:!1,cachePagination:!0,contentView:null,urlMeta:"",pageMeta:{first:1,prev:e,current:e,next:e,last:e,total:e}};f.pageIt=function(a){this.settings=c.extend(!0,{},g,a);this.events={};this.pages=[];this.pageMeta=this.settings.pageMeta;this.pageMeta.prev=this.settings.initPage-1;this.pageMeta.current=
this.settings.initPage;this.pageMeta.next=this.settings.initPage+1;this.pageLoadData={};return this.init()};c.extend(f.pageIt.prototype,{init:function(){this.settings.initPage&&this.to(this.settings.initPage);this.trigger("pageIt.ready")},to:function(a){if(!a||a>this.pageMeta.last)return this;if("string"===typeof a&&"next"===a||"prev"===a)return this[a]();if(this.settings.cachePagination&&this.pages[a])this.pages[a].content?(this.settings.contentView&&(this.settings.contentView.innerHTML=this.pages[a].content,
this.trigger("page.filled",this.pages[a])),this.trigger("page.content.loaded",this.pages[a]),this.trigger("page.loaded.cache",this.pages[a])):this.trigger("page.content.empty",this.pages[a]);else{this.pageLoadData={};this.pageLoadData.pageIndex=a;this.trigger("page.load.before",this.pageLoadData);var b=this;c.ajax({cache:this.settings.cache,url:this.settings.url,method:this.settings.method,data:this.pageLoadData,dataType:this.settings.dataType,success:function(d){b.pages[a]=d;b.pageMeta.prev=a-1;
b.pageMeta.current=a;b.pageMeta.next=a+1;b.trigger("page.content.loaded",d);d?"html"===b.settings.dataType&&b.settings.contentView?c(b.settings.contentView).html(d)&&b.trigger("page.filled",d):console.warn("No container set, no data will be auto inserted."):b.trigger("page.content.empty",d)},error:function(a){console.error("Erro ao carregar p\u00e1gina.");console.log(a)},complete:function(a){b.trigger("page.load.after",a);console.groupEnd()}})}return this},first:function(){this.trigger("page.first",
this.pageMeta.first);return this.to(this.pageMeta.first)},prev:function(){this.trigger("page.prev",this.pageMeta.next);return this.to(this.pageMeta.prev)},next:function(){this.trigger("page.next",this.pageMeta.next);return this.to(this.pageMeta.next)},last:function(){this.trigger("page.last",this.pageMeta.last);return this.to(this.pageMeta.last)},on:function(a,b){this.events[a]?this.events[a].push(b):this.events[a]=[b];return this},trigger:function(a){if(this.events[a]&&this.events[a].length){var b=
this,c=arguments;this.events[a].map(function(a){a.apply(b,Array.prototype.slice.call(c,1))})}return this},updateMeta:function(){var a=this;c.ajax({cache:!1,url:this.settings.urlMeta,method:this.settings.method,data:this.pageMeta,dataType:"json",success:function(b){a.trigger("page.meta.loaded",b);b?(c.extend(!0,a.pageMeta,b),a.trigger("page.meta.updated",b)):(a.trigger("page.meta.empty",b),console.warn("Page meta update found no data."))},error:function(a){console.error("Erro ao carregar meta dados.");
console.log(a)},complete:function(a){console.groupEnd()}});return this},setData:function(a){c.extend(this.pageLoadData,a)}});return f.pageIt})(window.jQuery||!1,window,document);
this.settings.initPage;this.pageMeta.next=this.settings.initPage+1;this.requestData={};return this.init()};c.extend(f.pageIt.prototype,{init:function(){this.settings.initPage&&this.to(this.settings.initPage);this.trigger("pageIt.ready")},to:function(a){if(!a||a>this.pageMeta.last)return this;if("string"===typeof a&&"next"===a||"prev"===a)return this[a]();if(this.settings.cachePagination&&this.pages[a])this.pages[a].content?(this.settings.contentView&&(this.settings.contentView.innerHTML=this.pages[a].content,
this.trigger("page.filled",this.pages[a])),this.trigger("page.content.loaded",this.pages[a]),this.trigger("page.loaded.cache",this.pages[a])):this.trigger("page.content.empty",this.pages[a]);else{this.requestData={};this.requestData.pageIndex=a;this.trigger("page.load.before",this.requestData);var b=this;c.ajax({cache:this.settings.cache,url:this.settings.url,method:this.settings.method,data:this.requestData,dataType:this.settings.dataType,success:function(d){b.pages[a]=d;b.pageMeta.prev=a-1;b.pageMeta.current=
a;b.pageMeta.next=a+1;b.trigger("page.content.loaded",d);d?"html"===b.settings.dataType&&b.settings.contentView?c(b.settings.contentView).html(d)&&b.trigger("page.filled",d):console.warn("No container set, no data will be auto inserted."):b.trigger("page.content.empty",d)},error:function(a){console.error("Erro ao carregar p\u00e1gina.");console.log(a)},complete:function(a){b.trigger("page.load.after",a);console.groupEnd()}})}return this},first:function(){this.trigger("page.first",this.pageMeta.first);
return this.to(this.pageMeta.first)},prev:function(){this.trigger("page.prev",this.pageMeta.next);return this.to(this.pageMeta.prev)},next:function(){this.trigger("page.next",this.pageMeta.next);return this.to(this.pageMeta.next)},last:function(){this.trigger("page.last",this.pageMeta.last);return this.to(this.pageMeta.last)},on:function(a,b){this.events[a]?this.events[a].push(b):this.events[a]=[b];return this},trigger:function(a){if(this.events[a]&&this.events[a].length){var b=this,c=arguments;this.events[a].map(function(a){a.apply(b,
Array.prototype.slice.call(c,1))})}return this},updateMeta:function(){var a=this;c.ajax({cache:!1,url:this.settings.urlMeta,method:this.settings.method,data:this.pageMeta,dataType:"json",success:function(b){a.trigger("page.meta.loaded",b);b?(c.extend(!0,a.pageMeta,b),a.trigger("page.meta.updated",b)):(a.trigger("page.meta.empty",b),console.warn("Page meta update found no data."))},error:function(a){console.error("Erro ao carregar meta dados.");console.log(a)},complete:function(a){console.groupEnd()}});
return this},setData:function(a){c.extend(this.requestData,a)}});return f.pageIt})(window.jQuery||!1,window,document);
{
"name": "jquery.page-it",
"version": "0.1.1",
"version": "0.1.2",
"description": "Lib for build paginations.",

@@ -5,0 +5,0 @@ "main": "jquery.page-it.js",

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