From 0fd805d7486e4add2d2665a54458b3b94ca03cef Mon Sep 17 00:00:00 2001 From: HT Date: Fri, 22 Jul 2022 05:05:41 +0100 Subject: [PATCH] =?UTF-8?q?=E2=82=8A=E2=81=BA=E2=9C=BF=CB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v1.0/npf-styling.js | 79 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 v1.0/npf-styling.js diff --git a/v1.0/npf-styling.js b/v1.0/npf-styling.js new file mode 100644 index 0000000..6665569 --- /dev/null +++ b/v1.0/npf-styling.js @@ -0,0 +1,79 @@ +// npf photoset styling by @glenthemes +// npf photoset lightboxes by @codematurgy +var npfOptions = { + rowClass:"npf_row", + imageContainerClass:"tmblr-full", + generatedPhotosetContainerClass:"npf_photoset", + imageClass:"npf_image", + includeCommonPhotosets: true, + useTumblrLightbox: true, + insertGalleryIndicator: false, + galleryIndicatorClass: "npf_gallery_indicator", + galleryIndicatorContent: "", + photosetMargins:"" +} + +$(document).ready(function(){ + $(".npf_row").each(function(){ + npf_img = $(this).find("img"); + npf_rowHeight = Math.max.apply( + Math, npf_img.map(function(){ + return $(this).height(); + }).get()); + + var spacing = getComputedStyle(document.documentElement) + .getPropertyValue("--NPF-Image-Spacing"); + var sparce = parseInt(spacing); + + var maxh = Math.floor(npf_rowHeight + (sparce * 2)); + + $(this).css({"max-height":maxh}); + }); + + $(".tmblr-full").each(function(){ + if (!$(this).parent().is(".npf_row")) { + $(this).wrap( "
" ); + } + + $(this).css({"text-align":"left"}); + }); + + $(".tmblr-full img").each(function(i, npf){ + var npf_img = $(npf); + var create_div = $("
").css({ + "background-image":"url(" + npf_img.attr("src") + ")", + "background-repeat":"no-repeat", + "background-size":"cover", + "background-position":"center", + "width":npf_img.width() + "px", + "height":npf_img.height() + "px", + }); + npf_img.after(create_div); + }); + + $(".tmblr-full img").each(function(i, npf){ + var npf_img = $(npf); + npf_img.width(npf_img.width()); + npf_img.css({ + "position":"absolute", + "visibility":"visible", + "opacity":"0" + }); + }); + + // if image fails to get height + $(".tmblr-full div").each(function(i, npf){ + var npf_div = $(npf); + if ((npf_div.height()) == 0) { + npf_div.hide(); + npf_div.siblings("img").css({ + "position":"relative", + "opacity":"1" + }); + } + }); + + $(".tmblr-full").css({"cursor":"auto"}); + $(".npf_photoset img").css({"cursor":"pointer"}); + +});// end docready \ No newline at end of file