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