diff options
author | 2017-06-29 11:54:06 +0530 | |
---|---|---|
committer | 2017-07-21 06:20:14 +0000 | |
commit | 1f6b18a1974c1b53a079b21b6be39af86deb2432 (patch) | |
tree | 7a9eba2bf86ea1ee651836dbf58ac998d4a92933 /VNF_Catalogue/public/3rd_party/materialize-pagination.min.js | |
parent | b8351286a53658bee2471430aaafac4eb72bdfde (diff) |
VNF_Catalogue Codebase
Catalogue of Open Source VNFs consist in helping the end users to get
information of the VNF we can deploy on top of an OPNFV solution
[Deepak]: Removed all swp files.
Change-Id: Ib2ea7330e964f1b684f32aedf631accd580df968
Signed-off-by: Kumar Rishabh <shailrishabh@gmail.com>
Signed-off-by: Deepak S <deepak.s@linux.intel.com>
Diffstat (limited to 'VNF_Catalogue/public/3rd_party/materialize-pagination.min.js')
-rw-r--r-- | VNF_Catalogue/public/3rd_party/materialize-pagination.min.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/VNF_Catalogue/public/3rd_party/materialize-pagination.min.js b/VNF_Catalogue/public/3rd_party/materialize-pagination.min.js new file mode 100644 index 00000000..c7b712c9 --- /dev/null +++ b/VNF_Catalogue/public/3rd_party/materialize-pagination.min.js @@ -0,0 +1,12 @@ +/* materialize Pagination v0.2.2 | http://mirjamsk.github.io/materialize-pagination */ +;(function(c,f,g,k){var d=function(a,b){this.$elem=c(a);this.options=b;this.currentPage=this.$nextEllipsis=this.$prevEllipsis=this.$container=null;this.visiblePages=[];this.maxVisiblePages=3};d.prototype={defaults:{align:"center",lastPage:1,firstPage:1,urlParameter:"page",useUrlParameter:!0,onClickCallback:function(){}},init:function(){this.config=c.extend({},this.defaults,this.options);var a=this.config.useUrlParameter?this.parseUrl():this.config.firstPage;this.createPaginationBase(a)&&this.bindClickEvent()}, +createPaginationBase:function(a){if(isNaN(this.config.firstPage)||isNaN(this.config.lastPage))return console.error("Both firstPage and lastPage attributes need to be integer values"),!1;if(this.config.firstPage>this.config.lastPage)return console.error("Value of firstPage must be less than the value of lastPage"),!1;this.config.firstPage=parseInt(this.config.firstPage);this.config.lastPage=parseInt(this.config.lastPage);this.currentPage=this.config.firstPage-this.maxVisiblePages;this.$container=c("<ul>").addClass("pagination").addClass(this.config.align+ +"-align");this.$prevEllipsis=this.util.Ellipsis();this.$nextEllipsis=this.util.Ellipsis();var b=this.util.createPage(this.config.firstPage),h=this.util.createChevron("prev"),e=this.util.createChevron("next");this.$container.append(h).append(b).append(this.$prevEllipsis.$elem).append(this.$nextEllipsis.$elem).append(e);this.config.lastPage>this.config.firstPage&&this.util.createPage(this.config.lastPage).insertBefore(e);this.requestPage(a);this.renderActivePage();this.$elem.append(this.$container); +return!0},requestPage:function(a){switch(a){case this.currentPage:return;case this.currentPage-1:this.requestPrevPage();break;case this.currentPage+1:this.requestNextPage();break;default:this.requestPageByNumber(a)}this.config.onClickCallback(this.currentPage);this.renderActivePage();this.config.useUrlParameter&&this.updateUrlParam(this.config.urlParameter,this.currentPage)},requestPrevPage:function(){--this.currentPage;this.visiblePages.pop().remove();this.visiblePages.unshift(this.insertPrevPaginationComponent(this.currentPage- +1))},requestNextPage:function(){this.currentPage+=1;this.visiblePages.shift().remove();this.visiblePages.push(this.insertNextPaginationComponent(this.currentPage+1))},requestPageByNumber:function(a){this.purgeVisiblePages();this.currentPage=a;this.visiblePages.push(this.insertNextPaginationComponent(this.currentPage-1));this.visiblePages.push(this.insertNextPaginationComponent(this.currentPage));this.visiblePages.push(this.insertNextPaginationComponent(this.currentPage+1))},renderActivePage:function(){this.renderEllipsis(); +this.$container.find("li.active").removeClass("active");c(this.$container.find('[data-page="'+this.currentPage+'"]')[0]).addClass("active")},renderEllipsis:function(){this.$prevEllipsis.isHidden&&this.currentPage>=this.config.firstPage+this.maxVisiblePages?this.$prevEllipsis.show():!this.$prevEllipsis.isHidden&&this.currentPage<=this.config.firstPage+this.maxVisiblePages-1&&this.$prevEllipsis.hide();this.$nextEllipsis.isHidden&&this.currentPage<=this.config.lastPage-this.maxVisiblePages?this.$nextEllipsis.show(): +!this.$nextEllipsis.isHidden&&this.currentPage>=this.config.lastPage-this.maxVisiblePages+1&&this.$nextEllipsis.hide()},bindClickEvent:function(){var a=this;this.$container.on("click","li",function(){var b=a.sanitizePageRequest(c(this).data("page"));a.requestPage(b)})},insertPrevPaginationComponent:function(a){return a>this.config.firstPage&&a<this.config.lastPage?this.util.createPage(a).insertAfter(this.$prevEllipsis.$elem):c("")},insertNextPaginationComponent:function(a){return a>this.config.firstPage&& +a<this.config.lastPage?this.util.createPage(a).insertBefore(this.$nextEllipsis.$elem):c("")},sanitizePageRequest:function(a){var b=this.config.firstPage;"prev"===a?b=this.currentPage===this.config.firstPage?this.currentPage:this.currentPage-1:"next"===a?b=this.currentPage===this.config.lastPage?this.currentPage:this.currentPage+1:!isNaN(a)&&a>=this.config.firstPage&&a<=this.config.lastPage&&(b=parseInt(a));return b},purgeVisiblePages:function(){for(var a=this.visiblePages.length,b=0;b<a;b+=1)this.visiblePages.pop().remove()}, +parseUrl:function(){var a=this.getUrlParamByName(this.config.urlParameter)||this.config.firstPage;return this.sanitizePageRequest(a)},getUrlParamByName:function(a){a=a.replace(/[\[\]]/g,"\\$&");return(a=(new RegExp("[?&]"+a+"(=([^&#]*)|&|#|$)")).exec(f.location.href))?a[2]?decodeURIComponent(a[2].replace(/\+/g," ")):"":null},updateUrlParam:function(a,b){[location.protocol,"//",location.host,location.pathname].join("");var c=g.location.search,e=a+"="+b,d="?"+e;c&&(keyRegex=new RegExp("([?&])"+a+"[^&]*"), +d=null!==c.match(keyRegex)?c.replace(keyRegex,"$1"+e):c+"&"+e);f.history.pushState("","",d)},util:{createPage:function(a){return c("<li>").text(a).addClass("waves-effect").attr("data-page",a)},createChevron:function(a){var b="next"===a?"right":"left",b=c("<i>").addClass("waves-effect").addClass("material-icons").text("chevron_"+b);return this.createPage(a).text("").attr("data-page",a).append(b)},Ellipsis:function(){var a=c("<li>");a.text("...");a.addClass("hide disabled");return{$elem:a,isHidden:!0, +show:function(){this.isHidden=!1;this.$elem.removeClass("hide")},hide:function(){this.isHidden=!0;this.$elem.addClass("hide")}}}}};d.defaults=d.prototype.defaults;c.fn.materializePagination=function(a){return this.each(function(){(new d(this,a)).init()})}})(jQuery,window,document);
\ No newline at end of file |