View file Structura/Template/HTWF/scripts/jquery.twbsPagination.min.js

File size: 9.61Kb
"use strict";

/*!
 * jQuery pagination plugin v1.2.5
 * http://esimakin.github.io/twbs-pagination/
 *
 * Copyright 2014, Eugene Simakin
 * Released under Apache 2.0 license
 * http://apache.org/licenses/LICENSE-2.0.html
 */

!function (t, s, i, e) { "use strict"; var a = t.fn.twbsPagination, o = function (i, e) { if (this.$element = t(i), this.options = t.extend({}, t.fn.twbsPagination.defaults, e), this.options.startPage < 1 || this.options.startPage > this.options.totalPages) throw new Error("Start page option is incorrect"); if (this.options.totalPages = parseInt(this.options.totalPages, 10), isNaN(this.options.totalPages)) throw new Error("Total pages option is not correct!"); if (this.options.visiblePages = parseInt(this.options.visiblePages, 10), isNaN(this.options.visiblePages)) throw new Error("Visible pages option is not correct!"); if (this.options.totalPages < this.options.visiblePages && (this.options.visiblePages = this.options.totalPages), this.options.onPageClick instanceof Function && this.$element.first().bind("page", this.options.onPageClick), this.options.href) { var a, o = this.options.href.replace(/[-\/\\^$*+?.|[\]]/g, "\\$&"); o = o.replace(this.options.hrefVariable, "(\\d+)"), null != (a = new RegExp(o, "i").exec(s.location.href)) && (this.options.startPage = parseInt(a[1], 10)) } var n = "function" == typeof this.$element.prop ? this.$element.prop("tagName") : this.$element.attr("tagName"); return "UL" === n ? this.$listContainer = this.$element : this.$listContainer = t("<ul></ul>"), this.$listContainer.addClass(this.options.paginationClass), "UL" !== n && this.$element.append(this.$listContainer), this.render(this.getPages(this.options.startPage)), this.setupEvents(), this }; o.prototype = { constructor: o, destroy: function () { return this.$element.empty(), this.$element.removeData("twbs-pagination"), this.$element.unbind("page"), this }, show: function (t) { if (1 > t || t > this.options.totalPages) throw new Error("Page is incorrect."); return this.render(this.getPages(t)), this.setupEvents(), this.$element.trigger("page", t), this }, buildListItems: function (s) { var i = t(); if (this.options.first && (i = i.add(this.buildItem("first", 1))), this.options.prev) { var e = s.currentPage > 1 ? s.currentPage - 1 : this.options.loop ? this.options.totalPages : 1; i = i.add(this.buildItem("prev", e)) } for (var a = 0; a < s.numeric.length; a++) i = i.add(this.buildItem("page", s.numeric[a])); if (this.options.next) { var o = s.currentPage < this.options.totalPages ? s.currentPage + 1 : this.options.loop ? 1 : this.options.totalPages; i = i.add(this.buildItem("next", o)) } return this.options.last && (i = i.add(this.buildItem("last", this.options.totalPages))), i }, buildItem: function (s, i) { var e = t("<li></li>"), a = t("<a></a>"), o = null; switch (s) { case "page": o = i, e.addClass(this.options.pageClass); break; case "first": o = this.options.first, e.addClass(this.options.firstClass); break; case "prev": o = this.options.prev, e.addClass(this.options.prevClass); break; case "next": o = this.options.next, e.addClass(this.options.nextClass); break; case "last": o = this.options.last, e.addClass(this.options.lastClass) } return e.data("page", i), e.data("page-type", s), e.append(a.attr("href", this.makeHref(i)).html(o)), e }, getPages: function (t) { var s = [], i = Math.floor(this.options.visiblePages / 2), e = t - i + 1 - this.options.visiblePages % 2, a = t + i; 0 >= e && (e = 1, a = this.options.visiblePages), a > this.options.totalPages && (e = this.options.totalPages - this.options.visiblePages + 1, a = this.options.totalPages); for (var o = e; a >= o;) s.push(o), o++; return { currentPage: t, numeric: s } }, render: function (s) { this.$listContainer.children().remove(), this.$listContainer.append(this.buildListItems(s)); var i = this.$listContainer.children(); i.filter(function () { return t(this).data("page") === s.currentPage && "page" === t(this).data("page-type") }).addClass(this.options.activeClass), i.filter(function () { return "first" === t(this).data("page-type") }).toggleClass(this.options.disabledClass, 1 === s.currentPage), i.filter(function () { return "last" === t(this).data("page-type") }).toggleClass(this.options.disabledClass, s.currentPage === this.options.totalPages), i.filter(function () { return "prev" === t(this).data("page-type") }).toggleClass(this.options.disabledClass, !this.options.loop && 1 === s.currentPage), i.filter(function () { return "next" === t(this).data("page-type") }).toggleClass(this.options.disabledClass, !this.options.loop && s.currentPage === this.options.totalPages) }, setupEvents: function () { var s = this; this.$listContainer.find("li").each(function () { var i = t(this); return i.off(), i.hasClass(s.options.disabledClass) || i.hasClass(s.options.activeClass) ? void i.click(function (t) { t.preventDefault() }) : void i.click(function (t) { !s.options.href && t.preventDefault(), s.show(parseInt(i.data("page"), 10)) }) }) }, makeHref: function (t) { return this.options.href ? this.options.href.replace(this.options.hrefVariable, t) : "#" } }, t.fn.twbsPagination = function (s) { var i, a = Array.prototype.slice.call(arguments, 1), n = t(this), r = n.data("twbs-pagination"), l = "object" == typeof s && s; return r || n.data("twbs-pagination", r = new o(this, l)), "string" == typeof s && (i = r[s].apply(r, a)), i === e ? n : i }, t.fn.twbsPagination.defaults = { totalPages: 0, startPage: 1, visiblePages: 5, href: !1, hrefVariable: "{{number}}", first: "First", prev: "Previous", next: "Next", last: "Last", loop: !1, onPageClick: null, paginationClass: "pagination", nextClass: "next", prevClass: "prev", lastClass: "last", firstClass: "first", pageClass: "page", activeClass: "active", disabledClass: "disabled" }, t.fn.twbsPagination.Constructor = o, t.fn.twbsPagination.noConflict = function () { return t.fn.twbsPagination = a, this } }(jQuery, window, document);

