Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function windowResize() {
- if ("Fixed" == _4ORMAT_DATA.theme.menu_alignment && "Left" == _4ORMAT_DATA.theme.menu_position && $("#content").css("margin-left", $(".nav-wrapper").outerWidth() + parseInt($(".nav-wrapper").css("margin-right"))), Menu.setHeight(), $("#gallery_window").is(":visible") && ($(".lightbox-wrapper").height($(window).height()), Lightbox.resizeLoadedAsset()), window.matchMedia("(max-width: 767px)").matches && ($("aside.mobileMenu.mobile-content-top").outerHeight() > 95 ? $("#content").css("padding-top", $("aside.mobileMenu.mobile-content-top").outerHeight() + 5 + "px") : $("#content").css("padding-top", "95px"), $("aside.mobileMenu.mobile-content-top h1 a").hide().fadeIn(1)), $("body").hasClass("gallery") && "Columns" == _4ORMAT_DATA.theme.gallery_thumbnail_layout && Gallery.recalculateGallery(), $("body").hasClass("gallery") && "Rows" == _4ORMAT_DATA.theme.gallery_thumbnail_layout) {
- var e = Math.round($("#content").width() / $(".grid-sizer").width());
- $.each($(".asset-video img"), function(e, t) {
- $(t).css("margin-left", ($(".asset-video").width() - $(t).width()) / 2)
- }), $(".last-col").removeClass("last-col"), $.each($(".asset").not(".asset-title"), function(t, i) {
- $(i).position().left > $(".grid-sizer").width() * (e - 1) && $(i).addClass("last-col")
- })
- }
- window.matchMedia("(max-width: 767px)").matches && ($(window).width() > $(window).height() ? ($("#gallery_window").hasClass("video") || $("#gallery_window").hasClass("image")) && ($("#bottomGradient").length && $("#bottomGradient").addClass("landscape"), $("#copy_holder").hasClass("noCopy") || $("#copy_holder").show().addClass("landscape")) : ($("#gallery_window").hasClass("video") || $("#gallery_window").hasClass("image")) && ($("#bottomGradient").length && ($("#bottomGradient").removeClass("landscape"), $("#bottomGradient .button").removeClass("fade")), $("#copy_holder").hide().removeClass("landscape")))
- }
- var features;
- ! function(e, t) {
- t.transitions = "transition" in e || "webkitTransition" in e || "MozTransition" in e || "msTransition" in e || "OTransition" in e
- }(document.createElement("div").style, features || (features = {}));
- var App = {
- scrollerWidth: 0,
- init: function() {
- Array.prototype.indexOf || (Array.prototype.indexOf = function(e) {
- var t = this.length >>> 0,
- i = Number(arguments[1]) || 0;
- for (i = i < 0 ? Math.ceil(i) : Math.floor(i), i < 0 && (i += t); i < t; i++)
- if (i in this && this[i] === e) return i;
- return -1
- }), this.scrollerWidth = Helpers.getScrollerWidth(), Menu.init(), $("body").hasClass("listing") && (Listing.resize(), Listing.init(), Listing.animationCascade()), $("body").hasClass("gallery") && (Gallery.init(), Lightbox.init1(), 0 != window.location.hash.substring(1).length && Lightbox.loadAsset1(window.location.hash.substring(1), !0)), $(window).on("throttledresize", windowResize), window.matchMedia("(max-width: 767px)").matches && ($("aside.mobileMenu.mobile-content-top").outerHeight() > 95 ? $("#content").css("padding-top", $("aside.mobileMenu.mobile-content-top").outerHeight() + 5 + "px") : $("#content").css("padding-top", "95px"))
- }
- },
- Menu = {
- init: function() {
- "Scrolling" == _4ORMAT_DATA.theme.menu_alignment && ($(".nav-wrapper>.wrapper").css("margin-top", .04 * $(window).width()), setTimeout(function() {
- $(".nav-wrapper").height($(document).height())
- }, 100)), $(".nav-wrapper>.wrapper").fadeIn(500), "Fixed" == _4ORMAT_DATA.theme.menu_alignment && "Left" == _4ORMAT_DATA.theme.menu_position && $("#content").css({
- "margin-left": $(".nav-wrapper").outerWidth() + parseInt($(".nav-wrapper").css("margin-right")),
- display: "block"
- }), $("#content").show(), this.setHeight(), $(".category>a").on("click", function() {
- window.matchMedia("(min-width: 768px)").matches && $(this).parent().toggleClass("active")
- }), this.mobile.init()
- },
- mobile: {
- $aside: $("aside"),
- $header: $("header"),
- $body: $("body"),
- left_state: "hidden",
- lastScrollTop: 0,
- touchStateY: -1,
- touchState: "displayed",
- touchMargin: 30,
- init: function() {
- this.duplicateHeader(), this.$aside.find(".mobile-menu-close").click(this.onCloseClick.bind(this)), this.$aside.find(".mobile-menu-trigger").click(this.onTriggerClick.bind(this)), $(document).bind("touchstart", this.onTouchStart.bind(this)), $(document).bind("touchmove", this.onScrollMove.bind(this)), $(document).bind("scroll", this.onScrollMove.bind(this)), this.$aside.addClass("anim"), this.$header.addClass("anim"), this.blogPagination(), this.blogVideoHeight(), this.logoPadding()
- },
- logoPadding: function() {
- var e = $(".wrapper.closed h1").outerHeight();
- window.matchMedia("(max-width: 767px)").matches && (e < 95 ? $(".nav-wrapper.anim .wrapper").css("padding-top", "95px") : $(".nav-wrapper.anim .wrapper").css("padding-top", e + "px"))
- },
- duplicateHeader: function() {
- var e = this.$aside.find(".container > .wrapper").clone();
- e.removeClass("open").addClass("closed").find(".mobile-menu-trigger").text("X").removeClass("mobile-menu-trigger").addClass("mobileMenu mobile-menu-close"), this.$aside.find(".container").append(e)
- },
- onScrollMove: function() {
- var e = $(document).scrollTop();
- "displayed" != this.left_state && (e > this.lastScrollTop + 10 && e > 55 && "displayed" == this.touchState ? (this.$aside.find(".container").addClass("hide"), this.touchState = "hidden") : e < this.lastScrollTop - 10 && "hidden" == this.touchState && (this.$aside.find(".container").removeClass("hide"), this.touchState = "displayed"), this.lastScrollTop = e)
- },
- onTouchStart: function(e) {
- this.touchStateY = e.originalEvent.touches[0].clientY
- },
- onTriggerClick: function() {
- this.$body.toggleClass("mobile-menu-opened").height($("header .wrapper").outerHeight()), this.left_state = "hidden" == this.left_state ? "displayed" : "hidden"
- },
- onCloseClick: function() {
- return this.$body.removeClass("mobile-menu-opened").css("height", "auto"), this.left_state = "hidden", !1
- },
- blogPagination: function() {
- $(".f_blog_navigation span.f_blog_body_typography").next().addClass("blog-nav-next").prev().prev().addClass("blog-nav-prev"), $(".f_blog_navigation a:first-child").addClass("first"), $(".f_blog_navigation a:last-child").addClass("last")
- },
- blogVideoHeight: function() {
- $("body.simple iframe").each(function() {
- var e = $(this),
- t = e.attr("height"),
- i = e.attr("width"),
- a = t / i;
- e.css("max-height", a * ($(window).width() - 50))
- })
- }
- },
- setHeight: function() {
- if ("Fixed" == _4ORMAT_DATA.theme.menu_alignment) $(".nav-wrapper").height($(window).height());
- else {
- $(".nav-wrapper>.wrapper").css("margin-top", .04 * $(window).width());
- var e;
- $("body").hasClass("gallery") ? (e = $(".assets-container").outerHeight() + parseInt($(".nav-wrapper>.wrapper").css("margin-top")) + 10, e < $(window).height() && (e = $(window).height()), $(".nav-wrapper").height(e)) : (e = $("#content").outerHeight() + parseInt($(".nav-wrapper>.wrapper").css("margin-top")) + 10, e < $(window).height() && (e = $(window).height()), $(".nav-wrapper").height(e))
- }
- }
- },
- Listing = {
- init: function() {
- $(".masonry").length && $(".masonry").masonry()
- },
- resize: function() {
- var e, t = $(".masonry, .grid"),
- i = ["two-columns", "three-columns", "four-columns", "five-columns"],
- a = i.join(" "),
- o = ["Large", "Medium", "Small", "Auto"],
- s = [0, 500, 700, 900],
- n = o.indexOf(_4ORMAT_DATA.theme.listing_thumbnail_size) + 1,
- l = t.width(),
- r = e;
- if (l > s[n]) e = n;
- else
- for (var d = 0; d < 3; d++)
- if (l >= s[d] && l <= s[d + 1]) {
- e = d;
- break
- }
- r != e && (t.removeClass(a), t.addClass(i[e]), r = e)
- },
- animationCascade: function() {
- "listing" == _4ORMAT_DATA.page.type && ($("._4ORMAT_content_wrapper").removeClass("content-loaded"), $(".page-asset, .title").each(function(e) {
- var t = $(this);
- setTimeout(function() {
- t.addClass("asset-loaded")
- }, 100 * e)
- }))
- }
- },
- Gallery = {
- HIGH_RES_IMAGE_SIZE: 1400,
- container: null,
- assets: null,
- gallerySize: 0,
- init: function() {
- this.gallerySize = _4ORMAT_DATA.page.assets.length, this.container = $(".assets-container"), this.assets = _4ORMAT_DATA.page.assets, "Columns" == _4ORMAT_DATA.theme.gallery_thumbnail_layout && Gallery.buildGallery(), $(document).on("lazybeforeunveil", function(e) {
- $(e.target).siblings(".icon").fadeIn(300);
- var t = $(e.target).siblings(".overlay").css("filter");
- $(e.target).siblings(".overlay").fadeIn(300, function() {
- t && $(this).css("filter", t)
- }), $(e.target).parent().parent().removeClass("loading")
- })
- },
- recalculateGallery: function() {
- var e, t, i, a = $(".grid-sizer").width(),
- o = $(".gutter-sizer").width(),
- s = 0,
- n = Math.floor(($("#content").width() + o) / a);
- n > 4 && (n -= 1);
- for (var l = new Array(n), r = new Array(n), d = 0; d < n; d++) l[d] = 0, r[d] = 0;
- if (null != _4ORMAT_DATA.page.title && 1 == _4ORMAT_DATA.theme.gallery_title_style) s = n, e = 0;
- else if (null != _4ORMAT_DATA.page.title) switch (n) {
- case 4:
- !_4ORMAT_DATA.page.title.image_url && _4ORMAT_DATA.page.title.copy ? (s = 2, $(".asset-title").width(2 * a + o)) : _4ORMAT_DATA.page.title.image_url && (s = 3, $(".asset-title").width(3 * a + 2 * o));
- break;
- case 3:
- !_4ORMAT_DATA.page.title.image_url && _4ORMAT_DATA.page.title.copy ? (s = 2, $(".asset-title").width(2 * a + o)) : _4ORMAT_DATA.page.title.image_url && (s = 0, $(".asset-title").width(3 * a + 2 * o));
- break;
- case 2:
- $(".asset-title").width(2 * a + o), s = 0, e = 0
- }
- 0 != e && (e = $(".asset-title").outerWidth() + o), t = $(".asset-title").outerHeight() + o, i = new Array(n);
- for (var d = 0; d < n; d++) d < s || n < 3 || 3 == n && null != _4ORMAT_DATA.page.title && _4ORMAT_DATA.page.title.image_url ? (i[d] = t, r[d] += t) : i[d] = 0;
- null != _4ORMAT_DATA.page.title && _4ORMAT_DATA.page.title.image_url && (2 != n ? $(".asset-title").width(3 * a + 2 * o) : $(".asset-title").width(2 * a + o)), $(".asset").not(".asset-title").width(a), s = r.indexOf(Math.min.apply(Math, r));
- for (var h, d = 0; d < this.gallerySize; d++) asset = $('.asset[data-asset-id="' + d + '"]'), "image" == this.assets[d].type ? (h = Helpers.calculateImageSizeW(_4ORMAT_DATA.page.assets[d].image_dimensions_300x0, a), xOffset = s * h[0] + s * o, yOffset = r[s]) : "text" == this.assets[d].type ? (h = [a, a], xOffset = s * h[0] + s * o, yOffset = r[s]) : ("vimeo" == this.assets[d].source ? h = Helpers.calculateImageSizeW([this.assets[d].video_width, this.assets[d].video_height], a) : "youtube" == this.assets[d].source && (h = Helpers.calculateImageSizeW([this.assets[d].video_width, this.assets[d].video_height], a)), xOffset = s * h[0] + s * o, yOffset = r[s]), r[s] += h[1] + o, asset.height(h[1]).css({
- top: yOffset,
- left: xOffset
- }), s = r.indexOf(Math.min.apply(Math, r));
- for (d = 0; d < n; d++) l[d] += i[d];
- $(".assets-container").height(Math.max.apply(Math, r)), window.lazySizes && lazySizes.autoSizer.checkElems()
- },
- buildGallery: function() {
- for (var e = this, t = "", i = $(".grid-sizer").width(), a = 0; a < this.gallerySize; a++) {
- if (asset = _4ORMAT_DATA.page.assets[a], t += '<div data-asset-id="' + a + '" class="loading asset asset-' + asset.type + '">', "image" == asset.type) {
- var o = asset.image_url_550x0,
- s = asset.image_url_300x0 + "?300 " + asset.image_dimensions_300x0[0] + "w, " + asset.image_url_400x0 + "?400 " + asset.image_dimensions_400x0[0] + "w, " + asset.image_url_550x0 + "?550 " + asset.image_dimensions_550x0[0] + "w, " + asset.image_url_700x0 + "?700 " + asset.image_dimensions_700x0[0] + "w," + asset.image_url_1200x0 + "?1200 " + asset.image_dimensions_1200x0[0] + "w";
- t += '<a href="#" data-asset-id="' + a + '">', t += '<img class="lazy-asset lazyload" data-sizes="auto" alt="' + asset.alt_text + '" data-srcset="' + s + '" data-src="' + o + '" nopin="true" sizes="' + i + '"/><div class="overlay"></div>', _4ORMAT_DATA.theme.gallery_image_thumbnail_icon_visibility ? t += '<i class="icon"></i></a>' : t += "</a>"
- } else if ("text" == asset.type) {
- var n = asset.copy.replace("<p>", "").replace("</p>", ""),
- l = n.length,
- r = 0;
- r = "Two" == _4ORMAT_DATA.theme.gallery_columns ? 200 : "Three" == _4ORMAT_DATA.theme.gallery_columns ? 100 : 60;
- var d = l > r ? "..." : "";
- t += '<a data-asset-id="' + a + '"><div class="text-plus-icon"><svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 17 17"><path fill="#000000" fill-rule="evenodd" d="M9,8 L17,8 L17,9 L9,9 L9,17 L8,17 L8,9 L0,9 L6.123234e-17,8 L8,8 L8,0 L9,0 L9,8 Z"/></svg></div><span>' + $("<div />").html(asset.copy).text().substr(0, r) + d + "</span></a>"
- } else t += '<a href="' + asset.iframe_url + '" data-asset-id="' + a + '">', t += '<img class="lazy-asset lazyload" data-src="' + asset.thumbnail_url_0x550 + '" nopin="true" /><div class="overlay"></div><i class="icon"></i></a>', t += '<div class="video_holder" style="">' + asset.embed + "</div>";
- t += "</div>"
- }
- this.container.append(t), null !== _4ORMAT_DATA.page.title && _4ORMAT_DATA.page.title.image_url ? $(".asset-title img").on("lazyloaded", function() {
- e.recalculateGallery()
- }) : setTimeout(function() {
- e.recalculateGallery()
- })
- }
- },
- Lightbox = {
- lightboxWindow: null,
- lightboxWindowinner: null,
- activeAssetId: null,
- init1: function() {
- this.bindEvents1(), this.lightboxWindow = $("#gallery_window")
- },
- init: function() {
- this.bindEvents(), this.lightboxWindow = $("#gallery_window")
- },
- closeCaption: function() {
- window.matchMedia("(max-width: 767px)").matches && $("#copy_holder").hide()
- },
- loadNextAsset: function() {
- $("#gallery_window").removeAttr("class"), $("#bottomGradient").remove();
- var e = $(".current");
- if (parseInt(this.activeAssetId) + 1 == Gallery.assets.length) var t = $('.asset[data-asset-id="0"] a');
- else var t = e.next().find("a");
- $(t).click(), null == $("#gallery_window").attr("class") ? ($("#copy_holder").show(), $("#bottomGradient").remove()) : this.closeCaption()
- },
- loadPrevAsset: function() {
- $("#gallery_window").removeAttr("class"), $("#bottomGradient").remove();
- var e = ($(".current"), this.activeAssetId - 1 < 0 ? Gallery.assets.length - 1 : this.activeAssetId - 1),
- t = $('.asset[data-asset-id="' + e + '"] a');
- $(t).click(), null == $("#gallery_window").attr("class") ? ($("#copy_holder").show(), $("#bottomGradient").remove()) : this.closeCaption()
- },
- close: function() {
- window.matchMedia("(max-width: 767px)").matches && ($("#content").show(), $("header.nav-wrapper").show()), $("#gallery_window, #overlay, .lightbox-wrapper").fadeOut(200, function() {
- $("body").height() > $(window).height() && $("body").css("border-right", ""), $("body").removeClass("lightbox-active")
- }), $("#copy_holder .inner").html(""), $("#gallery_window").find("img").remove(), $("#window_inner").html(""), $("#bottomGradient").remove(), history.pushState("", document.title, window.location.pathname), this.closeCaption()
- },
- closestEdge: function(e, t) {
- var i = t.getBoundingClientRect(),
- a = i.left,
- o = i.right,
- s = e.pageX,
- n = (e.pageY, Math.abs(a - s)),
- l = Math.abs(o - s);
- switch (Math.min(n, l)) {
- case n:
- return "left";
- case l:
- return "right"
- }
- },
- gallerySwipe: function(e) {
- function t(e) {
- return e.touches || e.originalEvent.touches
- }
- function i(e) {
- if (a) {
- var i = t(e)[0].clientX;
- a - i > 0 ? Lightbox.loadNextAsset() : Lightbox.loadPrevAsset(), a = null
- }
- }
- $("#window_inner").on("touchmove", function(e) {
- i(e)
- });
- var a = null;
- a = t(e)[0].clientX
- },
- bindEvents1: function() {
- var e = this;
- $(".asset").not(".asset-title").on("click", "a", function(t) {
- return $("body").css("border-right", App.scrollerWidth), t.preventDefault(), window.location.hash = $(this).attr("data-asset-id"), $("body").hasClass("lightbox-active") ? e.loadAsset1($(this).attr("data-asset-id"), !1) : e.loadAsset1($(this).attr("data-asset-id"), !0), !1
- }), $(".lightbox-wrapper").scroll(function() {
- var e = $(".lightbox-wrapper").scrollTop();
- $("#gallery_window").outerHeight() + parseInt($("#gallery_window").css("top")) - $(window).height() - e < 25 ? $("#bottomGradient").removeClass("open") : $("#bottomGradient").addClass("open")
- }), $(document).on("click", "#bottomGradient .button", function() {
- $("#gallery_window").removeClass("loading"), $(this).hasClass("fade") ? ($(this).removeClass("fade"), $("body").scrollTop(0), $(".lightbox-wrapper").stop().animate({
- scrollTop: 0
- }, "slow", function() {
- $("#bottomGradient").removeClass("open"), $("#gallery_window").outerHeight(), $("#bottomGradient").outerHeight(), parseInt($("#gallery_window").css("top")), $(window).height()
- }), $("#copy_holder").fadeOut("slow")) : ($("#gallery_window").css("margin-bottom", "0px"), $("body").scrollTop(0), $(this).addClass("fade"), $("#copy_holder").fadeIn(200, function() {
- $(".lightbox-wrapper").stop().animate({
- scrollTop: $("#copy_holder").outerHeight() + 90
- }, "slow")
- }), $("#gallery_window").outerHeight() + parseInt($("#gallery_window").css("top")) > $(window).height() ? $("#bottomGradient").addClass("open") : $("#bottomGradient").removeClass("open"))
- }), $(".close").on("click", function(t) {
- t.preventDefault(), e.close1()
- }), $(".lightbox-wrapper").on("click", function(t) {
- ($(t.target).hasClass("window-wrapper") || $(t.target).hasClass("lightbox-wrapper")) && e.close1()
- }), $("#gallery_window").on("touchstart", function(t) {
- e.gallerySwipe(t)
- }), $("#window_inner").on("mousemove", function(t) {
- var i = e.closestEdge(t, this);
- $(this).removeClass("mouse-left mouse-right").addClass("mouse-" + i)
- }), $("#window_inner").on("mouseleave", function() {
- $(this).removeClass("mouse-left mouse-right")
- }), $("#window_inner").on("click", function(t) {
- var i = e.closestEdge(t, this);
- if ($(t.target).is("a")) return !0;
- "left" == i ? e.loadPrevAsset() : e.loadNextAsset()
- }), $(document).keydown(function(t) {
- if (Gallery.assets.length >= 1 && $("#overlay").is(":visible")) {
- if (37 == t.which) return Lightbox.loadPrevAsset(), !1;
- if (39 == t.which) return Lightbox.loadNextAsset(), !1;
- if (27 == t.which || 32 == t.which) return e.close(), !1
- }
- }), _4ORMAT.ImageProtection.is_enabled() && $("body").on("contextmenu", ".asset-image a[data-asset-id]", _4ORMAT.ImageProtection.trap)
- },
- loadAsset1: function(e, t) {
- this.activeAssetId = e;
- var i = Gallery.assets[e],
- a = i.image_dimensions_1600x1200,
- o = Math.round(.7 * $(window).width());
- $(window).height();
- if ($(".lightbox-wrapper").height($(window).height()), $("#copy_holder").removeClass("text"), i.copy ? ($("#copy_holder .inner").html(i.copy), $("#copy_holder").removeClass("noCopy")) : ($("#copy_holder .inner").html(""), $("#copy_holder").addClass("noCopy").css("")), $(".current").removeClass("current"), $('.asset[data-asset-id="' + e + '"]').addClass("current"), $("#window_inner").html(""), window.matchMedia("(max-width: 767px)").matches ? ($("#overlay").addClass("loading"), $(".lightbox-wrapper").addClass("tL")) : ($("#gallery_window").addClass("loading"), $(".lightbox-wrapper").removeClass("tL")), "image" == i.type) {
- var s = Helpers.fitImage(a, o);
- $("#window_inner").html('<img alt="' + i.alt_text + '" data-src="' + i.image_url_1600x1200 + '" class="lazy-asset lazyload" />'), $("#gallery_window").addClass(i.type), $("#copy_holder").hasClass("noCopy") ? $("#bottomGradient").remove() : ($("#gallery_window").append('<div id="bottomGradient"><div class="button"></div></div></div>'), $("#bottomGradient").fadeIn(), $(window).width() > $(window).height() ? ($("#bottomGradient").addClass("landscape"), $("#copy_holder").show().addClass("landscape")) : ($("#bottomGradient").removeClass("landscape"), $("#copy_holder").removeClass("landscape"))), $(".lightbox-wrapper, #overlay").fadeIn(200), $("#gallery_window").fadeIn(200), $("#copy_holder").css({
- bottom: -$("#copy_holder").height()
- }), $("#window_inner").height(s[1]), t ? ($("#gallery_window").height(s[1] + $("#copy_holder").height()), $("#gallery_window").width(s[0]), $("#gallery_window").css({
- "margin-left": s[0] / -2 - 54,
- top: $(window).height() / 2 - s[1] / 2 - 54
- }), Helpers.updateLightboxSpacing()) : $("#gallery_window").stop(!0, !0).animate({
- height: s[1] + $("#copy_holder").height(),
- width: s[0],
- "margin-left": s[0] / -2 - 54,
- top: $(window).height() / 2 - s[1] / 2 - 54
- }, function() {
- Helpers.updateLightboxSpacing()
- }), $(window).height() / 2 - s[1] / 2 - 54, $("#copy_holder").stop(!0, !0).animate({
- bottom: 25
- }), $("#copy_holder").css("margin-left", -$("#copy_holder").width() / 2);
- var n = parseInt($("#gallery_window").css("top"));
- n += 100, window.matchMedia("(max-width: 767px)").matches && ($("#copy_holder").hasClass("noCopy") ? $("#window_inner img").css("max-height", "calc(100vh - 10px") : $("#window_inner img").css("max-height", "calc(100vh - " + n + "px"))
- } else if ("text" == i.type) {
- window.matchMedia("(max-width: 767px)").matches ? $("#overlay").removeClass("loading") : $("#gallery_window").removeClass("loading"), $("#copy_holder").show().addClass("text").css({
- "margin-left": "",
- bottom: ""
- }), $(".lightbox-wrapper").removeClass("tL"), $("#window_inner").html("").height(""), $(".lightbox-wrapper, #overlay").fadeIn(200);
- var l = o > 420 ? 420 : o;
- $("#gallery_window").fadeIn(200), t ? ($("#gallery_window").height($("#copy_holder").height()), $("#gallery_window").width(l).css({
- "margin-left": l / -2 - 54,
- top: 60
- }), Helpers.updateLightboxSpacing()) : $("#gallery_window").stop(!0, !0).animate({
- height: $("#copy_holder").height(),
- width: l,
- "margin-left": -l / 2 - 54,
- top: 60
- }, function() {
- Helpers.updateLightboxSpacing()
- }), 60, Helpers.onlyCaptionGalleryMobile()
- } else s = Lightbox.getVideoSize(i), mobileDimmension = s[1] / s[0] * ($(window).width() - 50), mobileVerticalDimension = s[0] / s[1] * ($(window).height() - 100), window.matchMedia("(max-width: 767px)").matches ? $(window).width() > $(window).height() ? $("#window_inner").append('<div class="video_inner" style="width:' + mobileVerticalDimension + "px !important; height:" + mobileDimmension + 'px; max-height: calc(100vh - 100px); margin: 0 auto;">' + i.embed + "</div>") : $("#window_inner").append('<div class="video_inner" style="width:' + s[0] + "px; height:" + mobileDimmension + 'px;">' + i.embed + "</div>") : $("#window_inner").append('<div class="video_inner" style="width:' + s[0] + "px; height:" + s[1] + 'px;">' + i.embed + "</div>"), $(".lightbox-wrapper, #overlay").fadeIn(200), $("#gallery_window").addClass(i.type).fadeIn(200, function() {
- Helpers.captionButton()
- }), $("#gallery_window").removeClass("loading"), t ? ($("#gallery_window").height(s[1] + $("#copy_holder").height()), $("#gallery_window").width(s[0]), $("#gallery_window").css({
- "margin-left": s[0] / -2 - 54,
- top: $(window).height() / 2 - s[1] / 2 - 54
- }), Helpers.updateLightboxSpacing()) : $("#gallery_window").animate({
- height: s[1] + $("#copy_holder").height(),
- width: s[0],
- "margin-left": s[0] / -2 - 54,
- top: $(window).height() / 2 - s[1] / 2 - 54
- }, function() {
- Helpers.updateLightboxSpacing()
- }), $(window).height() / 2 - s[1] / 2 - 54, $("#copy_holder").css({
- bottom: -$("#copy_holder").height(),
- "margin-left": -$("#copy_holder").width() / 2
- }).animate({
- bottom: 25
- }).css("opacity", 1), $(".lightbox-wrapper").removeClass("tL"), $(window).width() > $(window).height() && $("#copy_holder").fadeIn();
- $("body").addClass("lightbox-active"), Helpers.updateLightboxSpacing()
- },
- close1: function() {
- window.matchMedia("(max-width: 767px)").matches && ($("#content").show(), $("header.nav-wrapper").show()), $("#gallery_window, #overlay, .lightbox-wrapper").fadeOut(200, function() {
- $("body").css("border-right", ""), $("body").removeClass("lightbox-active")
- }), $("#copy_holder .inner").html(""), $("#gallery_window").attr("class", "").find("img").remove(), $("#window_inner").html(""), $("#bottomGradient").remove(), history.pushState("", document.title, window.location.pathname), this.closeCaption()
- },
- resizeLoadedAsset: function() {
- var e = $("#window_inner"),
- t = .7 * $(window).width(),
- i = .8 * $(window).height();
- if (e.find("img").length) {
- var a = Helpers.fitImage(Gallery.assets[Lightbox.activeAssetId].image_dimensions_1600x1200);
- e.find("img").width(a[0]).height(a[1]), Helpers.setWindowGallerySize(a[0], a[1])
- } else if (e.find(".text_inner").length) t > 450 && (t = 450), Helpers.setWindowGallerySize(t, i);
- else if (e.find(".video_inner").length) {
- var o = Lightbox.getVideoSize(Gallery.assets[Lightbox.activeAssetId]);
- Helpers.setWindowGallerySize(o[0], o[1])
- }
- },
- getVideoSize: function(e) {
- var t = .7 * $(window).width(),
- i = $(window).height();
- return t / e.video_ratio > i ? [(i - 150) * e.video_ratio, i - 150] : [t, t / e.video_ratio]
- }
- },
- Helpers = {
- getScrollerWidth: function() {
- var e = null,
- t = null,
- i = 0,
- a = 0;
- return e = document.createElement("div"), e.style.position = "absolute", e.style.top = "-1000px", e.style.left = "-1000px", e.style.width = "100px", e.style.height = "50px", e.style.overflow = "hidden", t = document.createElement("div"), t.style.width = "100%", t.style.height = "200px", e.appendChild(t), document.body.appendChild(e), i = t.offsetWidth, e.style.overflow = "auto", a = t.offsetWidth, document.body.removeChild(document.body.lastChild), i - a
- },
- captionButton: function() {
- $("#copy_holder").hasClass("noCopy") ? $("#bottomGradient").remove() : ($("#gallery_window").append('<div id="bottomGradient"><div class="button"></div></div></div>'), $("#bottomGradient").fadeIn(), $(window).width() > $(window).height() ? $("#bottomGradient").addClass("landscape") : $("#bottomGradient").removeClass("landscape"))
- },
- onlyCaptionGalleryMobile: function() {
- window.matchMedia("(max-width: 767px)").matches && ($(window).height() > $("#copy_holder").height() ? $("#copy_holder").css({
- top: $(window).height() / 2 - $("#copy_holder").height() / 2 - 95
- }) : $("#copy_holder").css({
- top: 0
- }))
- },
- calculateImageSizeW: function(e, t) {
- var i, a = e[0],
- o = e[1];
- return i = a / t, o = Math.round(o / i), [t, o]
- },
- fitImage: function(e) {
- var t, i, a, o, s = .7 * $(window).width();
- s = s < 1600 ? s : 1600;
- var n = .8 * $(window).height();
- n = n < 1200 ? n : 1200;
- a = t = e[0], o = i = e[1];
- for (var l = !1; !l;) t > s ? (t = s, i = o / a * t) : i > n ? (i = n, t = a / o * i) : l = !0;
- return i = Math.round(i), t = Math.round(t), [t, i]
- },
- setWindowGallerySize: function(e, t) {
- var i = ($(window).height() - t) / 2 - 54;
- i < 0 && (i = 0), "text" == Gallery.assets[Lightbox.activeAssetId].type ? $("#window_inner").height("") : ($("#window_inner").height(t), $("#copy_holder").width() >= $("#window_inner").width() ? ($("#copy_holder").width($("#window_inner").width()), $("#copy_holder").css("margin-left", -$("#copy_holder").width() / 2)) : ($("#copy_holder").width(""), $("#copy_holder").css("margin-left", -$("#copy_holder").width() / 2))), 0 != $("#window_inner .video_inner").length && $("#window_inner .video_inner").height(t).width(e), $(".lightbox-wrapper").height($(window).height()), window.matchMedia("(max-width: 767px)").matches ? $("#overlay").removeClass("loading") : $("#gallery_window").removeClass("loading"), "text" == Gallery.assets[Lightbox.activeAssetId].type ? ($("#gallery_window").height(""), $("#gallery_window").stop(!0, !0).animate({
- width: e,
- "margin-left": -e / 2 - 54,
- top: i
- }, 0, function() {
- Helpers.updateLightboxSpacing()
- })) : Gallery.assets[Lightbox.activeAssetId].copy ? $("#gallery_window").stop(!0, !0).animate({
- width: e,
- height: $("#window_inner").height() + $("#copy_holder .inner").height(),
- "margin-left": -e / 2 - 54,
- top: i
- }, 0, function() {
- Helpers.updateLightboxSpacing()
- }) : $("#gallery_window").stop(!0, !0).animate({
- width: e,
- height: $("#window_inner").height(),
- "margin-left": -e / 2 - 54,
- top: i
- }, 0, function() {
- Helpers.updateLightboxSpacing(), $(this).find("img, .text_inner, .video_inner").animate({
- opacity: 1
- })
- })
- },
- updateLightboxSpacing: function() {
- $("#gallery_window").outerHeight() + $("#gallery_window").position().top > $(window).height() ? $(".lightbox-wrapper .window-wrapper").height($("#gallery_window").outerHeight() + $("#gallery_window").position().top).css("margin-bottom", $("#gallery_window").position().top) : $(".lightbox-wrapper .window-wrapper").height("")
- }
- };
- $(function() {
- "use strict";
- App.init()
- }), $(window).resize(function() {
- Listing.resize()
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement