John Shaw Photography | Wildlife, nature, and travel photographer.


close label‘ + (title && title.length ? ‘‘ + title + ” : ” ) + ‘Image ‘ + (currentIndex + 1) + ‘ of ‘ + currentArray.length + ”; } //]]]]> jQuery(document).ready(function() { jQuery(“a.decoy”).fancybox({ ‘overlayColor’ : ‘#0b0b0f’, ‘overlayOpacity’ : 0.8, ‘centerOnScroll’ : true, ‘titlePosition’ : ‘inside’, ‘titleFormat’ : formatTitle //’href’ : ”+site+” }); var lighboxSelector = ‘.photocrati_lightbox_always, .photocrati_lightbox’; jQuery(lighboxSelector).fancybox({ ‘overlayColor’ : ‘#0b0b0f’, ‘overlayOpacity’ : 0.8, ‘centerOnScroll’ : true, ‘titlePosition’ : ‘inside’, ‘titleFormat’ : formatTitle }); }); ]]> = 0) { // percent width? leave as is size = parseFloat(sizeString); } else { // pixels, convert to percent size = parseFloat(sizeString); size = size / parseFloat(totalWidth); size = Math.round(size * 100) / 100; } } return size; }; var convertSizeToPercentString = function (sizeString, totalWidth) { var size = convertSizeToPercent(sizeString, totalWidth); if (size > 0) { size = size * 100; size = size.toString() + ‘%’; } else { size = ‘0’; } return size; }; var checkResponsive = function () { var isResponsive = isLayoutResponsive(); var adminBar = $(‘#wpadminbar:visible’); var header = $(‘#header’); var wrapper = $(‘#wrapper’); var spacer = $(‘#wrapper-content-spacer’); var container = $(‘#main_container #container’); var wrapperMargin = wrapper.data(‘original-margin-top’); if (typeof(wrapperMargin) === “undefined”) { wrapperMargin = convertSizeToPixels(wrapper.css(‘margin-top’), wrapper.height()); wrapper.data(‘original-margin-top’, wrapperMargin); } if (!isResponsive) { var windowOffset = $(window).scrollTop(); var headerWidgetArea = $(‘#header_widgets_above’); var offset = { top: 0, left: 0 }; var height = 0; var contentsMargin = 0; if (headerWidgetArea.size() > 0 && headerWidgetArea.css(‘position’) == ‘fixed’) { offset = headerWidgetArea.offset(); height = headerWidgetArea.height(); contentsMargin += height; offset.top -= windowOffset; } if (header.css(‘position’) == ‘fixed’) { var headerOffset = offset.top + height; if (adminBar.size() > 0) { if (headerWidgetArea.size() == 0) { headerOffset += adminBar.height(); } else { contentsMargin -= adminBar.height(); } } if (!header.hasClass(‘photocrati-header-left_header’)) { contentsMargin += header.outerHeight(); } header.css(‘top’, headerOffset); if (headerWidgetArea.size() == 0 || headerWidgetArea.css(‘position’) == ‘fixed’) { if (header.hasClass(‘photocrati-header-left_header’)) { contentsMargin += wrapperMargin; } else { contentsMargin += 10; } wrapper.css(‘margin-top’, contentsMargin + offset.top); } else { headerWidgetArea.css(‘margin-top’, contentsMargin + offset.top); wrapper.css(‘margin-top’, 10); } // attempt at aligning, not needed since we can just set #container margin-top to 0 which should cause logo and contents to align merely based on the modern CSS if (header.hasClass(‘photocrati-header-left_header’)) { var logoOffset = header.find(‘#blog-title a h1’).offset(); var spacerOffset = spacer.offset(); if (logoOffset && spacerOffset) { var marginAdjust = 20; // there’s about 20 extra pixels below spacer in margin among titles or widgets var spacerBottom = spacerOffset.top + spacer.outerHeight() + marginAdjust + windowOffset; var spacerDiff = spacerBottom – logoOffset.top; var spacerPadding = convertSizeToPixels(spacer.css(‘padding-bottom’), spacer.height()); spacer.css(‘padding-bottom’, spacerPadding – spacerDiff); } } } container.css(‘margin-top’, 0); } else { header.css(‘top’, ”); wrapper.css(‘margin-top’, ”); container.css(‘margin-top’, ”); spacer.css(‘padding-bottom’, ”); } var menus = $(‘.photocrati-menu’); menus.each(function () { var menu = $(this); var items = menu.find(‘ul > li’); var count = items.size(); if (isResponsive) { menu.addClass(‘photocrati-menu-responsive’); } else { menu.removeClass(‘photocrati-menu-responsive’); } for (var i = 0; i 0) { anchor = $(anchor.get(0)); var anchorWrap = anchor.find(‘.photocrati-menu-item-text’); if (anchorWrap.size() == 0) { anchorWrap = $(”).append(anchor.html()); anchor.html(anchorWrap); } if (item.hasClass(‘menu-item-has-children’)) { // create +/- symbol to expand/collapse submenus var expander = anchor.find(‘.photocrati-menu-expander’); if (expander.size() == 0) { expander = $(‘+’); expander.on(‘click’, function (event) { var jthis = $(this); var jpar = jthis.parent().parent(); var menu = jthis.parents(‘.photocrati-menu’); if (menu.hasClass(‘photocrati-menu-responsive’) && jpar.find(‘ul’).size() > 0) { jpar.toggleClass(‘item-open’); if (jpar.hasClass(‘item-open’)) { jthis.html(‘-‘); } else { jthis.html(‘+’); } event.preventDefault(); return false; } }); anchor.append(expander); } } } } var menuToggler = menu.find(‘.photocrati-menu-toggler’); var menuTogglerRefresh = function (menu, hideSpeed, showSpeed) { var menuList = menu.children(‘ul’).filter(‘:first’); if (menu.hasClass(‘photocrati-menu-responsive’)) { menuToggler.show(); var storage = window.sessionStorage; if (menu.hasClass(‘menu-collapsed’)) { if (hideSpeed) { menuList.hide(hideSpeed, function () { menu.addClass(‘menu-hidden’); }); } else { menuList.hide(); menu.addClass(‘menu-hidden’); } } else { menu.removeClass(‘menu-hidden’); if (showSpeed) { menuList.show(showSpeed); } else { menuList.show(showSpeed); } } if (storage) { storage.setItem(‘menu-toggler-state’, menu.hasClass(‘menu-collapsed’) ? ‘collapsed’ : ‘expanded’); } } else { menuToggler.hide(); menuList.show(); } }; if (isResponsive) { // create “hamburger” icon, i.e. button to collapse/expand entire menu if (menuToggler.size() == 0) { menuToggler = $(‘‘); menuToggler.find(‘a’).on(‘click’, function (event) { var jthis = $(this); var menu = jthis.parents(‘.photocrati-menu’); menu.toggleClass(‘menu-collapsed’); menuTogglerRefresh(menu, ‘slow’, ‘fast’); event.preventDefault(); return false; }); menu.prepend(menuToggler); if (!window.sessionStorage || window.sessionStorage.getItem(‘menu-toggler-state’) != ‘expanded’) { menu.addClass(‘menu-collapsed’); } } } menuTogglerRefresh(menu); }); }; var adjustPostsLayout = function (layoutContainer) { var entryList = layoutContainer.find(‘.hentry’); var entryCount = entryList.size(); if (entryCount == 0) return; var finalWidth = 0; var finalCols = 0; var finalMarginLeft = 0; var finalMarginRight = 0; var rowHeight = 0; var entryClass = entryList.first().attr(‘class’).split(‘ ‘); var entryTpl = null; for (var i = 0; i -1); // check if the template being used needs masonry animations if (applyMasonry) { if (!layoutContainer.hasClass(‘posts-container’)) { // masonry needs the container to only contain the .post objects so we need to extract them and put them in their own container var posElem = entryList.first().prev(); var parentElem = layoutContainer; layoutContainer = $(”); //layoutContainer.data(‘pctCache’, parentElem.data(‘pctCache’)); layoutContainer.append(entryList.detach()); if (posElem.size() > 0) { layoutContainer.insertAfter(posElem); } else { parentElem.prepend(layoutContainer); } } else { //layoutContainer.width(”); //layoutContainer.css(‘width’, ”); //layoutContainer.css(‘position’, ‘static’); //layoutContainer.css(‘display’, ‘inline-block’); } } for (var containerIndex = 0; containerIndex 0)); // only calculate width once as this code is run for each post container if (finalWidth == 0) { var totalWidth = layoutContainer.width(); var pctCache = layoutContainer.data(‘pct-cache’); var selectedWidth = 0; var minWidth = 0; var marginLeft = 0; var marginRight = 0; if (pctCache) { selectedWidth = pctCache[‘width’]; minWidth = pctCache[‘min-width’]; maxWidth = pctCache[‘max-width’]; marginLeft = pctCache[‘margin-left’]; marginRight = pctCache[‘margin-right’]; } else { minWidth = convertSizeToPixels(root.css(‘min-width’), totalWidth); maxWidth = convertSizeToPixels(root.css(‘max-width’), totalWidth); // we have to unset min-width otherwise .css(‘width’) returns the same as min-width root.css(‘min-width’, ‘0’); root.css(‘max-width’, ‘none’); root.css(‘width’, ”); selectedWidth = convertSizeToPercentString(root.css(‘width’), totalWidth); // here we restore min-width from stylesheet root.css(‘min-width’, ”); root.css(‘max-width’, ”); marginLeft = convertSizeToPercentString(root.css(‘margin-left’), totalWidth); marginRight = convertSizeToPercentString(root.css(‘margin-right’), totalWidth); layoutContainer.data( ‘pct-cache’, { ‘width’ : selectedWidth, ‘min-width’ : minWidth, ‘max-width’ : maxWidth, ‘margin-left’ : marginLeft, ‘margin-right’ : marginRight } ); } selectedWidth = convertSizeToPixels(selectedWidth, totalWidth); minWidth = convertSizeToPixels(minWidth, totalWidth); maxWidth = convertSizeToPixels(maxWidth, totalWidth); marginLeft = convertSizeToPixels(marginLeft, totalWidth); marginRight = convertSizeToPixels(marginRight, totalWidth); if (entryTpl == ‘grid’ || entryTpl == ‘image_wall’ || entryTpl.indexOf(‘masonry’) > -1) { // check if width and minWidth are the same – because of float rounding we use a difference of less than 1 pixel to consider equality var widthCut = selectedWidth – minWidth; selectedWidth = selectedWidth > minWidth ? (selectedWidth < maxWidth || maxWidth == 0 || isNaN(maxWidth) ? selectedWidth : maxWidth) : minWidth; //if (Math.abs(widthCut) 0) { root.css('min-width', '0'); root.css('max-width', 'none'); root.css('width', ''); root.width(finalWidth); if (containerIndex % finalCols == 0) { root.css('margin-left', 0); } else { root.css('margin-left', finalMarginLeft); } if (containerIndex % finalCols == finalCols - 1) { root.css('margin-right', 0); } else { root.css('margin-right', finalMarginRight); } } // exception to make text in featured image left always fill in the remaning space if (entryTpl == 'featured_left') { var leftCont = root.find('.post-side-left'); var rightCont = root.find('.post-side-right'); var rootWidth = root.width(); var widthDiff = Math.floor(rootWidth - (leftCont.outerWidth(true) + rightCont.outerWidth(true))); if (leftCont.css('clear') != "both") { rightCont.width(rightCont.width() + (widthDiff - 1)); } else { rightCont.css('width', ''); } } var wrapWidth = wrap.width(); var wrapHeight = wrap.height(); var imgWidth = parseFloat(img.attr('data-width')); var imgHeight = parseFloat(img.attr('data-height')); if (imgNodeLoaded) { if (isNaN(imgWidth)) { if (typeof(imgNode.naturalWidth) !== "undefined") imgWidth = imgNode.naturalWidth; else imgWidth = img.width(); } if (isNaN(imgHeight)) { if (typeof(imgNode.naturalHeight) !== "undefined") imgHeight = imgNode.naturalHeight; else imgHeight = img.height(); } } var imgRatio = imgWidth / imgHeight; var imgRatioInv = 1 / imgRatio; // adjust featured image aspect and crop / offset if (entryTpl.indexOf('masonry') == -1 || cont.hasClass('entry-thumbnail-empty')) { var wrapRatio = 0.6; if (entryTpl == 'featured_top') { wrapRatio = 0.4; } else if (entryTpl.indexOf('masonry') > -1) { // don’t randomize, leave ratio default as 0.6 //wrapRatio = 0.3 + (Math.random()); wrapRatio = 0.75; } wrapHeight = wrapWidth * wrapRatio; wrap.height(wrapHeight); var wrapRatio = wrapWidth / wrapHeight; var wrapRatioInv = 1 / wrapRatio; var widthDiff = wrapWidth – imgWidth; var heightDiff = wrapHeight – imgHeight; // wrap needs to be relative positioned for the absolute positioning of the image inside wrap.css(‘position’, ‘relative’); if (imgWidth && imgHeight && (widthDiff > 0 || heightDiff > 0)) { var offsetLeft = widthDiff / 2; var offsetTop = heightDiff / 2; if (offsetLeft imgRatio) { img.removeClass(‘image-crop-width’); img.addClass(‘image-crop-height’); var imgDiff = (imgRatioInv – wrapRatioInv) * wrapWidth; var topOffset = -(imgDiff / 2); img.css({ ‘position’: ‘absolute’, ‘top’: topOffset }); img.css({ ‘position’: ‘absolute’, ‘left’: 0 }); } else { img.removeClass(‘image-crop-height’); img.addClass(‘image-crop-width’); var imgDiff = (imgRatio – wrapRatio) * wrapHeight; var leftOffset = -(imgDiff / 2); img.css({ ‘position’: ‘absolute’, ‘top’: 0 }); img.css({ ‘position’: ‘absolute’, ‘left’: leftOffset }); } } } else if (applyMasonry) { if (!isNaN(imgRatio)) { wrapHeight = Math.min((wrapWidth / imgWidth) * imgHeight, imgHeight); wrap.height(wrapHeight); } else { if (!imgNodeLoaded) { setTimeout(function () { adjustPostsLayout(layoutContainer); }, 1000); } } } // exception to make grid posts expand in height to accomodate long titles while leaving the least amount of blank space if (entryTpl == ‘grid’) { var gridBox = root; var boxTitle = gridBox.find(‘.entry-title’); var boxMeta = gridBox.find(‘.entry-meta’); var boxContent = gridBox.find(‘.entry-content’); boxTitle.css({ ‘overflow’ : ‘visible’, ‘height’ : ‘auto’, ‘text-overflow’ : ‘visible’, ‘white-space’ : ‘normal’ }); boxMeta.css({ ‘overflow’ : ‘visible’, ‘height’ : ‘auto’, ‘text-overflow’ : ‘visible’, ‘white-space’ : ‘normal’ }); boxContent.height(”); boxContent.css({ ‘height’ : ‘auto’, ‘max-height’ : ‘none’ }); var gridBoxHeight = boxTitle.outerHeight() + boxMeta.outerHeight() + boxContent.outerHeight(); if (gridBoxHeight > rowHeight) { rowHeight = gridBoxHeight; } if (containerIndex % finalCols == (finalCols – 1)) { for (var gridIdx = finalCols – 1; gridIdx >= 0; gridIdx–) { gridBox = $(entryList.get(containerIndex – gridIdx)); boxTitle = gridBox.find(‘.entry-title’); boxMeta = gridBox.find(‘.entry-meta’); boxContent = gridBox.find(‘.entry-content’); gridBoxHeight = boxTitle.outerHeight() + boxMeta.outerHeight() + boxContent.outerHeight(); var heightDiff = rowHeight – gridBoxHeight; var boxContentHeight = boxContent.height(); boxContent.height(boxContentHeight + heightDiff); } rowHeight = 0; } } var hoverSet = $([]); var titleSet = root.find(‘.entry-title-set’); hoverSet = hoverSet.add(wrap); hoverSet = hoverSet.add(titleSet); hoverSet.hover( function (event) { // mouse in var jthis = $(this); jthis.parent().find(‘.entry-thumbnail-anchor’).addClass(‘mouse-hover’); }, function (event) { // mouse out var jthis = $(this); jthis.parent().find(‘.entry-thumbnail-anchor’).removeClass(‘mouse-hover’); } ); if (entryTpl == ‘image_wall’) { // for image_wall we want to have ellipsis (…) at the end for long titles, but CSS only solution doesn’t work because of multiline text, so we use dotdotdot but that needs the overflow to be set correctly var setHeight = titleSet.height(); var setOffset = titleSet.offset(); var entryTitle = titleSet.find(‘.entry-title’); var titleHeight = entryTitle.outerHeight(); var titleOffset = entryTitle.offset(); var titleDiff = setHeight – ((titleOffset.top – setOffset.top) + titleHeight); titleHeight = entryTitle.height() + titleDiff; entryTitle.css(‘max-height’, titleHeight); entryTitle.data(‘dotdotdot-style’, false); entryTitle.dotdotdot({ }); entryTitle.css(‘max-height’, titleHeight); entryTitle.trigger(‘update.dot’); } } // apply masonry animations if (applyMasonry) { if (layoutContainer.data(‘masonry’)) { //layoutContainer.masonry(‘destroy’); //layoutContainer.data(‘masonry’, null); } layoutContainer.masonry({ itemSelector: ‘.hentry’, gutter: finalMarginLeft + finalMarginRight, columnWidth: finalWidth, isResizeBound: false, isFitWidth: false }); if (navigator.userAgent.indexOf(“Safari”) > -1 && navigator.userAgent.indexOf(‘Chrome’) == -1 && !(/iPad|iPhone|iPod/.test(navigator.userAgent))) { for (var containerIndex = 0; containerIndex < entryList.size(); containerIndex += 1) { var root = $(entryList.get(containerIndex)); if (root.css('transform')) { root.css('transform', ''); } } } } }; var adjustAllPostsLayout = function () { var parents = $('.hentry').parent(); parents.each(function () { adjustPostsLayout($(this)); }); }; var adjustWidgetsSizing = function (targets) { if (typeof(targets) === "undefined") { targets = ".footer-widget-container"; } var widgets = jQuery(targets); var countwidgets = widgets.size(); var parent = widgets.parent(); var widgetarea = parent.width(); var widgetsize = Math.floor(((widgetarea - ((countwidgets - 1) * 26)) / countwidgets)); for (var i = 0; i < widgets.size(); i++) { var widget = $(widgets.get(i)); if (widget.css("clear") != "both") { widget.outerWidth(widgetsize); if (i + 1 ]]>

Source

Leave a Comment

Your email address will not be published.

Translate »