/*
* ===========================================================
* PAGINATION - LOAD MORE - ALBUMS - FRAMEWORK Y
* ===========================================================
* This script manage the pagination and load more system of the grid list and masonry list container components.
* This script manage also the album components. The script require Isotope only is used with masonry list.
* Documentation: www.framework-y.com/containers/list-grid.html#gallery-pagiantion
* Documentation: www.framework-y.com/containers/list-masonry.html#masonry-gallery-load-more
* 
* Schiocco - Copyright (c) Federico Schiocchet - Schiocco - Framework Y
*/

!function (i) {
    var a; i.fn.initTwbsPagination = function () { function t(a) { var t = i(a).attr("data-current-page"); isEmpty(t) && (t = 1), t++ , i(a).attr("data-current-page", t); for (var s = e * (t - 1), o = e * t, d = s; e * t > d; d++) { var c = i(i(l)[d]); isEmpty(n) || (i(c).css("opacity", "0"), i(c).showAnima(n)), i(c).css("display", "block") } o >= r && i(a).hide(300) } var s = i(this).attr("data-options"), n = i(this).attr("data-pagination-anima"), e = parseInt(i(this).attr("data-page-items"), 10), o = i(this).closest(".grid-list"), l = i(o).find(".grid-box .grid-item"), r = i(l).length, d = "pagination"; i(this).hasClass("load-more-grid") && (d = "load-more"), i(l).css("display", "none"); for (var c = 0; e > c; c++) i(i(l)[c]).css("display", "block"); if ("pagination" == d) { var m, p = { totalPages: Math.ceil(r / e), visiblePages: 7, first: "<i class='fa fa-angle-double-left'></i> <span>First</span>", last: "<span>Last</span> <i class='fa fa-angle-double-right'></i>", next: "<span>Next</span> <i class='fa fa-angle-right'></i>", prev: " <i class='fa fa-angle-left'></i> <span>Previous</span>", onPageClick: function (t, r) { i(l).css("display", "none"); for (var d = e * (r - 1); e * r > d; d++) { var c = i(i(l)[d]); isEmpty(n) || (i(c).css("opacity", "0"), i(c).showAnima(n)), i(c).css("display", "block"), a && i(c).renderLoadedImgs() } if (isEmpty(s) || -1 == s.indexOf("scrollTop:true") || i(o).scrollTo(), i.isFunction(i.fn.initFlexSlider)) { var d = 0; i(l).find(".flexslider").each(function () { i(this).initFlexSlider(), d++ }), d && i(window).trigger("resize").trigger("scroll") } } }; isEmpty(s) || (m = s.split(","), p = getOptionsString(s, p)), i(this).twbsPagination(p) } if ("load-more" == d) { if (!isEmpty(s) && -1 != s.indexOf("lazyLoad:true")) { var f = this; i(window).scroll(function () { i(window).scrollTop() + i(window).height() == i(document).height() && t(f) }) } i(this).on("click", function () { t(this) }) } },
    a = i.fn.renderLoadedImgs, i(".pagination-grid,.load-more-grid").each(function () { i(this).initTwbsPagination() }); var t = ".cont-album-box"; i(".album-item").hide(), i("body").on("click", ".album-box", function () { var s = i(this).closest(".album-main"), n = i(s).attr("data-album-anima"), e = i("#" + i(this).attr("data-album-id")); isEmpty(e) && (e = i(s).find(t + " .album-item:eq(" + i(this).index() + ")")), i(t + " .album-item").hide(), i(s).find(".album-list").hide(), i(s).find(t + " .album-title span").html(i(this).find(".album-name").html().replace("<br>", " ").replace("<br />", " ")), i(s).find(t + " .album-title").show(), isEmpty(n) || (i(e).css("opacity", 0), i(e).showAnima(n)), i(e).css("display", "block"), i.isFunction(i.fn.initIsotope) && i(e).find(".maso-list").initIsotope(), a && i(s).find(e).renderLoadedImgs(), i(e).find(".load-more-maso").attr("data-current-page", "1").css("display", "inline-block") }), i("body").on("click", t + " .album-title", function () { var a = i(this).closest(".album-main"), s = i(a).attr("data-album-anima"), n = i(a).find(".album-list"); i(t + " .album-item").hide(), i(t + " .album-title").hide(), isEmpty(s) || (i(n).css("opacity", 0), i(n).showAnima(s)), i(n).css("display", "block") })
}(jQuery);