if (typeof(php_data.ac_settings.site_tracking) != "undefined" && php_data.ac_settings.site_tracking == "1") { if(typeof(php_data.ac_settings.tracking_actid) === "undefined" || php_data.ac_settings.tracking_actid === ''){ console.log('Site tracking account not found'); } else{ (function(e,t,o,n,p,r,i){e.visitorGlobalObjectAlias=n;e[e.visitorGlobalObjectAlias]=e[e.visitorGlobalObjectAlias]||function(){(e[e.visitorGlobalObjectAlias].q=e[e.visitorGlobalObjectAlias].q||[]).push(arguments)};e[e.visitorGlobalObjectAlias].l=(new Date).getTime();r=t.createElement("script");r.src=o;r.async=true;i=t.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)})(window,document,"https://diffuser-cdn.app-us1.com/diffuser/diffuser.js","vgo"); vgo('setAccount', php_data.ac_settings.tracking_actid); vgo('setTrackByDefault', php_data.ac_settings.site_tracking_default == "1"); if (typeof trackcmp_email !== 'undefined') { vgo('setEmail', trackcmp_email); } vgo('process'); function acEnableTracking() { let expiration = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 30); document.cookie = "ac_enable_tracking=1;samesite=none;secure; expires= " + expiration + "; path=/"; vgo('process', 'allowTracking'); } if (php_data.ac_settings.site_tracking_default == "1" || /(^|; )ac_enable_tracking=([^;]+)/.test(document.cookie)) { acEnableTracking(); } } } ; !function(){"use strict";var e,t={noop:function(){},texturize:function(e){return(e=(e=(e=(e+="").replace(/'/g,"’").replace(/'/g,"’")).replace(/"/g,"”").replace(/"/g,"”").replace(/"/g,"”").replace(/[\u201D]/g,"”")).replace(/([\w]+)=&#[\d]+;(.+?)&#[\d]+;/g,'$1="$2"')).trim()},applyReplacements:function(e,t){if(e)return t?e.replace(/{(\d+)}/g,(function(e,r){return void 0!==t[r]?t[r]:e})):e},getBackgroundImage:function(e){var t=document.createElement("canvas"),r=t.getContext&&t.getContext("2d");if(e){r.filter="blur(20px) ",r.drawImage(e,0,0);var o=t.toDataURL("image/png");return t=null,o}}},r=function(){function e(e,t){return Element.prototype.matches?e.matches(t):Element.prototype.msMatchesSelector?e.msMatchesSelector(t):void 0}function r(e,t,r,o){if(!e)return o();e.style.removeProperty("display"),e.style.opacity=t,e.style.transition="opacity 0.2s",e.style.pointerEvents="none";var a=function(t){t.target===e&&"opacity"===t.propertyName&&(e.style.removeProperty("transition"),e.style.removeProperty("opacity"),e.style.removeProperty("pointer-events"),e.removeEventListener("transitionend",a),e.removeEventListener("transitioncancel",a),o())};requestAnimationFrame((function(){requestAnimationFrame((function(){e.addEventListener("transitionend",a),e.addEventListener("transitioncancel",a),e.style.opacity=r}))}))}return{closest:function(t,r){if(t.closest)return t.closest(r);var o=t;do{if(e(o,r))return o;o=o.parentElement||o.parentNode}while(null!==o&&1===o.nodeType);return null},matches:e,hide:function(e){e&&(e.style.display="none")},show:function(e){e&&(e.style.display="block")},fadeIn:function(e,o){r(e,"0","1",o=o||t.noop)},fadeOut:function(e,o){o=o||t.noop,r(e,"1","0",(function(){e&&(e.style.display="none"),o()}))},scrollToElement:function(e,t,r){if(!e||!t)return r?r():void 0;var o=t.querySelector(".jp-carousel-info-extra");o&&(o.style.minHeight=window.innerHeight-64+"px");var a=!0,i=Date.now(),n=t.scrollTop,l=Math.max(0,e.offsetTop-Math.max(0,window.innerHeight-function(e){var t=e.querySelector(".jp-carousel-info-footer"),r=e.querySelector(".jp-carousel-info-extra"),o=e.querySelector(".jp-carousel-info-content-wrapper");if(t&&r&&o){var a=window.getComputedStyle(r),i=parseInt(a.paddingTop,10)+parseInt(a.paddingBottom,10);return i=isNaN(i)?0:i,o.offsetHeight+t.offsetHeight+i}return 0}(t))),s=l-t.scrollTop;function c(){a=!1}s=Math.min(s,t.scrollHeight-window.innerHeight),t.addEventListener("wheel",c),function e(){var l,u=Date.now(),d=(l=(u-i)/300)<.5?2*l*l:1-Math.pow(-2*l+2,2)/2,p=(d=d>1?1:d)*s;if(t.scrollTop=n+p,u<=i+300&&a)return requestAnimationFrame(e);r&&r(),o&&(o.style.minHeight=""),a=!1,t.removeEventListener("wheel",c)}()},getJSONAttribute:function(e,t){if(e&&e.hasAttribute(t))try{return JSON.parse(e.getAttribute(t))}catch(e){return}},convertToPlainText:function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML},stripHTML:function(e){return e.replace(/<[^>]*>?/gm,"")},emitEvent:function(e,t,r){var o;try{o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r||null})}catch(e){(o=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,r||null)}e.dispatchEvent(o)},isTouch:function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch}}}();function o(){var o,a,i,n,l="",s=!1,c="div.gallery, div.tiled-gallery, ul.wp-block-gallery, ul.blocks-gallery-grid, figure.wp-block-gallery.has-nested-images, div.wp-block-jetpack-tiled-gallery, a.single-image-gallery",u=".gallery-item, .tiled-gallery-item, .blocks-gallery-item, .tiled-gallery__item",d=u+", .wp-block-image",p={},m="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.stat?wpcom.carousel.stat:t.noop,g="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.pageview?wpcom.carousel.pageview:t.noop;function h(t){if(!s)switch(t.which){case 38:t.preventDefault(),p.overlay.scrollTop-=100;break;case 40:t.preventDefault(),p.overlay.scrollTop+=100;break;case 39:t.preventDefault(),e.slideNext();break;case 37:case 8:t.preventDefault(),e.slidePrev();break;case 27:t.preventDefault(),b()}}function f(){s=!0}function v(){s=!1}function y(){p.overlay||(p.overlay=document.querySelector(".jp-carousel-overlay"),p.container=p.overlay.querySelector(".jp-carousel-wrap"),p.gallery=p.container.querySelector(".jp-carousel"),p.info=p.overlay.querySelector(".jp-carousel-info"),p.caption=p.info.querySelector(".jp-carousel-caption"),p.commentField=p.overlay.querySelector("#jp-carousel-comment-form-comment-field"),p.emailField=p.overlay.querySelector("#jp-carousel-comment-form-email-field"),p.authorField=p.overlay.querySelector("#jp-carousel-comment-form-author-field"),p.urlField=p.overlay.querySelector("#jp-carousel-comment-form-url-field"),window.innerWidth<=760&&Math.round(window.innerWidth/760*110)<40&&r.isTouch(),[p.commentField,p.emailField,p.authorField,p.urlField].forEach((function(e){e&&(e.addEventListener("focus",f),e.addEventListener("blur",v))})),p.overlay.addEventListener("click",(function(e){var t,o,a=e.target,i=!!r.closest(a,".jp-carousel-close-hint"),n=!!window.matchMedia("(max-device-width: 760px)").matches;if(a===p.overlay){if(n)return;b()}else if(i)b();else if(a.classList.contains("jp-carousel-image-download"))m("download_original_click");else if(a.classList.contains("jp-carousel-comment-login"))t=p.currentSlide,o=t?t.attrs.attachmentId:"0",window.location.href=jetpackCarouselStrings.login_url+"%23jp-carousel-"+o;else if(r.closest(a,"#jp-carousel-comment-form-container"))!function(e){var t=e.target,o=r.getJSONAttribute(p.container,"data-carousel-extra")||{},a=p.currentSlide.attrs.attachmentId,i=document.querySelector("#jp-carousel-comment-form-submit-and-info-wrapper"),n=document.querySelector("#jp-carousel-comment-form-spinner"),l=document.querySelector("#jp-carousel-comment-form-button-submit"),s=document.querySelector("#jp-carousel-comment-form");if(p.commentField&&p.commentField.getAttribute("id")===t.getAttribute("id"))f(),r.show(i);else if(r.matches(t,'input[type="submit"]')){e.preventDefault(),e.stopPropagation(),r.show(n),s.classList.add("jp-carousel-is-disabled");var c={action:"post_attachment_comment",nonce:jetpackCarouselStrings.nonce,blog_id:o.blog_id,id:a,comment:p.commentField.value};if(!c.comment.length)return void w(jetpackCarouselStrings.no_comment_text,!1);if(1!==Number(jetpackCarouselStrings.is_logged_in)&&(c.email=p.emailField.value,c.author=p.authorField.value,c.url=p.urlField.value,1===Number(jetpackCarouselStrings.require_name_email))){if(!c.email.length||!c.email.match("@"))return void w(jetpackCarouselStrings.no_comment_email,!1);if(!c.author.length)return void w(jetpackCarouselStrings.no_comment_author,!1)}var u=new XMLHttpRequest;u.open("POST",jetpackCarouselStrings.ajaxurl,!0),u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),u.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE&&this.status>=200&&this.status<300){var e;try{e=JSON.parse(this.response)}catch(e){return void w(jetpackCarouselStrings.comment_post_error,!1)}"approved"===e.comment_status?w(jetpackCarouselStrings.comment_approved,!0):"unapproved"===e.comment_status?w(jetpackCarouselStrings.comment_unapproved,!0):w(jetpackCarouselStrings.comment_post_error,!1),E(),q(a),l.value=jetpackCarouselStrings.post_comment,r.hide(n),s.classList.remove("jp-carousel-is-disabled")}else w(jetpackCarouselStrings.comment_post_error,!1)};var d=[];for(var m in c)if(m){var g=encodeURIComponent(m)+"="+encodeURIComponent(c[m]);d.push(g.replace(/%20/g,"+"))}var h=d.join("&");u.send(h)}}(e);else if(r.closest(a,".jp-carousel-photo-icons-container")||a.classList.contains("jp-carousel-photo-title"))!function(e){e.preventDefault();var t=e.target,o=p.info.querySelector(".jp-carousel-info-extra"),a=p.info.querySelector(".jp-carousel-image-meta"),i=p.info.querySelector(".jp-carousel-comments-wrapper"),n=p.info.querySelector(".jp-carousel-icon-info"),l=p.info.querySelector(".jp-carousel-icon-comments");function s(){l&&l.classList.remove("jp-carousel-selected"),n.classList.toggle("jp-carousel-selected"),i&&i.classList.remove("jp-carousel-show"),a&&(a.classList.toggle("jp-carousel-show"),a.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}function c(){n&&n.classList.remove("jp-carousel-selected"),l.classList.toggle("jp-carousel-selected"),a&&a.classList.remove("jp-carousel-show"),i&&(i.classList.toggle("jp-carousel-show"),i.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}(r.closest(t,".jp-carousel-icon-info")||t.classList.contains("jp-carousel-photo-title"))&&(a&&a.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,s):(s(),r.scrollToElement(p.info,p.overlay))),r.closest(t,".jp-carousel-icon-comments")&&(i&&i.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,c):(c(),r.scrollToElement(p.info,p.overlay)))}(e);else if(!r.closest(a,".jp-carousel-info"))return})),window.addEventListener("keydown",h),p.overlay.addEventListener("jp_carousel.afterOpen",(function(){v(),p.slides.length<=1||(p.slides.length<=5?r.show(p.info.querySelector(".jp-swiper-pagination")):r.show(p.info.querySelector(".jp-carousel-pagination")))})),p.overlay.addEventListener("jp_carousel.beforeClose",(function(){f(),document.documentElement.style.removeProperty("height"),e&&e.enable(),r.hide(p.info.querySelector(".jp-swiper-pagination")),r.hide(p.info.querySelector(".jp-carousel-pagination"))})),p.overlay.addEventListener("jp_carousel.afterClose",(function(){window.history.pushState?history.pushState("",document.title,window.location.pathname+window.location.search):window.location.href="",l="",p.isOpen=!1})),p.overlay.addEventListener("touchstart",(function(e){e.touches.length>1&&e.preventDefault()})))}function w(e,t){var o=p.overlay.querySelector("#jp-carousel-comment-post-results"),a="jp-carousel-comment-post-"+(t?"success":"error");o.innerHTML=''+e+"",r.hide(p.overlay.querySelector("#jp-carousel-comment-form-spinner")),p.overlay.querySelector("#jp-carousel-comment-form").classList.remove("jp-carousel-is-disabled"),r.show(o)}function j(){var e=document.querySelectorAll("a img[data-attachment-id]");Array.prototype.forEach.call(e,(function(e){var t=e.parentElement,o=t.parentElement;if(!o.classList.contains("gallery-icon")&&!r.closest(o,u)&&t.hasAttribute("href")){var a=!1;t.getAttribute("href").split("?")[0]===e.getAttribute("data-orig-file").split("?")[0]&&1===Number(jetpackCarouselStrings.single_image_gallery_media_file)&&(a=!0),t.getAttribute("href")===e.getAttribute("data-permalink")&&(a=!0),a&&(t.classList.add("single-image-gallery"),t.setAttribute("data-carousel-extra",JSON.stringify({blog_id:Number(jetpackCarouselStrings.blog_id)})))}}))}function S(o){(!o||o<0||o>p.slides.length)&&(o=0),p.currentSlide=p.slides[o];var a,i,n=p.currentSlide,s=n.attrs.attachmentId,c=p.info.querySelector(".jp-carousel-icon-info"),u=p.info.querySelector(".jp-carousel-icon-comments");(c&&c.classList.contains("jp-carousel-selected")||u&&u.classList.contains("jp-carousel-selected"))&&0!==p.overlay.scrollTop&&r.scrollToElement(p.overlay,p.overlay),function(e){var t=e.el,r=e.attrs,o=t.querySelector("img");if(!o.hasAttribute("data-loaded")){var a=!!r.previewImage,i=r.thumbSize;!a||i&&t.offsetWidth>i.width?o.src=r.src:o.src=r.previewImage,o.setAttribute("itemprop","image"),o.setAttribute("data-loaded",1)}}(p.slides[o]),1!==Number(jetpackCarouselStrings.display_background_image)||p.slides[o].backgroundImage||function(t){var r=t.el;e&&e.slides&&(r=e.slides[e.activeIndex]);var o=t.attrs.originalElement;o.complete&&0!==o.naturalHeight?A(t,r,o):o.onload=function(){A(t,r,o)}}(p.slides[o]),r.hide(p.caption),function(e){var t,o,a,i,n="",l="",s="";if(t=p.overlay.querySelector(".jp-carousel-photo-caption"),o=p.overlay.querySelector(".jp-carousel-caption"),a=p.overlay.querySelector(".jp-carousel-photo-title"),i=p.overlay.querySelector(".jp-carousel-photo-description"),r.hide(t),r.hide(o),r.hide(a),r.hide(i),n=k(e.caption)||"",l=k(e.title)||"",s=k(e.desc)||"",(n||l||s)&&(n&&(t.innerHTML=n,o.innerHTML=n,r.show(t),r.show(o)),r.stripHTML(n)===r.stripHTML(l)&&(l=""),r.stripHTML(n)===r.stripHTML(s)&&(s=""),r.stripHTML(l)===r.stripHTML(s)&&(s=""),s&&(i.innerHTML=s,r.show(i),l||n||(t.innerHTML=r.stripHTML(s),r.show(t))),l)){var c=r.stripHTML(l);a.innerHTML=c,n||(t.innerHTML=c,o.innerHTML=c,r.show(t)),r.show(a)}}({caption:n.attrs.caption,title:n.attrs.title,desc:n.attrs.desc}),function(e){if(!e||1!==Number(jetpackCarouselStrings.display_exif))return!1;var t=p.info.querySelector(".jp-carousel-image-meta ul.jp-carousel-image-exif"),r="";for(var o in e){var a=e[o],i=jetpackCarouselStrings.meta_data||[];if(0!==parseFloat(a)&&a.length&&-1!==i.indexOf(o)){switch(o){case"focal_length":a+="mm";break;case"shutter_speed":a=x(a);break;case"aperture":a="f/"+a}r+="
  • "+jetpackCarouselStrings[o]+"
    "+a+"
  • "}}t.innerHTML=r,t.style.removeProperty("display")}(p.slides[o].attrs.imageMeta),function(e){if(!e)return!1;var r,o=[e.attrs.origWidth,e.attrs.origHeight],a=document.createElement("a");a.href=e.attrs.src.replace(/\?.+$/,""),r=null!==a.hostname.match(/^i[\d]{1}\.wp\.com$/i)?a.href:e.attrs.origFile.replace(/\?.+$/,"");var i=p.info.querySelector(".jp-carousel-download-text"),n=p.info.querySelector(".jp-carousel-image-download");i.innerHTML=t.applyReplacements(jetpackCarouselStrings.download_original,o),n.setAttribute("href",r),n.style.removeProperty("display")}(n),1===Number(jetpackCarouselStrings.display_comments)&&(a=p.slides[o].attrs.commentsOpened,i=p.container.querySelector(".jp-carousel-comment-form-container"),1===parseInt(a,10)?r.fadeIn(i):r.fadeOut(i),q(s),r.hide(p.info.querySelector("#jp-carousel-comment-post-results")));var d=p.info.querySelector(".jp-carousel-pagination");if(d&&p.slides.length>5){var m=o+1;d.innerHTML=""+m+" / "+p.slides.length+""}jetpackCarouselStrings.stats&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?"+jetpackCarouselStrings.stats+"&post="+encodeURIComponent(s)+"&rand="+Math.random()),g(s),window.location.hash=l="#jp-carousel-"+s}function b(){document.body.style.overflow=a,document.documentElement.style.overflow=i,E(),f(),r.emitEvent(p.overlay,"jp_carousel.beforeClose"),window.scrollTo(window.scrollX||window.pageXOffset||0,n||0),e.destroy(),p.isOpen=!1,p.slides=[],p.currentSlide=void 0,p.gallery.innerHTML="",r.fadeOut(p.overlay,(function(){r.emitEvent(p.overlay,"jp_carousel.afterClose")}))}function L(e,t,r){var o=r?e.replace(/.*=([\d]+%2C[\d]+).*$/,"$1"):e.replace(/.*-([\d]+x[\d]+)\..+$/,"$1"),a=o!==e?r?o.split("%2C"):o.split("x"):[t,0];return"9999"===a[0]&&(a[0]="0"),"9999"===a[1]&&(a[1]="0"),a}function x(e){return e>=1?Math.round(10*e)/10+"s":"1/"+Math.round(1/e)+"s"}function k(e){return!e.match(" ")&&e.match("_")?"":e}function q(e,t){var a=void 0===t,i=p.info.querySelector(".jp-carousel-icon-comments .jp-carousel-has-comments-indicator");if(i.classList.remove("jp-carousel-show"),clearInterval(o),e){(!t||t<1)&&(t=0);var n=p.info.querySelector(".jp-carousel-comments"),l=p.info.querySelector("#jp-carousel-comments-loading");r.show(l),a&&(r.hide(n),n.innerHTML="");var s=new XMLHttpRequest,c=jetpackCarouselStrings.ajaxurl+"?action=get_attachment_comments&nonce="+jetpackCarouselStrings.nonce+"&id="+e+"&offset="+t;s.open("GET",c),s.setRequestHeader("X-Requested-With","XMLHttpRequest");var u=function(){r.fadeIn(n),r.fadeOut(l)};s.onload=function(){if(p.currentSlide&&p.currentSlide.attrs.attachmentId===e){var c,d=s.status>=200&&s.status<300;try{c=JSON.parse(s.responseText)}catch(e){}if(!d||!c||!Array.isArray(c))return u();a&&(n.innerHTML="");for(var m=0;m'+g.gravatar_markup+'
    '+g.author_markup+'
    '+g.date_gmt+"
    "+g.content+"
    ",n.appendChild(h),clearInterval(o),o=setInterval((function(){p.container.scrollTop+150>window.innerHeight&&(q(e,t+10),clearInterval(o))}),300)}c.length>0&&(r.show(n),i.innerText=c.length,i.classList.add("jp-carousel-show")),r.hide(l)}},s.onerror=u,s.send()}}function A(e,r,o){var a=t.getBackgroundImage(o);e.backgroundImage=a,r.style.backgroundImage="url("+a+")",r.style.backgroundSize="cover"}function E(){p.commentField&&(p.commentField.value="")}function T(e,o){p.slides=[];var a={width:window.innerWidth,height:window.innerHeight-64};0!==o&&((new Image).src=e[o].getAttribute("data-gallery-src"));var i=!!r.closest(e[0],".tiled-gallery.type-rectangular");Array.prototype.forEach.call(e,(function(e,o){var n=r.closest(e,"a"),l=e.getAttribute("data-orig-file")||e.getAttribute("src-orig"),s=e.getAttribute("data-attachment-id")||e.getAttribute("data-id")||"0",c=document.querySelector('img[data-attachment-id="'+s+'"] + figcaption');c=c?c.innerHTML:e.getAttribute("data-image-caption");var u={originalElement:e,attachmentId:s,commentsOpened:e.getAttribute("data-comments-opened")||"0",imageMeta:r.getJSONAttribute(e,"data-image-meta")||{},title:e.getAttribute("data-image-title")||"",desc:e.getAttribute("data-image-description")||"",mediumFile:e.getAttribute("data-medium-file")||"",largeFile:e.getAttribute("data-large-file")||"",origFile:l||"",thumbSize:{width:e.naturalWidth,height:e.naturalHeight},caption:c||"",permalink:n&&n.getAttribute("href"),src:l||e.getAttribute("src")||""},d=r.closest(e,".tiled-gallery-item"),m=d&&d.querySelector(".tiled-gallery-caption"),g=m&&m.innerHTML;g&&(u.caption=g);var h=function(e){var t=e.getAttribute("data-orig-size")||"";if(t){var r=t.split(",");return{width:parseInt(r[0],10),height:parseInt(r[1],10)}}return{width:e.getAttribute("data-original-width")||e.getAttribute("width")||void 0,height:e.getAttribute("data-original-height")||e.getAttribute("height")||void 0}}(e);if(u.origWidth=h.width||u.thumbSize.width,u.origHeight=h.height||u.thumbSize.height,"undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.generateImgSrc?u.src=wpcom.carousel.generateImgSrc(e,a):u.src=function(e){if("object"!=typeof e&&(e={}),void 0===e.origFile)return"";if(void 0===e.origWidth||void 0===e.maxWidth)return e.origFile;if(void 0===e.mediumFile||void 0===e.largeFile)return e.origFile;var t=document.createElement("a");t.href=e.largeFile;var r=/^i[0-2]\.wp\.com$/i.test(t.hostname),o=L(e.mediumFile,e.origWidth,r),a=L(e.largeFile,e.origWidth,r),i=parseInt(a[0],10),n=parseInt(a[1],10),l=parseInt(o[0],10),s=parseInt(o[1],10);if(e.origMaxWidth=e.maxWidth,e.origMaxHeight=e.maxHeight,void 0!==window.devicePixelRatio&&window.devicePixelRatio>1&&(e.maxWidth=e.maxWidth*window.devicePixelRatio,e.maxHeight=e.maxHeight*window.devicePixelRatio),i>=e.maxWidth||n>=e.maxHeight)return e.largeFile;if(l>=e.maxWidth||s>=e.maxHeight)return e.mediumFile;if(r){var c=e.largeFile.lastIndexOf("?"),u=e.largeFile;return-1!==c&&(u=e.largeFile.substring(0,c),(e.origWidth>e.maxWidth||e.origHeight>e.maxHeight)&&(e.origMaxWidth=2*e.maxWidth,e.origMaxHeight=2*e.maxHeight,u+="?fit="+e.origMaxWidth+"%2C"+e.origMaxHeight)),u}return e.origFile}({origFile:u.src,origWidth:u.origWidth,origHeight:u.origHeight,maxWidth:a.width,maxHeight:a.height,mediumFile:u.mediumFile,largeFile:u.largeFile}),e.setAttribute("data-gallery-src",u.src),"0"!==u.attachmentId){u.title=t.texturize(u.title),u.desc=t.texturize(u.desc),u.caption=t.texturize(u.caption);var f=new Image;f.src=u.src;var v=document.createElement("div");v.classList.add("swiper-slide"),v.setAttribute("itemprop","associatedMedia"),v.setAttribute("itemscope",""),v.setAttribute("itemtype","https://schema.org/ImageObject");var y=document.createElement("div");y.classList.add("swiper-zoom-container"),p.gallery.appendChild(v),v.appendChild(y),y.appendChild(f),v.setAttribute("data-attachment-id",u.attachmentId),v.setAttribute("data-permalink",u.permalink),v.setAttribute("data-orig-file",u.origFile),i&&(u.previewImage=u.src);var w={el:v,attrs:u,index:o};p.slides.push(w)}}))}function H(e,t){if(!window.Swiper670){var o=document.querySelector("#jp-carousel-loading-overlay");r.show(o);var a=document.createElement("script");return a.id="jetpack-carousel-swiper-js",a.src=window.jetpackSwiperLibraryPath.url,a.async=!0,a.onload=function(){r.hide(o),C(e,t)},a.onerror=function(){r.hide(o)},void document.head.appendChild(a)}C(e,t)}function C(t,o){var l,s={imgSelector:".gallery-item [data-attachment-id], .tiled-gallery-item [data-attachment-id], img[data-attachment-id], img[data-id]",startIndex:0},c=r.getJSONAttribute(t,"data-carousel-extra");if(c&&(y(),!p.isOpen)){for(var u in p.isOpen=!0,a=getComputedStyle(document.body).overflow,document.body.style.overflow="hidden",i=getComputedStyle(document.documentElement).overflow,document.documentElement.style.overflow="hidden",n=window.scrollY||window.pageYOffset||0,p.container.setAttribute("data-carousel-extra",JSON.stringify(c)),m(["open","view_image"]),o||{})s[u]=o[u];-1===s.startIndex&&(s.startIndex=0),r.emitEvent(p.overlay,"jp_carousel.beforeOpen"),p.gallery.innerHTML="",p.overlay.style.opacity=1,p.overlay.style.display="block",T(t.querySelectorAll(s.imgSelector),s.startIndex),(e=new window.Swiper670(".jp-carousel-swiper-container",{centeredSlides:!0,zoom:!0,loop:p.slides.length>1,enabled:p.slides.length>1,pagination:{el:".jp-swiper-pagination",clickable:!0},navigation:{nextEl:".jp-swiper-button-next",prevEl:".jp-swiper-button-prev"},initialSlide:s.startIndex,on:{init:function(){S(s.startIndex)}},preventClicks:!1,preventClicksPropagation:!1,preventInteractionOnTransition:!r.isTouch(),threshold:5})).on("slideChange",(function(e){S(0===e.activeIndex?p.slides.length-1:e.activeIndex===p.slides.length+1?0:e.activeIndex-1),p.overlay.classList.remove("jp-carousel-hide-controls")})),e.on("zoomChange",(function(e,t){t>1&&p.overlay.classList.add("jp-carousel-hide-controls"),1===t&&p.overlay.classList.remove("jp-carousel-hide-controls")})),e.on("doubleTap",(function(e){if(clearTimeout(l),1===e.zoom.scale)var t=setTimeout((function(){p.overlay.classList.remove("jp-carousel-hide-controls"),clearTimeout(t)}),150)})),e.on("tap",(function(){e.zoom.scale>1&&(l=setTimeout((function(){p.overlay.classList.toggle("jp-carousel-hide-controls")}),150))})),r.fadeIn(p.overlay,(function(){r.emitEvent(p.overlay,"jp_carousel.afterOpen")}))}}document.body.addEventListener("click",(function(e){if(window.CSS&&window.CSS.supports&&window.CSS.supports("display","grid")){var t,o=e.target,a=r.closest(o,c);if(a){if(!(t=a)||!t.getAttribute("data-carousel-extra"))return;var i=o.parentElement,n=i.parentElement,l=null;if(n&&n.classList.contains("wp-block-image")?l=i.getAttribute("href"):i&&i.classList.contains("wp-block-image")&&i.querySelector(":scope > a")&&(l=i.querySelector(":scope > a").getAttribute("href")),l&&l.split("?")[0]!==o.getAttribute("data-orig-file").split("?")[0]&&l!==o.getAttribute("data-permalink"))return;if(i.classList.contains("gallery-caption"))return;if(r.matches(i,"figcaption"))return;document.documentElement.style.height="auto",e.preventDefault(),e.stopPropagation();var s=r.closest(o,d),u=Array.prototype.indexOf.call(a.querySelectorAll(d),s);H(a,{startIndex:u})}}})),1===Number(jetpackCarouselStrings.single_image_gallery)&&(j(),document.body.addEventListener("is.post-load",(function(){j()}))),window.addEventListener("hashchange",(function(){var t=/jp-carousel-(\d+)/;if(window.location.hash&&t.test(window.location.hash)){if(window.location.hash!==l||!p.isOpen)if(window.location.hash&&p.gallery&&!p.isOpen&&history.back)history.back();else{l=window.location.hash;for(var r,o,a=window.location.hash.match(t),i=parseInt(a[1],10),n=document.querySelectorAll(c),s=0;s0}});else{var t=function(t){for(var e=window.document,o=i(e);o;)o=i(e=o.ownerDocument);return e}(),e=[],o=null,n=null;s.prototype.THROTTLE_TIMEOUT=100,s.prototype.POLL_INTERVAL=null,s.prototype.USE_MUTATION_OBSERVER=!0,s._setupCrossOriginUpdater=function(){return o||(o=function(t,o){n=t&&o?l(t,o):{top:0,bottom:0,left:0,right:0,width:0,height:0},e.forEach((function(t){t._checkForIntersections()}))}),o},s._resetCrossOriginUpdater=function(){o=null,n=null},s.prototype.observe=function(t){if(!this._observationTargets.some((function(e){return e.element==t}))){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(t.ownerDocument),this._checkForIntersections()}},s.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter((function(e){return e.element!=t})),this._unmonitorIntersections(t.ownerDocument),0==this._observationTargets.length&&this._unregisterInstance()},s.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},s.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},s.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter((function(t,e,o){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==o[e-1]}))},s.prototype._parseRootMargin=function(t){var e=(t||"0px").split(/\s+/).map((function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}}));return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},s.prototype._monitorIntersections=function(e){var o=e.defaultView;if(o&&-1==this._monitoringDocuments.indexOf(e)){var n=this._checkForIntersections,r=null,s=null;this.POLL_INTERVAL?r=o.setInterval(n,this.POLL_INTERVAL):(h(o,"resize",n,!0),h(e,"scroll",n,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in o&&(s=new o.MutationObserver(n)).observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),this._monitoringDocuments.push(e),this._monitoringUnsubscribes.push((function(){var t=e.defaultView;t&&(r&&t.clearInterval(r),c(t,"resize",n,!0)),c(e,"scroll",n,!0),s&&s.disconnect()}));var u=this.root&&(this.root.ownerDocument||this.root)||t;if(e!=u){var a=i(e);a&&this._monitorIntersections(a.ownerDocument)}}},s.prototype._unmonitorIntersections=function(e){var o=this._monitoringDocuments.indexOf(e);if(-1!=o){var n=this.root&&(this.root.ownerDocument||this.root)||t,r=this._observationTargets.some((function(t){var o=t.element.ownerDocument;if(o==e)return!0;for(;o&&o!=n;){var r=i(o);if((o=r&&r.ownerDocument)==e)return!0}return!1}));if(!r){var s=this._monitoringUnsubscribes[o];if(this._monitoringDocuments.splice(o,1),this._monitoringUnsubscribes.splice(o,1),s(),e!=n){var h=i(e);h&&this._unmonitorIntersections(h.ownerDocument)}}}},s.prototype._unmonitorAllIntersections=function(){var t=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var e=0;e=0&&m>=0&&{top:c,bottom:a,left:f,right:d,width:g,height:m}||null),!v)break;_=_&&p(_)}return v}},s.prototype._getRootRect=function(){var e;if(this.root&&!d(this.root))e=u(this.root);else{var o=d(this.root)?this.root:t,n=o.documentElement,i=o.body;e={top:0,left:0,right:n.clientWidth||i.clientWidth,width:n.clientWidth||i.clientWidth,bottom:n.clientHeight||i.clientHeight,height:n.clientHeight||i.clientHeight}}return this._expandRectByRootMargin(e)},s.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map((function(e,o){return"px"==e.unit?e.value:e.value*(o%2?t.width:t.height)/100})),o={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return o.width=o.right-o.left,o.height=o.bottom-o.top,o},s.prototype._hasCrossedThreshold=function(t,e){var o=t&&t.isIntersecting?t.intersectionRatio||0:-1,n=e.isIntersecting?e.intersectionRatio||0:-1;if(o!==n)for(var i=0;i0;)s(n[0])}function c(e){for(let t=0;t0&&(i.unobserve(n.target),s(n.target))}0===n.length&&i.disconnect()}function l(){if(!a&&(n.length>0||t.length>0)){a=document.createElement("div"),a.id="loadingWarning",a.style.fontWeight="bold",a.innerText=jetpackLazyImagesL10n.loading_warning;const e=document.createElement("style");e.innerHTML="#loadingWarning { display: none; }\n@media print {\n#loadingWarning { display: block; }\nbody > #loadingWarning ~ * { display: none !important; }\n}",a.appendChild(e),o.insertBefore(a,o.firstChild)}n.length>0&&r(),a&&alert(jetpackLazyImagesL10n.loading_warning)}function s(e){let a;if(!(e instanceof HTMLImageElement))return;const i=e.getAttribute("data-lazy-srcset"),o=e.getAttribute("data-lazy-sizes");e.removeAttribute("data-lazy-srcset"),e.removeAttribute("data-lazy-sizes"),e.removeAttribute("data-lazy-src"),e.classList.add("jetpack-lazy-image--handled"),e.setAttribute("data-lazy-loaded",1),o&&e.setAttribute("sizes",o),i?e.setAttribute("srcset",i):e.removeAttribute("srcset"),e.setAttribute("loading","eager"),t.push(e);const d=n.indexOf(e);d>=0&&n.splice(d,1),e.complete?g.call(e,null):(e.addEventListener("load",g,{once:!0}),e.addEventListener("error",g,{once:!0}));try{a=new Event("jetpack-lazy-loaded-image",{bubbles:!0,cancelable:!0})}catch(e){a=document.createEvent("Event"),a.initEvent("jetpack-lazy-loaded-image",!0,!0)}e.dispatchEvent(a)}function g(){const e=t.indexOf(this);e>=0&&t.splice(e,1),a&&0===n.length&&0===t.length&&(a.parentNode.removeChild(a),a=null)}o&&(o.addEventListener("is.post-load",d),o.addEventListener("jetpack-lazy-images-load",d))};"interactive"===document.readyState||"complete"===document.readyState?e():document.addEventListener("DOMContentLoaded",e)}();; // watch ads on page /* var adTimes = {}; let adObserver = new IntersectionObserver(function(entries, observer) { entries.forEach(function(entry) { // 50% of ad is viewable if (entry.isIntersecting && entry.intersectionRatio > 0.5) { // ad viewable for second time if (entry.target.getAttribute('id') in adTimes) { renderAd(entry.target.getAttribute('data-adunit'), entry.target.getAttribute('data-size'), entry.target.getAttribute('id'), true); // ad viewable for the first time } else { renderAd(entry.target.getAttribute('data-adunit'), entry.target.getAttribute('data-size'), entry.target.getAttribute('id')); } adTimes[entry.target.getAttribute('id')] = entry.time; console.log(entry) if (entry.target.classList.contains('ad_pending')) { renderAd(entry.target.getAttribute('data-adunit'), entry.target.getAttribute('data-size'), entry.target.getAttribute('id')); entry.target.classList.remove('ad_pending'); } } }); }, { threshold: 0.5, root: null, rootMargin: '0px' }); adObserver.observe(document.querySelector('.cos_ad')); */ // ADS let adUnitPrefix = '/134312942/'; let adRefreshDelay = 20000; var adDivIds = {}; var dfpAdDivIds = {}; let googleAdsSizeArray = { 'billboard': [970, 250], 'leaderboard': [[728, 90], [468, 60]], 'leaderboard_small': [468, 60], 'skyscraper': [300, 600], 'skyscraper_mobile': [300, 600], 'square': [ [300, 250], [336, 280] ], 'mobile': [ [320, 50], [300, 50], [320, 100] ], 'mobile_adhesion': [ [320, 50], [300, 50] ], 'mobile_bit': [ [320, 50], [320, 152] ], 'mobile_apple': [ [320, 50], [320, 80] ], 'native_in_content': ['fluid'], 'nativo_mobile_mpu': [336, 280], 'short_billboard': [750, 250], 'out_1x1': [1, 1] }; /* let googleAdsBidArray = { 'leaderboard': [{ bidder: 'appnexus', params: { placementId: '11832878' } }] } */ function prebidConfig() { // set prebid config pbjs.que.push(function() { pbjs.setConfig({ useBidCache: true, userSync: { filterSettings: { iframe: { bidders: '*', filter: 'include' }, image: { bidders: '*', filter: 'include' } }, syncsPerBidder: 3, // and no more than 3 syncs at a time syncDelay: 6000, // 6 seconds after the auction }, consentManagement: { gdpr: { cmpApi: 'iab', allowAuctionWithoutConsent: false, // suppress auctions if there's no GDPR consent string timeout: 3000 // GDPR timeout 3000ms }, usp: { timeout: 100 // US Privacy timeout 100ms } }, bidderSequence: 'random', enableSendAllBids: false, priceGranularity: 'high', publisherDomain: window.location.origin }); }); } function setupAllDfpAds() { var dfpElements = document.getElementsByClassName("cos_dfp_ad"); for (var i = 0; i < dfpElements.length; i++) { if (dfpElements[i].getAttribute('id') in dfpAdDivIds) { continue; } setupDfpAd(dfpElements[i].getAttribute('data-adunit'), dfpElements[i].getAttribute('data-size'), dfpElements[i].getAttribute('id')); dfpAdDivIds[dfpElements[i].getAttribute('id')] = true; } } function setupDfpAd(adUnit, size, divId) { //cX.callQueue.push(['invoke', function() { googletag.cmd.push(function() { var slot = googletag.defineSlot(adUnitPrefix + adUnit, googleAdsSizeArray[size], divId); // all other targeting if (googleAdsTargetingArray) { for (var i = 0; i < googleAdsTargetingArray.length; i++) { slot.setTargeting(googleAdsTargetingArray[i][0], googleAdsTargetingArray[i][1]); } } slot.addService(googletag.pubads()); googletag.enableServices(); googletag.pubads().refresh([slot]); }); //}]); } setupAllDfpAds(); function setupAd(adUnit, size, divId) { googletag.cmd.push(function() { if (divId in adDivIds) return; var bidData; // normalize bid data if (size in googleAdsBidArray) { if (googleAdsBidArray[size].hasOwnProperty('mediaTypes')) { bidData = googleAdsBidArray[size]; } else { bidData = { code: adUnitPrefix + adUnit, mediaTypes: { banner: { sizes: googleAdsSizeArray[size] } }, bids: googleAdsBidArray[size] }; } } // add bid data to prebid pbjs.que.push(function() { pbjs.addAdUnits(bidData); }); // create google ad slot var slot = googletag.defineSlot(adUnitPrefix + adUnit, googleAdsSizeArray[size], divId); // ad type targeting if (bidData != null) { if (bidData.hasOwnProperty('video')) { slot.setTargeting('adType', 'video'); } else { slot.setTargeting('adType', 'banner'); } } slot.addService(googletag.pubads()); // all other targeting if (googleAdsTargetingArray) { for (var i = 0; i < googleAdsTargetingArray.length; i++) { googletag.pubads().setTargeting(googleAdsTargetingArray[i][0], googleAdsTargetingArray[i][1]); } } trackAd(divId, slot, bidData, true); }); } function refreshAd(divId) { trackAd(divId); // do this immediately otherwise ads will refresh twice cuz of the delay // fetch bids for display ad units if (adDivIds[divId]['slot'].getTargeting('adType') != 'video') { pbjs.que.push(function() { //cX.callQueue.push(['invoke', function() { googletag.cmd.push(function() { pbjs.requestBids({ timeout: 1000, adUnitCodes: [adDivIds[divId]['slot'].getAdUnitPath()], bidsBackHandler: function() { pbjs.setTargetingForGPTAsync([adDivIds[divId]['slot'].getAdUnitPath()]); googletag.pubads().refresh([adDivIds[divId]['slot']]); //trackAd(divId); } }); }); //}]); }); } else { // only refresh the video ad unit without fetching any new bids pbjs.que.push(function() { //cX.callQueue.push(['invoke', function() { googletag.cmd.push(function() { pbjs.setTargetingForGPTAsync([adDivIds[divId]['slot'].getAdUnitPath()]); googletag.pubads().refresh([adDivIds[divId]['slot']]); //trackAd(divId); }); //}]); }); } } function trackAd(divId, slot = null, bidData = null, initial = false) { if (!(divId in adDivIds)) { adDivIds[divId] = { time: null, slot: null, viewed: false }; } adDivIds[divId]['time'] = new Date().getTime(); if (slot !== null) { adDivIds[divId]['slot'] = slot; } if (bidData !== null) { adDivIds[divId]['bidData'] = bidData; } if (initial) { adDivIds[divId]['initial'] = true; } else { adDivIds[divId]['initial'] = false; } } function adElapsed(divId, milliseconds) { return (new Date().getTime() - adDivIds[divId]['time']) >= milliseconds; } function adMonitor() { var elements = document.getElementsByClassName("cos_ad"); for (var i = 0; i < elements.length; i++) { // remove auto refresh for 300x250 sticky /* if (elements[i].getAttribute('data-adunit') === 'COS_DT_300_250_STICKY') { elements[i].classList.remove('ad_refresh'); }*/ // add to setup if not available if (!(elements[i].getAttribute('id') in adDivIds)) { setupAd(elements[i].getAttribute('data-adunit'), elements[i].getAttribute('data-size'), elements[i].getAttribute('id')); } else { // if visible in viewport if (isVisible(elements[i], 0.5)) { //console.log('impression VISIBLE', elements[i].getAttribute('id')) // second time in view and has ad_refresh class if (adDivIds[elements[i].getAttribute('id')]['initial'] == false && elements[i].classList.contains('ad_refresh')) { if (adDivIds[elements[i].getAttribute('id')]['viewed'] == true) { adDivIds[elements[i].getAttribute('id')]['viewed'] = false; refreshAd(elements[i].getAttribute('id')); } // first time in view } else if (adDivIds[elements[i].getAttribute('id')]['initial'] == true) { refreshAd(elements[i].getAttribute('id')); } } } } } prebidConfig(); // Monitor all ads every second let adInterval = setInterval(adMonitor, 500); window.onunload = function() { clearInterval(adInterval); } // resize ad slot on render to fit googletag.cmd.push(function() { googletag.pubads().addEventListener('slotRenderEnded', function(event) { var size = event.size; if(size === null) return; var slot = event.slot; var slotDiv = document.getElementById(slot.getSlotElementId()); if (size[0] > slotDiv.clientWidth) { slotDiv.style.width = size[0] + 'px'; slotDiv.parentElement.style.width = slotDiv.style.width; slotDiv.style.height = size[1] + 'px'; slotDiv.parentElement.style.height = slotDiv.style.height; } }); }); // impression viewable event googletag.cmd.push(function() { googletag.pubads().addEventListener('impressionViewable', function(event) { var slot = event.slot; if (document.getElementById(slot.getSlotElementId()).classList.contains('ad_refresh')) { setTimeout(function() { adDivIds[slot.getSlotElementId()]['viewed'] = true; }, adRefreshDelay); //console.log("impression VIEWABLE fired", slot.getSlotElementId()); } // leaderboard sticky var lboard = document.getElementById(slot.getSlotElementId()).closest('.bg-white'); if (lboard) lboard.classList.remove('leaderboard-sticky'); }); }); function isVisible(el, visibleRatio) { var visible = horizontal(el) * vertical(el); return visible > visibleRatio; } function horizontal(el) { var windowWidth = window.innerWidth var elemLeft = el.getBoundingClientRect().left var elemRight = el.getBoundingClientRect().right var elemWidth = elemRight - elemLeft // Not viewable, below viewport if (elemLeft > windowWidth) return 0; // Not viewable, above the viewport else if (elemRight <= 0) return 0; // Element is completely visible else if (elemLeft >= 0 && elemRight <= windowWidth) return 1; // Top and bottom of element truncated else if (elemLeft < 0 && elemRight > windowWidth) return windowWidth / elemWidth; // Top of element is truncated else if (elemLeft < 0 && elemRight <= windowWidth) return elemRight / elemWidth; // Bottom of element is truncated else if (elemLeft >= 0 && elemRight > windowWidth) return (windowWidth - elemLeft) / elemWidth; // Error else return 0; } function vertical(el) { var windowHeight = window.innerHeight var elemTop = el.getBoundingClientRect().top var elemBottom = el.getBoundingClientRect().bottom var elemHeight = elemBottom - elemTop // Not viewable, below viewport if (elemTop > windowHeight) return 0; // Not viewable, above the viewport else if (elemBottom <= 0) return 0; // Element is completely visible else if (elemTop >= 0 && elemBottom <= windowHeight) return 1; // Top and bottom of element truncated else if (elemTop < 0 && elemBottom > windowHeight) return windowHeight / elemHeight; // Top of element is truncated else if (elemTop < 0 && elemBottom <= windowHeight) return elemBottom / elemHeight; // Bottom of element is truncated else if (elemTop >= 0 && elemBottom > windowHeight) return (windowHeight - elemTop) / elemHeight; // Error else return 0; } function loadOnDemand(url, id, type) { // already exists if (document.querySelectorAll('#' + id).length > 0) return; if (!type) return; var s; if (type == 'script') { s = document.createElement("script"); s.src = url; s.id = id; } else { s = document.createElement("link"); s.rel = 'stylesheet'; s.href = url; s.id = id; } // append to head in dom let head = document.head || document.getElementsByTagName('head')[0]; head.insertBefore(s, head.firstChild); } function delayScriptsOnLoad() { loadOnDemand('//cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css?ver=5.4.2', 'animate-style', 'style'); } // delay loading of certain resources var raf = requestAnimationFrame || mozRequestAnimationFrame || webkitRequestAnimationFrame || msRequestAnimationFrame; if (raf) raf(delayScriptsOnLoad); else window.addEventListener('load', delayScriptsOnLoad); function delayIframe(iframeID, iframeURL) { setTimeout(function(){ var el = document.querySelectorAll('[data-delay="' + iframeID + '"]'); if (el.length > 0) el[0].src = iframeURL; }, 1000); } /* sticky leaderboard */ /* function sticky_leaderboard() { setTimeout(function(){ var ad_leaderboard = document.querySelector(".header-global .desktop-only.bg-white.leaderboard-sticky"); if (!ad_leaderboard) return; ad_leaderboard.classList.remove("leaderboard-sticky"); }, 3000) } sticky_leaderboard(); */ /* var has_stickied_leaderboard = false; window.addEventListener('scroll', sticky_leaderboard); function sticky_leaderboard() { if (has_stickied_leaderboard) return; var ad_leaderboard = document.querySelector(".header-global .ad.horizontal.desktop-only"); if (!ad_leaderboard) return; var post_content = document.querySelector(".module.posts"); if (!post_content) return; var ad_sticky = ad_leaderboard.offsetTop - 100; if (window.pageYOffset > ad_sticky) { ad_leaderboard.classList.add("leaderboard-sticky"); has_stickied_leaderboard = true; setTimeout(function(){ ad_leaderboard.classList.remove("leaderboard-sticky"); }, 3000) } } */ /* sticky sidebar ads */ window.addEventListener('scroll', sticky_sidebar_ads); function sticky_sidebar_ads() { var article_content = document.querySelector("article.content-col"); if (!article_content) return; var article_content_height = article_content.offsetHeight; const boxes = document.querySelectorAll('.sticky-container'); boxes.forEach(box => { box.style.height = article_content_height/2 + 'px'; }); } /* window.addEventListener('scroll', sticky_sidebar_ads); function sticky_sidebar_ads() { var ad_sidebar_rhs = document.querySelector("aside .sidebar-rhs"); var ad_sidebar_square = document.querySelector("aside .sidebar-square"); if (!ad_sidebar_rhs && !ad_sidebar_square) return; // article height may change on infinite scroll var buffer = 130; var article_content_height = document.querySelector("article.content-col").offsetHeight; var sidebar = document.querySelector("aside.aside-news-post"); sidebar.style.height = article_content_height + 'px'; ad_sidebar_rhs.style.height = article_content_height/4 + 'px'; ad_sidebar_square.style.height = article_content_height/6 + 'px'; ad_sidebar_rhs.classList.remove("rhs-fixed"); ad_sidebar_square.classList.remove("rhs-fixed"); if (window.pageYOffset > ad_sidebar_square.offsetTop - buffer) { ad_sidebar_square.classList.add("rhs-fixed"); } else if (window.pageYOffset > ad_sidebar_rhs.offsetTop - buffer) { ad_sidebar_rhs.classList.add("rhs-fixed"); } else { } } */ // video player /* var searchInput = document.querySelector('.algolia__input'); searchInput.addEventListener('focus', function(e) { loadScriptOnDemand('/path/to/search-script.js'); }); var script = document.querySelector('#hljs'); script.addEventListener('load', function() { hljs.initHighlightingOnLoad(); }); */ /* function loadScript(url) { return new Promise(function(resolve, reject) { var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = url; script.onload = resolve; script.onerror = reject; let head = document.head || document.getElementsByTagName('head')[0]; head.insertBefore(script, head.firstChild); }) } loadScript('') .then(function() { console.log('Loaded!'); }) .catch(function(err) { console.error('Something went wrong!', err); }); */; /** * Check if key exists in local storage * @param string key * @return boolean */ function localStorageHas (key) { var item = localStorage.getItem(key); return ( item !== null ); } /** * Retrive an object from local storage. * @param string key * @return mixed */ function localStorageGet (key) { var item = localStorage.getItem(key); if ( ! item ) return; if ( item[0] === '{' || item[0] === '[' ) return JSON.parse(item); return item; } /** * Save some value to local storage. * @param string key * @param string value */ function localStorageSet (key, value) { if ( value === undefined ) $.error("Can't store undefinded value"); if ( typeof(value) === 'object' || typeof(value) === 'array' ) { value = JSON.stringify(value); } if ( typeof(value) !== 'string' ) $.error("Can't store unrecognized format value"); localStorage.setItem(key, value); } /** * Remove element from local storage. * @param string key */ function localStorageRemove (key) { localStorage.removeItem(key); }; window.jQuery = window.$ = jQuery; $(document).ready(function() { /* // FIXED TOP NAV $(document).on("scroll", function() { if ($(document).scrollTop() > 400) { $(".fixed-top").addClass("scrolled slideInDown"); } else { $(".fixed-top").removeClass("scrolled"); } }); // FIXED TOP CATEGORIES NAV INNER PAGE $(document).on("scroll", function() { if ($(document).scrollTop() > 1200) { $(".cats-bar").addClass("scrolled slideInDown"); } else { $(".cats-bar").removeClass("scrolled"); } }); */ // MENU $(".but-menu").click(function() { $("#menu").addClass("reveal slideInLeft"); $('html').css('overflow', 'hidden'); $('body').bind('touchmove', function(e) { e.preventDefault() }); }); $(".menu-close").click(function() { $("#menu").removeClass("reveal"); $('html').css('overflow', 'scroll'); $('body').unbind('touchmove'); }); // MENU CATS $(".menu-item").click(function() { $(".menu-item").toggleClass("open").not(this).removeClass("open"); }); $(".menu-news").click(function() { $(".sub-reviews, .sub-features, .sub-live, .sub-podcasts, .sub-videos, .sub-heavy, .sub-shop").hide(); $(".sub-news").toggle(); }); $(".menu-reviews").click(function() { $(".sub-news, .sub-features, .sub-live, .sub-podcasts, .sub-videos, .sub-heavy, .sub-shop").hide(); $(".sub-reviews").toggle(); }); $(".menu-features").click(function() { $(".sub-news, .sub-reviews, .sub-live, .sub-podcasts, .sub-videos, .sub-heavy, .sub-shop").hide(); $(".sub-features").toggle(); }); $(".menu-live").click(function() { $(".sub-news, .sub-reviews, .sub-podcasts, .sub-videos, .sub-heavy, .sub-shop").hide(); $(".sub-live").toggle(); }); $(".menu-podcasts").click(function() { $(".sub-news, .sub-reviews, .sub-features, .sub-live, .sub-videos, .sub-heavy, .sub-shop").hide(); $(".sub-podcasts").toggle(); }); $(".menu-videos").click(function() { $(".sub-news, .sub-reviews, .sub-features, .sub-live, .sub-heavy, .sub-shop").hide(); $(".sub-videos").toggle(); }); $(".menu-heavy").click(function() { $(".sub-news, .sub-reviews, .sub-features, .sub-live, .sub-podcasts .sub-videos, .sub-shop").hide(); $(".sub-heavy").toggle(); }); $(".menu-shop").click(function() { $(".sub-news, .sub-reviews, .sub-features, .sub-live, .sub-podcasts .sub-videos, .sub-heavy").hide(); $(".sub-shop").toggle(); }); // SEARCH $(".but-search").click(function() { $("#search-bar").addClass("reveal slideInDown"); }); $(".search-close").click(function() { $("#search-bar").removeClass("reveal"); }); $("#search_404").click(function() { $("#search-bar").addClass("reveal slideInDown"); }); // FIXED FILTERS / TRENDING BAR ON SCROLL $('.fixed-bar.trending-bar').scrollToFixed({ marginTop: 130 }); $('.mobile-bar-drop').scrollToFixed({ marginTop: 130 }); // FIXED AD ON SCROLL /* $('.fixed-ad-scroll').scrollToFixed({ marginTop: 140, zIndex: 10, limit: function() { var limit = $('#footer').offset().top - $('.fixed-ad-scroll').outerHeight(true) - 0; return limit; } }); */ /* $('.fixed-ad-scroll-bottom').scrollToFixed({ marginTop:400, limit: function() { var limit; if ($('.post-related').length > 0) { limit = $('.post-related').offset().top - $('.fixed-ad-scroll-bottom').outerHeight(true) - 80; } else { limit = $('#footer').offset().top - $('.fixed-ad-scroll-bottom').outerHeight(true) - 40; } return limit; } }); */ // FIXED SOCIAL ON SCROLL /* $('.social-follow.fixed').scrollToFixed({ marginTop: 200, limit: function() { var limit = $('.post-tags').offset().top - $('.social-follow.fixed').outerHeight(true) - 40; return limit; } }); */ // FIXED VIDEO ON SCROLL /* $('.fixed-watch-video').scrollToFixed({ marginTop: 200, limit: function() { var limit; if ($('.post-related').length > 0) { limit = $('.post-related').offset().top - $('.fixed-watch-video').outerHeight(true) - 80; } else { limit = $('#footer').offset().top - $('.fixed-watch-video').outerHeight(true) - 40; } return limit; } }); */ // FIXED SQUARE ON SCROLL /* $('.fixed-ad-aside').scrollToFixed({ marginTop: 200, limit: function() { var limit; if ($('.post-related').length > 0) { limit = $('.post-related').offset().top - $('.fixed-ad-aside').outerHeight(true) - 80; } else { limit = $('#footer').offset().top - $('.fixed-ad-aside').outerHeight(true) - 40; } if ($('.fixed-watch-video').length > 0) { limit += $('.fixed-watch-video').outerHeight(true); } return limit; } }); */ // READER'S RATING $(document).on("scroll", function(){ if ($(document).scrollTop() > 200){ $(".reader-rating").addClass("scrolled bounceInUp"); } else { $(".reader-rating").removeClass("scrolled"); } }); // MOBILE BAR DROP $(".open-drop").click(function() { $(".open-drop").toggleClass("open"); }); $(".open-drop").click(function() { $(".mobile-bar-drop ul").toggle(); }); // VIDEOS PLAYLIST $(".video-playlist a").click(function() { var parent_div = $(this).closest('div'); var src = $(parent_div).attr('data-src'); var type = $(parent_div).attr('data-type'); var poster = $(parent_div).attr('data-poster'); var title = $(parent_div).attr('data-title'); var videoObj = $(this).parents(".mod-playlist").find(".video-js"); if (videoObj.length !== 0) { var player = videojs(videoObj.attr('id')); if(src == player.src()) { return; } if (player.ads && player.ads.isInAdMode()) { return; } player.poster(poster); player.src([{type: type, src: src }]); player.play(); player.on('loadstart', function(event) { $('#' + player.id() + '_title').text(title) }); $(this).parents('.col-video-scrollable').find('p.play-now a').text('Play Now'); $(this).parents('.video-playlist').find('p.play-now a').text('Now Playing'); } }); // VIDEOS Playing Now Text $("p.play-now a").first().text('Now Playing'); // MOBILE ADHESION //$(".mobile-adhesion").delay(5000).fadeOut('slow'); /* // RENDER PENDING ADS function renderPendingAds() { $(".ad_pending").each(function(i, e){ renderAd($(e).attr('data-adunit'), $(e).attr('data-size'), $(e).attr('id')); $(e).removeClass('ad_pending'); }); } // REGULAR ADS renderPendingAds(); // INFINITE SCROLL ADS $(document.body).on('post-load', function () { renderPendingAds(); }); */ resizeIframes(); }); // IFRAME RESIZING function resizeIframes() { $("iframe").each(function(i, v){ var domains = ['spotify', 'apple', 'vevo']; if(typeof $(v).attr('src') !== 'undefined') { $(domains).each(function(di, dv) { if ($(v).attr('src').indexOf(dv) !== -1) { $(v).attr('height', 450); } }); if ($(v).attr('src').indexOf('anchor') !== -1) { $(v).attr('height', 160); $(v).attr('scrolling', 'no'); } } }); } // ajax load more - next page in infinite scroll window.almComplete = function(alm){ resizeIframes(); setupAllDfpAds(); //setupIframeOnDemand(); if (typeof initGallery === 'function') initGallery(); // actual code in partials/common/_gallery.php } $(document).ready(function(){ if (typeof initGallery === 'function') initGallery(); // actual code in partials/common/_gallery.php }); window.almUrlUpdate = function(permalink, type){ gtag("event", "page_view", { page_path: window.location.pathname, custom_map: { 'dimension1': 'Categories', 'dimension2': 'Tags', 'dimension3': 'Authors', 'dimension4': 'Artists', 'dimension6': 'page_id', 'dimension7': 'Primary Category', 'dimension9': 'Paged Article' } }); } // iframe on demand for youtube function setupIframeOnDemand() { $(".embed-youtube-on-demand").click(function() { var id = $(this).children('img').attr('data-id'); var iframe = ''; $(this).replaceWith(iframe); }); } $(function() { var url = new URL(window.location.href); if (url.searchParams.get('app')) { $("a").attr('href', function(index, item) { if (item) return item + (item.indexOf('?') != -1 ? "&app=true" : "?app=true"); }); } var subId3 = ''; if (subId3 = url.searchParams.get('subId3')) { $("a").attr('href', function(index, item) { if (item && item.indexOf('ticketmaster') !== -1) return item + (item.indexOf('?') != -1 ? "&subId3=" + subId3 : "?subId3=" + subId3); }); } });;