vendor: 4,215 bytes, line 1
1(()=>{var t={14:(t,e,i)=>{"use strict";i.d(e,{Z:()=>u});var n=i(191),o=i.n(n),s=i(261),d=i.n(s),r=i(160),a=i.n(r),l=new URL(i(240),i.b),c=d()(o()),h=a()(l);c.push([t.id,`.wordads-ad-wrapper {\n position: static;\n font: 11px Arial, sans-serif;\n letter-spacing: 1px;\n text-decoration: none;\n max-width: 100%;\n margin: 25px auto;\n padding: 0;\n display: flex;\n justify-content: center;\n}\n\n.wordads-ad-wrapper--sidebar,\n.wordads-ad-wrapper--gutenberg_skyscraper,\n.wordads-ad-wrapper--gutenberg_mobile_leaderboard {\n font-size: 8px;\n}\n\n.wordads-ad-title {\n margin: 0 auto 5px\n}\n\n.wordads-ad-controls {\n margin: 5px auto 0;\n text-align: right\n}\n\n/* Hide title and controls initially */\n.wordads-ad-title,\n.wordads-ad-controls {\n visibility: hidden;\n}\n\n.wordads-ad-controls span {\n cursor: pointer\n}\n\n.wordads-ad {\n margin: 0 auto;\n width: fit-content;\n max-width: 100%;\n overflow: hidden;\n}\n\n.wordads-ad iframe {\n margin: 0;\n padding: 0\n}\n\n.wordads-ad.wordads-ad-responsive {\n width: 100%;\n max-width: unset\n}\n\n.wordads-ad-sticky-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n margin: auto;\n position: fixed;\n transition: transform .2s ease-in-out;\n user-select: none;\n padding: 5px 0;\n z-index: 49999\n}\n.wordads-ad-wrapper--bottom_sticky.wordads-ad-sticky-wrapper {\n right: 0;\n left: 0;\n bottom: 0;\n background: transparent;\n transform: translate(0, 0);\n}\n\n.wordads-ad-wrapper--bottom_sticky.wordads-ad-sticky-wrapper.ad-slot-filled {\n background: #f1f1f1;\n}\n\n.wordads-ad-wrapper--sidebar_sticky_right.wordads-ad-sticky-wrapper {\n width: fit-content;\n min-width: 120px;\n top: max(calc(var(--wp-admin--admin-bar--height, 0px) + 24px), 10%);\n right: 20px;\n}\n\n.wordads-ad-wrapper--sidebar_sticky_right .wordads-ad-content {\n border: 1px solid #f1f1f1;\n margin-left: -1px;\n}\n\n.wordads-ad-sticky-close-btn {\n width: 28px;\n height: 28px;\n position: absolute;\n box-sizing: content-box;\n cursor: pointer;\n overflow: hidden;\n background-size: 28px;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(${h})\n}\n\n.wordads-ad-wrapper--bottom_sticky .wordads-ad-sticky-close-btn {\n top: -14px;\n left: .75rem;\n}\n\n.wordads-ad-wrapper--sidebar_sticky_right .wordads-ad-sticky-close-btn {\n top: -14px;\n right: 0;\n}\n\n.wordads-ad-sticky {\n width: auto;\n max-width: initial;\n max-height: inherit;\n}\n\n.wordads-ad-sticky .wordads-ad-title,\n.wordads-ad-sticky .wordads-ad-controls {\n color: #333\n}\n\n.wordads-ad-hidden {\n\tvisibility: hidden !important;\n\tposition: absolute !important;\n\tpointer-events: none !important;\n\twidth: 0 !important;\n\theight: 0 !important;\n\toverflow: hidden !important;\n\tclip: rect(0 0 0 0) !important;\n}\n\n.wordads-ad-wrapper--bottom_sticky.wordads-ad-hidden {\n transform: translate(0, 1000px);\n}\n\n.google-auto-placed {\n height: 0px !important;\n}\n\nins.adsbygoogle::before,\nins.adsbygoogle::after {\n visibility: hidden !important;\n}\n\nins.adsbygoogle {\n background: transparent;\n padding: 0 !important;\n}`,""]);const u=c},261:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i="",n=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),n&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),n&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i})).join("")},e.i=function(t,i,n,o,s){"string"==typeof t&&(t=[[null,t,void 0]]);var d={};if(n)for(var r=0;r<this.length;r++){var a=this[r][0];null!=a&&(d[a]=!0)}for(var l=0;l<t.length;l++){var c=[].concat(t[l]);n&&d[c[0]]||(void 0!==s&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=s),i&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=i):c[2]=i),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),e.push(c))}},e}},160:t=>{"use strict";
1t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},191:t=>{"use strict";t.exports=function(t){return t[1]}},546:function(t){t.exports=function(){"use strict";function t(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)t[n]=i[n]}return t}return function e(i,n){function o(e,o,s){if("undefined"!=typeof document){"number"==typeof(s=t({},n,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var d="";for(var r in s)s[r]&&(d+="; "+r,!0!==s[r]&&(d+="="+s[r].split(";")[0]));return document.cookie=e+"="+i.write(o,e)+d}}return Object.create({set:o,get:function(t){if("undefined"!=typeof document&&(!arguments.length||t)){for(var e=document.cookie?document.cookie.split("; "):[],n={},o=0;o<e.length;o++){var s=e[o].split("="),d=s.slice(1).join("=");try{var r=decodeURIComponent(s[0]);if(n[r]=i.read(d,r),t===r)break}catch(t){}}return t?n[t]:n}},remove:function(e,i){o(e,"",t({},i,{expires:-1}))},withAttributes:function(i){return e(this.converter,t({},this.attributes,i))},withConverter:function(i){return e(t({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(i)}})}({read:function(t){return'"'===t[0]&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}()},462:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>w});var n=i(157),o=i.n(n),s=i(869),d=i.n(s),r=i(318),a=i.n(r),l=i(825),c=i.n(l),h=i(597),u=i.n(h),g=i(770),p=i.n(g),m=i(14),f={};f.styleTagTransform=p(),f.setAttributes=c(),f.insert=a().bind(null,"head"),f.domAPI=d(),f.insertStyleElement=u(),o()(m.Z,f);const w=m.Z&&m.Z.locals?m.Z.locals:void 0},157:t=>{"use strict";var e=[];function i(t){for(var i=-1,n=0;n<e.length;n++)if(e[n].identifier===t){i=n;break}return i}function n(t,n){for(var s={},d=[],r=0;r<t.length;r++){var a=t[r],l=n.base?a[0]+n.base:a[0],c=s[l]||0,h="".concat(l," ").concat(c);s[l]=c+1;var u=i(h),g={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==u)e[u].references++,e[u].updater(g);else{var p=o(g,n);n.byIndex=r,e.splice(r,0,{identifier:h,updater:p,references:1})}d.push(h)}return d}function o(t,e){var i=e.domAPI(e);return i.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;i.update(t=e)}else i.remove()}}t.exports=function(t,o){var s=n(t=t||[],o=o||{});return function(t){t=t||[];for(var d=0;d<s.length;d++){var r=i(s[d]);e[r].references--}for(var a=n(t,o),l=0;l<s.length;l++){var c=i(s[l]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}s=a}}},318:t=>{"use strict";var e={};t.exports=function(t,i){var n=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},597:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},825:(t,e,i)=>{"use strict";t.exports=function(t){var e=i.nc;e&&t.setAttribute("nonce",e)}},869:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(i){!function(t,e,i){var n="";i.supports&&(n+="@supports (".concat(i.supports,") {")),i.media&&(n+="@media ".concat(i.media," {"));var o=void 0!==i.layer;o&&(n+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),n+=i.css,o&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var s=i.sourceMap;s&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,i)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},770:t=>{"use strict";
1t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},858:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(639),s=n(i(539)),d=i(444),r=i(501);class a extends s.default{constructor(t,e){super(t,e),this.config={},this.adSenseLibraryLoaded=!1,this.adFlowUrl="https://af.pubmine.com?api_version=2"}insertAdBefore(t,e,i){if(!this.shouldShowInlineAds())return;this.log(`Inserting ad before element: ${t.id} of type: ${e}`);const n=this.getRandomTagId(),o=this.createAdSnippet(n,i),s=this.wrapSnippet(o,e);t.insertAdjacentElement("beforebegin",s),this.slots.push({tagId:n,type:e,sizes:i,element:s,isLazy:!0}),this.trackStat("render_inline")}getAdFlowRequestBody(t){const{maxHeight:e,maxWidth:i}=(0,d.getMaxSlotDimension)(t.sizes),n={site:{id:String(this.config.blog_id),is_wordads:this.config.is_wordads,page:window.location.href,language:this.config.blog_language},ad:{tag:t.tagId,format:t.type,max_width:i,max_height:e},user:{uid:this.consent.getOrCreateUID(),gdpr:!1}};return this.consent.usPrivacy&&(n.user.us_privacy=this.consent.usPrivacy),this.consent.tcData&&(n.user.gdpr=!0,n.user.gdpr_consent=this.consent.tcData.tcString),n}shouldShowInlineAds(){var t,e;if(!(null===(t=this.config.enabled_formats)||void 0===t?void 0:t.inline)){const t=document.getElementsByTagName("body")[0];(t.classList.contains("single-post")||t.classList.contains("wp-singular"))&&(this.config.enabled_formats||(this.config.enabled_formats={}),this.config.enabled_formats.inline=!0)}return!!(null===(e=this.config.enabled_formats)||void 0===e?void 0:e.inline)}getMaxSlots(){return r.MAX_INLINE_SLOTS}getMaxBlazeSlots(){return r.MAX_INLINE_BLAZE_SLOTS}shouldShowBottomStickyAds(){var t;return!!(null===(t=this.config.enabled_formats)||void 0===t?void 0:t.bottom_sticky)}shouldShowSidebarStickyRightAds(){var t;return!!(null===(t=this.config.enabled_formats)||void 0===t?void 0:t.sidebar_sticky_right)}shouldShowTopAds(){var t;return!!(null===(t=this.config.enabled_formats)||void 0===t?void 0:t.top)}isSlotTypeEnabled(t){var e;return!!(null===(e=this.config)||void 0===e?void 0:e.formats.includes(t))}getSlotFormatId(t){}getBottomStickySlots(){return(0,r.getSortedSlotSizes)(o.SlotType.BOTTOM_STICKY)}convertFormatsToObject(t){return t.reduce(((t,e)=>(t[e]=!0,t)),{})}initAdNetwork(){this.initDynamicAdSlots(),this.initAditude()}mergeConfig(){var t;window.isWatlV1=!1;const e=this.getServerConfig();e&&(this.config=this.deepMerge(e,this.config)),this.config.enabled_formats=this.convertFormatsToObject(this.config.formats),this.log("Merged config:"),this.log(null!==(t=this.config)&&void 0!==t?t:{})}handleAdResponse(t,e){const i=!!this.config.afp_account_id,n=t.content.indexOf("window.tude")>-1;if(!(t.content.indexOf("var sas = sas")>-1)&&n&&this.forceAfpAds&&i)return void this.renderGoogleAfpAd(e.tagId);const o=!!(null==t?void 0:t.content),s=!!(null==t?void 0:t.pixel);if(o){const e=document.createElement("script");e.type="application/javascript",e.innerHTML=t.content,document.body.appendChild(e)}if(s){const e=new XMLHttpRequest;e.open("GET",t.pixel),e.send()}this.trackAdFlowRequestLatency(o,e.tagId,e.type)}tryUsingIponwebSlots(){var t;window.__ATA=window.__ATA||{cmd:[]},window.__ATA.cmd=window.__ATA.cmd||[];const e=this;window.__ATA.initSlot=function(t,i){var n;const s=document.getElementById(t);if(s&&(0===s.children.length||"SCRIPT"===(null===(n=s.children[0])||void 0===n?void 0:n.tagName))){const n=(0,r.getFormatBySizes)(i.width,i.height);if(!n)return;const d=s.getBoundingClientRect();d.width<i.width&&(s.style.width=`${i.width}px !important`),d.height<i.height&&(s.style.height=`${i.height}px !important`);const a=e.createAdSnippet(t,[[i.width,i.height]]),l=e.wrapSnippet(a,o.SlotType.GUTENBERG_RECTANGLE);s.insertAdjacentElement("beforebegin",l),s.remove(),window.iponwebTags=window.iponwebTags||[],window.iponwebTags.push(t),window.tudeMappings.push({divId:t,format:n,width:i.width,height:i.height}),e.log(`Use IPONWEB's container for ${t} (${i.width}x${i.height}px), format: ${n}`)}},window.__ATA.initDynamicSlot=function(t){var e,i;const n=document.getElementById(t.id);if(n){const o=Math.round(null!==(i=null===(e=n.getBoundingClientRect())||void 0===e?void 0:e.width)&&void 0!==i?i:0);o>=300&&o<970&&window.__ATA.initSlot(t.id,{width:300,height:250})}},window.__ATA.initVideoSlot=function(t){window.__ATA.initDynamicSlot({id:t})};const i=null!==(t=window.__ATA.cmd.push)&&void 0!==t?t:()=>{};for(const t of window.__ATA.cmd)"function"==typeof t&&t!==i&&t()}initDynamicAdSlots(){var t,e,i,n,s,d;this.log("Initializing Gutenberg ad slots"),window.tudeMappings=window.tudeMappings||[],this.tryUsingIponwebSlots();for(const a of window.tudeMappings){(null==a?void 0:a.width)&&(null==a?void 0:a.height)||([a.width,a.height]=null!==(t=(0,r.getFilteredSlotSizesByWidthAndHeight)(a.format,728,250)[0])&&void 0!==t?t:[300,250]);const{divId:l,format:c,width:h,height:u}=a,g=document.getElementById(l);if(g){if((null===(i=null===(e=null==g?void 0:g.parentElement)||void 0===e?void 0:e.parentElement)||void 0===i?void 0:i.classList.contains("inline"))&&(null===(s=null===(n=g.parentElement.parentElement)||void 0===n?void 0:n.parentElement)||void 0===s?void 0:s.classList.contains("wpa"))&&(null===(d=g.parentElement.parentElement.parentElement.parentElement)||void 0===d?void 0:d.classList.contains("wpcnt"))){const t=g.getBoundingClientRect();t.width<a.width&&(g.style.width=`${a.width}px !important`),t.height<a.height&&(g.style.height=`${a.height}px !important`);const e=this.createAdSnippet(l,[[a.width,a.height]]),i=this.wrapSnippet(e,o.SlotType.GUTENBERG_RECTANGLE),n=g.parentElement.parentElement.parentElement.parentElement;n.insertAdjacentElement("beforebegin",i),n.remove(),g.remove()}this.slots.push({tagId:l,type:c,sizes:[[h,u]],element:g,isLazy:!0}),this.log(`Gutenberg ad slot ${l} initialized`)}else this.log(`Gutenberg ad slot ${l} not found`)}}initAditude(){this.log("Initializing Aditude"),window.tude=window.tude||{cmd:[]},window.Raven=window.Raven||{cmd:[]},window.tude.cmd.push((()=>
1{if(window.tude&&"function"==typeof window.tude.setPageTargeting){const t={param1:String(this.config.blog_id),param2:String(this.config.is_wordads),param3:String(this.config.hosting_type),param4:this.config.theme};window.tude.setPageTargeting(t),this.log("Aditude debug: custom dimensions set "+JSON.stringify(t))}})),window.tude.cmd.push((()=>{window.tude.events.addEventListener("tude_ad_filled",(t=>{this.log("aditude debug event: tude_ad_filled "+JSON.stringify(t)),this.handleAd({tagId:t.detail.id,adNetwork:"Aditude"})})),window.tude.events.addEventListener("tude_ad_unfilled",(t=>{this.log(`Aditude debug event: tude_ad_unfilled (${t.detail.id})`),this.handleNoAd({tagId:t.detail.id,adNetwork:"Aditude"})})),window.tude.events.addEventListener("tude_no_ad_sizes",(t=>{this.log(`Aditude debug event: tude_no_ad_sizes ${t.detail.id}`),this.handleNoAd({tagId:t.detail.id,adNetwork:"Aditude"})}))}))}getLibrariesToFetch(){return{prebid:{loaded:!1,url:"https://dn0qt3r0xannq.cloudfront.net/wordpress-2Pvwql52OT/wordpress-longform/prebid-load.js",isInitialized:()=>void 0!==window.tude,init:()=>{window.tude=window.tude||{cmd:[]}}}}}getServerConfig(){const t=super.getServerConfig();if(void 0!==window.wa_smart&&!0===window.isWatlV1){let[,e]=window.wa_smart.target.split(";");e=e.replace("language=","").split("_")[0];const i=[];for(const t of Object.values(o.SlotType)){const e=window.wa_smart[t];(null==e?void 0:e.enabled)&&i.push(t)}return Object.assign(Object.assign({},t),{blog_language:e,hosting_type:2,theme:window.wa_smart.theme,formats:i})}return t}setAdContainerVisibility(t,e){var i,n,s,d,r,a,l,c,h,u,g;const p=this.slots.find((e=>e.tagId===t));if(!p)return void this.log(`Ad container not found: ${t}`);const m=[o.SlotType.GUTENBERG_LEADERBOARD,o.SlotType.GUTENBERG_RECTANGLE,o.SlotType.GUTENBERG_MOBILE_LEADERBOARD,o.SlotType.GUTENBERG_SKYSCRAPER].includes(p.type);let f=null;if(m&&!(null===(i=window.iponwebTags)||void 0===i?void 0:i.includes(t))){const e=(null===(r=null===(d=null===(s=null===(n=p.element)||void 0===n?void 0:n.parentElement)||void 0===s?void 0:s.parentElement)||void 0===d?void 0:d.parentElement)||void 0===r?void 0:r.parentElement)||null;f=null!==e&&e.classList.contains("wpcnt")?e:null===(l=null===(a=document.getElementById(t))||void 0===a?void 0:a.parentElement)||void 0===l?void 0:l.parentElement}else f=m&&(null===(c=window.iponwebTags)||void 0===c?void 0:c.includes(t))?null===(h=p.element.parentElement)||void 0===h?void 0:h.parentElement:p.element;if(null===(u=p.element.parentElement)||void 0===u||u.querySelectorAll(".wordads-ad-title, .wordads-ad-controls").forEach((t=>{t instanceof HTMLElement&&(t.style.visibility=e?"visible":"hidden")})),f){if(f.classList.toggle("wordads-ad-hidden",!e),!e){const e=document.getElementById(t),i=null===(g=null==e?void 0:e.parentElement)||void 0===g?void 0:g.parentElement;i&&(null==i?void 0:i.classList.contains("ad-slot-filled"))&&i.classList.remove("ad-slot-filled")}}else this.log(`Ad container element not found: ${t}`)}showAdContainer(t){this.setAdContainerVisibility(t,!0)}hideAdContainer(t){this.setAdContainerVisibility(t,!1)}handleAd(t){super.handleAd(t),this.showAdContainer(t.tagId)}handleNoAd(t){this.config.afp_account_id?this.renderGoogleAfpAd(t.tagId):(this.log("Google AFP account is missing"),super.handleNoAd(t),this.hideAdContainer(t.tagId))}renderGoogleAfpAd(t){this.slots.filter((t=>t.type===o.SlotType.TOP)).length>1&&t.indexOf("atatags-dynamic-top-")>-1||this.tryLoadAdsenseLib(t,(()=>{var e;const i=this.config.afp_host_id,n=this.config.afp_account_id;if(!i||!n)return void this.log("Ad host or client ID is missing.");const o=document.getElementById(t);if(!o)return void this.log(`AFP Ad container not found: ${t}`);this.configureGoogleAdContainer(o,t);let s=this.getSlotDimensions(o,t);const d=o.getBoundingClientRect();d.width<s.minWidth&&(o.style.width=`${s.minWidth}px !important`),d.height<s.minHeight&&(o.style.height=`${s.minHeight}px !important`),o.innerHTML=this.createGoogleAdElement(String(n),String(i),s.minWidth,s.minHeight,t),this.log(`Adding observer to adDiv: ${o.id} with slotElementId: ${t}`),this.setupGoogleAdStatusObserver(o,null===(e=o.parentElement)||void 0===e?void 0:e.parentElement)}))}getSlotDimensions(t,e){const i=this.slots.find((t=>t.tagId===e));if(!i){const e=parseInt(t.getAttribute("data-ad-width")||"0",10),i=parseInt(t.getAttribute("data-ad-height")||"0",10);return{minWidth:Math.min(e,300),minHeight:Math.min(i,250)}}const n=i.sizes[i.sizes.length-1],o=(0,d.getCompatibleGoogleAdSizes)(n[0],n[1]),[s,r]=[300,250];
1return o?{minWidth:o[0],minHeight:o[1]}:{minWidth:s,minHeight:r}}getSlot(t){return this.slots.find((e=>e.tagId===t.id))}configureGoogleAdContainer(t,e){var i;const{minWidth:n,minHeight:s}=this.getSlotDimensions(t,e),d=null===(i=t.parentElement)||void 0===i?void 0:i.parentElement;if(!d)return;const r=this.getSlot(t);if((null==r?void 0:r.type)===o.SlotType.BOTTOM_STICKY){let t=s+20;for(const e of[".wordads-ad-title",".wordads-ad-controls"]){const i=d.querySelector(e);i&&(t+=i.offsetHeight||0)}d.style.maxHeight=`${String(t)}px`}else d.style.margin="40px auto","absolute"===window.getComputedStyle(d).position&&(d.style.position="static"),t.style.width=`${n}px`,t.style.height=`${s}px`}createGoogleAdElement(t,e,i,n,s){const d=this.slots.find((t=>t.tagId===s));let r=!1,a=null;(null==d?void 0:d.type)===o.SlotType.BOTTOM_STICKY||[728,970].includes(i)&&90===n?a=7415555587:(null==d?void 0:d.type)===o.SlotType.INLINE||300===i&&250===n?(a=2877544770,r=!0):(null==d?void 0:d.type)===o.SlotType.SIDEBAR_STICKY_RIGHT||120===i&&600===n?a=9195541113:(null==d?void 0:d.type)===o.SlotType.GUTENBERG_MOBILE_LEADERBOARD||320===i&&50===n?a=4785522812:(null==d?void 0:d.type)===o.SlotType.GUTENBERG_SKYSCRAPER||160===i&&600===n?a=5523889413:300===i&&250===n&&(a=6074553751),this.log(`Creating Google AFP ad element for #${s} (${i}x${n}px)`+(null!==a?`, slotId: ${a}`:""));let l=r?'data-ad-format="auto" data-full-width-responsive="true"':`data-ad-width="${i}" data-ad-height="${n}"`;return null!==a&&(l+=` data-ad-slot="${a}"`),`\n\t\t\t<ins class="adsbygoogle"\n\t\t\t\tstyle="${r?"display:block":`display:block;width:${i}px !important;height:${n}px !important;`}"\n\t\t\t\tdata-ad-client="ca-${t}"\n\t\t\t\tdata-ad-host="ca-host-pub-${e}"\n\t\t\t\tdata-ad-host-channel="${this.config.is_wordads?5598771027:3624119425}"\n\t\t\t\t\n\t\t\t\t${l}>\n\t\t\t</ins>\n\t\t`}setupGoogleAdStatusObserver(t,e){if(!e)return;let i=null;const n=t.id,o=this.slots.findIndex((t=>t.tagId===n));-1!==o&&void 0!==this.slots[o]&&(this.slots[o].isProcessed=!1);const s=new MutationObserver((e=>{var n;for(const d of e)if("attributes"===d.type&&"data-ad-status"===d.attributeName){const e=d.target.getAttribute("data-ad-status");let r=null!==(n=d.target.parentElement)&&void 0!==n?n:t;if("filled"===e){this.showAdContainer(r.id),this.log(`Google AFP rendered. Div: ${r.id} Status: ${e}`);const t=this.getSlot(r);(null==t?void 0:t.onAd)&&t.onAd()}else this.hideAdContainer(r.id),this.log(`Google AFP rendered. Div: ${r.id}. Status: ${e}`);null!==i&&clearTimeout(i),-1!==o&&void 0!==this.slots[o]&&(this.slots[o].isProcessed=!0),s.disconnect()}})),d=t.querySelector(".adsbygoogle");d&&(s.observe(d,{attributes:!0,attributeFilter:["data-ad-status"]}),i=setTimeout((()=>{var t;-1!==o&&this.slots[o]&&!1===(null!==(t=this.slots[o].isProcessed)&&void 0!==t&&t)&&(this.hideAdContainer(n),this.slots[o].isProcessed=!0,s.disconnect(),this.log("Time limit for processing Google AFP is exceeded for #"+n))}),5e3)),this.initializeAdsbyGoogle()}initializeAdsbyGoogle(){if(void 0===window.adsbygoogle){const t=setInterval((()=>{void 0!==window.adsbygoogle&&(clearInterval(t),this.initAdsByGoogle(),this.log("Google AFP initialized"))}),100);setTimeout((()=>clearInterval(t)),1e3)}else this.initAdsByGoogle()}initAdsByGoogle(){try{(window.adsbygoogle||[]).push({})}catch(t){let e="Failed to render Google AFP";t instanceof Error&&(e+=": "+t.message),this.log(e)}}tryLoadAdsenseLib(t,e){if(this.adSenseLibraryLoaded)return this.log("Adsense library already loaded"),void e();let i=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-${String(this.config.afp_account_id)}`;if(document.querySelector(`script[src="${i}"]`)){let i=0;const n=setInterval((()=>{if(++i,100*i/1e3>=5)return clearInterval(n),void this.hideAdContainer(t);this.adSenseLibraryLoaded&&(e(),clearInterval(n))}),100)}else{const n=document.createElement("script");n.src=i,n.async=!0;const o=setTimeout((()=>{this.log("Adsense library load timeout exceeded"),this.hideAdContainer(t)}),5e3);n.onload=()=>{clearTimeout(o),this.log("Adsense library loaded"),this.adSenseLibraryLoaded=!0,e()},n.onerror=()=>{this.log("Failed to load Adsense library"),this.hideAdContainer(t)},document.head.appendChild(n)}}}e.default=a}
1,12:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(i(202));i(462),e.default=class{constructor(){this.listenersController=new AbortController,this.signal=this.listenersController.signal,this.consent=new o.default}getConsent(){return this.consent}getListenersController(){return this.listenersController}init(t){t.preInit(),this.signal.onabort=()=>t.log("Event listeners removed"),document.addEventListener("scroll",t.throttle((()=>{t.processAds()}),250),{signal:this.signal}),document.addEventListener("resize",t.throttle((()=>{t.processAds()}),250),{signal:this.signal}),window.addEventListener("message",(e=>{t.handlePostMessage(e)}),{signal:this.signal})}}},501:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getSortedSlotSizes=e.getFormatBySizes=e.getFilteredSlotSizesByWidthAndHeight=e.getFilteredSlotSizesByWidth=e.MAX_INLINE_BLAZE_SLOTS=e.MAX_INLINE_SLOTS=void 0;const n=i(639);e.MAX_INLINE_SLOTS=40,e.MAX_INLINE_BLAZE_SLOTS=20,e.getFilteredSlotSizesByWidth=(t,e)=>(s[t]||[]).filter((([t])=>t<=e)),e.getFilteredSlotSizesByWidthAndHeight=(t,e,i)=>(s[t]||[]).filter((([t,n])=>t<=e&&n<=i));const o=document.documentElement.clientWidth<800,s=Object.freeze({[n.SlotType.TOP]:o?[[320,50]]:[[970,250],[970,90],[728,90]],[n.SlotType.INLINE]:o?[[300,250],[320,50]]:[[970,250],[728,90],[300,250]],[n.SlotType.BELOW_POST]:o?[[300,250]]:[[300,250],[728,90]],[n.SlotType.BOTTOM_STICKY]:o?[[320,50],[468,60]]:[[728,90],[970,90]],[n.SlotType.SIDEBAR]:o?[[120,600],[160,600],[300,250],[300,400],[300,600]]:[[120,600],[160,600],[300,600]],[n.SlotType.SIDEBAR_STICKY_RIGHT]:o?[]:[[120,600],[160,600],[300,250],[300,600],[400,600]],[n.SlotType.GUTENBERG_RECTANGLE]:[[300,250]],[n.SlotType.GUTENBERG_LEADERBOARD]:[[728,90]],[n.SlotType.GUTENBERG_MOBILE_LEADERBOARD]:[[320,50]],[n.SlotType.GUTENBERG_SKYSCRAPER]:[[160,600]],[n.SlotType.SIDEBAR_WIDGET_MEDIUMRECTANGLE]:[[300,250]],[n.SlotType.SIDEBAR_WIDGET_LEADERBOARD]:[[728,90]],[n.SlotType.SIDEBAR_WIDGET_WIDESKYSCRAPER]:[[160,600]],[n.SlotType.SHORTCODE]:[[300,250]]});e.getFormatBySizes=(t,e)=>{for(const[i,o]of Object.entries(s))if(![n.SlotType.TOP,n.SlotType.BOTTOM_STICKY,n.SlotType.SIDEBAR,n.SlotType.SIDEBAR_STICKY_RIGHT,n.SlotType.SIDEBAR_WIDGET_MEDIUMRECTANGLE,n.SlotType.SIDEBAR_WIDGET_LEADERBOARD,n.SlotType.SIDEBAR_WIDGET_WIDESKYSCRAPER,n.SlotType.SIDEBAR_WIDGET_WIDESKYSCRAPER,n.SlotType.INLINE,n.SlotType.SHORTCODE,n.SlotType.BELOW_POST].includes(i)&&o.some((([i,n])=>i===t&&n===e)))return i;return null},e.getSortedSlotSizes=t=>s[t].sort(((t,e)=>{const i=e[0]-t[0];return 0!==i?i:e[1]-t[1]}))},586:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SMART_NETWORK_ID=void 0,e.SMART_NETWORK_ID=3905},506:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(i(12)),s=n(i(858)),d=new o.default,r=new s.default(d.getConsent(),d.getListenersController());d.init(r)},313:(t,e)=>{"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),e.ScrollDirection=void 0,function(t){t.UP="up",t.DOWN="down"}(i||(e.ScrollDirection=i={}))},639:(t,e)=>{"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),e.StickySlotTypes=e.SlotType=void 0,function(t){t.TOP="top",t.INLINE="inline",t.BELOW_POST="belowpost",t.BOTTOM_STICKY="bottom_sticky",t.SIDEBAR="sidebar",t.SIDEBAR_STICKY_RIGHT="sidebar_sticky_right",t.GUTENBERG_RECTANGLE="gutenberg_rectangle",t.GUTENBERG_LEADERBOARD="gutenberg_leaderboard",t.GUTENBERG_MOBILE_LEADERBOARD="gutenberg_mobile_leaderboard",t.GUTENBERG_SKYSCRAPER="gutenberg_skyscraper",t.SIDEBAR_WIDGET_MEDIUMRECTANGLE="sidebar_widget_mediumrectangle",t.SIDEBAR_WIDGET_LEADERBOARD="sidebar_widget_leaderboard",t.SIDEBAR_WIDGET_WIDESKYSCRAPER="sidebar_widget_wideskyscraper",t.SHORTCODE="shortcode"}(i||(e.SlotType=i={})),e.StickySlotTypes=[i.BOTTOM_STICKY,i.SIDEBAR_STICKY_RIGHT]},202:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};
1Object.defineProperty(e,"__esModule",{value:!0});const o=n(i(546)),s=i(586);e.default=class{constructor(){this.logging=!1,this.tcData=null,this.usPrivacy=null,this.uid=null}setLogging(t){this.logging=t}log(t){this.logging&&console.log(t)}init(){this.log("Initializing consent..."),window.__uspapi?(this.log("Querying USP API..."),window.__uspapi("getUSPData",1,((t,e)=>{e&&t.uspString&&(this.usPrivacy=t.uspString,this.log("USP API data found. Setting consent: "+this.usPrivacy))}))):this.log("USP API not found"),window.__tcfapi?(this.log("Querying TCF API..."),window.__tcfapi("addEventListener",2,((t,e)=>{var i;e&&t.gdprApplies?(this.tcData=t,this.log("TCF API data found. Setting consent: "+(null===(i=this.tcData)||void 0===i?void 0:i.tcString)),this.initCookieSync()):this.log("TCF API data found. GDPR does not apply")}))):this.log("TCF API not found")}createUIDFromCookies(t,e,i){const n={expires:e,domain:i||window.location.hostname};this.log(`Created UID from Cookies on ${n.domain}`);const s=o.default.withAttributes(n),d=this.generateUIDValue();return s.set(t,d),d}generateUIDValue(){return Math.random().toString(36).substring(2,10)+(new Date).getTime().toString()}getOrCreateUIDFromLocalStorage(t,e){this.log("UID from localStorage");const i=(localStorage.getItem(t)||"").split(":");let n=i[0];const o=(new Date).getTime();let s=parseInt(i[1]);return(!n||o>s)&&(n=this.generateUIDValue(),s=o+24*e*60*60*1e3,localStorage.setItem(t,n+":"+s)),n}getOrCreateUID(){if(null!==this.uid)return this.uid;if(!this.hasUserConsent())return this.uid="",this.uid;const t="wordads_uid",e=o.default.get(t);if(e)return this.log(`Reused UID value ${e}`),this.uid=e,this.uid;const i=this.getCookiesSharedDomain(t,window.location.hostname);return window.localStorage&&!i||(this.uid=this.createUIDFromCookies(t,30,i)),this.uid=this.uid||this.getOrCreateUIDFromLocalStorage(t,30),this.log(`UID value: ${this.uid}`),this.uid}getCookiesSharedDomain(t,e){const i=e.split(".");if(i.length<=2)return null;let n=null,s=0;for(const d of i){if(s+=d.length,n=e.substring(s),s>=e.length)return null;const i=o.default.withAttributes({domain:n});if(i.set(t,"1")&&i.get(t))return i.remove(t),n;s++}return null}hasUserConsent(){return!this.tcData||!0===this.tcData.vendor.consents[496]&&!0===this.tcData.purpose.consents[1]}initCookieSync(){this.log("Initializing Cookie Sync");let t=`https://sync.smartadserver.com/getuid?nwid=${s.SMART_NETWORK_ID}&url=https://af.pubmine.com/user-sync?pid=[sas_uid]`;this.tcData&&(t+=`&gdpr=1&gdpr_consent=${this.tcData.tcString}`),document.createElement("img").src=t}}},444:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getCompatibleGoogleAdSizes=e.convertFormatsToObject=e.getMaxSlotDimension=void 0;const i=[[970,250],[970,90],[728,90],[336,280],[320,100],[300,600],[300,250],[250,250],[200,200],[320,50],[300,50],[468,60],[160,600],[120,600]];e.getMaxSlotDimension=t=>{let e=0,i=0;return t.forEach((([t,n])=>{t>e&&(e=t),n>i&&(i=n)})),{maxWidth:e,maxHeight:i}},e.convertFormatsToObject=t=>t.reduce(((t,e)=>(t[e]=!0,t)),{}),e.getCompatibleGoogleAdSizes=(t,e)=>{const n=i.find((([i,n])=>i<=t&&n<=e));return null!=n?n:null}},539:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(501),o=i(639),s=i(313),d=i(444),r=["BLOCKQUOTE","DIV","FIGURE","FORM","H1","H2","H3","H4","H5","H6","P","UL"];e.default=class{constructor(t,e){this.logging="function"==typeof URLSearchParams&&"true"===new URLSearchParams(window.location.search).get("wordads-logging"),this.consent=t,this.consent.setLogging(this.logging),this.adFlowUrl="https://af.pubmine.com",this.slots=[],this.initialized=!1,this.config={},this.scroll={lastDirection:s.ScrollDirection.DOWN,lastY:window.scrollY},this.listenersController=e,this.forceAfpAds="function"==typeof URLSearchParams&&"1"===new URLSearchParams(window.location.search).get("afp_test")}log(t){this.logging&&console.log(t)}logSlot(t,e){if(!this.logging)return;const i=t.sizes.map((([t,e])=>t+"x"+e)).join(","),n=[t.type,t.tagId,i].join("|");this.log(`[${n}] ${e}`)}trackStat(t){window._stq=window._stq||[],window._stq.push(["extra",{x_wordads_smart:t}])}recordTracksEvent(t,e){e=e||{},window._tkq=window._tkq||[],window._tkq.push(["recordEvent",t,e])}getServerConfig(){var t,e;const i=document.getElementById("adflow-configuration"),n=i?JSON.parse(i.innerText):{},o=null!==(e=null===(t=null===window||void 0===window?void 0:window.wa_client)||void 0===t?void 0:t.config)&&void 0!==e?e:null===window||void 0===window?void 0:window.wa_smart;return this.deepMerge(n,o)}createAdSnippet(t,e){let i=document.createElement("div"),n=document.createElement("div"),o=document.createElement("div"),s=document.createElement("div");if(i.classList.add("wordads-ad"),n.classList.add("wordads-ad-title"),o.classList.add("wordads-ad-content"),s.classList.add("wordads-ad-controls"),n.innerText=this.config._.title,o.id=t,e){const{maxHeight:t,maxWidth:i}=(0,d.getMaxSlotDimension)(e);o.setAttribute("data-ad-height",t.toString()),o.setAttribute("data-ad-width",i.toString())}return s.innerHTML=this.consent.tcData?`<span onclick="__tcfapi( 'showUi' )">${this.config._.privacy_settings}</span>`:"",i.appendChild(n),i.appendChild(o),i.appendChild(s),i}getBottomStickySlots(){}createBottomStickyAdSnippet(t){const e=this.getBottomStickySlots(),i=this.createAdSnippet(t,e);i.classList.add("wordads-ad-sticky");const n=this.wrapSnippet(i,o.SlotType.BOTTOM_STICKY);n.classList.add("wordads-ad-sticky-wrapper");const d=()=>{this.toggleVisibility(n,s.ScrollDirection.DOWN)},r=document.createElement("div");
1return r.classList.add("wordads-ad-sticky-close-btn"),r.onclick=function(){n.remove(),document.removeEventListener("scroll",d)},n.insertBefore(r,i),{event:d,snippet:n}}createSidebarStickyAdSnippet(t,e){const i=this.createAdSnippet(t);i.classList.add("wordads-ad-sticky");const n=this.wrapSnippet(i,e);n.classList.add("wordads-ad-sticky-wrapper");const o=this.throttle((()=>{this.updateSidebarStickyVisibility(n)}),150),s=document.createElement("div");return s.classList.add("wordads-ad-sticky-close-btn"),s.onclick=function(){n.remove(),window.removeEventListener("resize",o),document.removeEventListener("scroll",o)},n.insertBefore(s,i),{event:o,snippet:n,adContent:i.querySelector(".wordads-ad-content")}}toggleVisibility(t,e){const i=window.scrollY>this.scroll.lastY?s.ScrollDirection.DOWN:s.ScrollDirection.UP,n=this.scroll.lastDirection===i;if(this.scroll.lastDirection=i,this.scroll.lastY=window.scrollY,n)return;const o="wordads-ad-hidden";e===i?t.classList.remove(o):t.classList.add(o)}wrapSnippet(t,e){const i=document.createElement("div");return i.classList.add("wordads-ad-wrapper"),i.classList.add(`wordads-ad-wrapper--${e}`),i.appendChild(t),i}checkBrandSafety(t,e){}handleNotOkayResponse(t,e){var i;if(this.log(`Site unable to show ads: ${e.tagId}`),204===t){const t=document.getElementById(e.tagId),n=null===(i=null==t?void 0:t.parentElement)||void 0===i?void 0:i.parentElement;t&&(null==n?void 0:n.classList.contains("wordads-ad-wrapper"))&&n.classList.add("wordads-ad-hidden"),this.listenersController.abort()}}callAdFlow(t){this.logSlot(t,"calling AdFlow");const e=new XMLHttpRequest;e.onreadystatechange=()=>{if(XMLHttpRequest.DONE===e.readyState){if(performance.mark(`${t.tagId}-end`),200!==e.status)return void this.handleNotOkayResponse(e.status,t);const i=JSON.parse(e.response);this.handleAdResponse(i,t)}},e.open("POST",this.adFlowUrl),e.setRequestHeader("Accept","application/json"),e.withCredentials=!0,performance.mark(`${t.tagId}-start`);const i=this.getAdFlowRequestBody(t);e.send(JSON.stringify(i))}trackAdFlowRequestLatency(t,e,i){let n=performance.measure(`${e}-duration`,`${e}-start`,`${e}-end`),o={has_ad:t,ad_type:i,request_time:Math.round(n.duration),theme:this.config.theme};navigator.connection&&(o.connection_effective_type=navigator.connection.effectiveType,o.connection_downlink=navigator.connection.downlink),this.recordTracksEvent("wpcom_wordads_adflow",o)}insertFallbackAd(t,e){let i=(window.sas_fallback||[]).filter((function(t){return t.type===e}));if(0===i.length)return t.remove(),void this.log(`No fallback found for ${e}, snippet removed`);let n=i[0].tag.replaceAll("{{unique_id}}",Math.trunc(1e6*Math.random())),o=document.createElement("div");o.innerHTML=n,n=o.childNodes[0].nodeValue;let s=document.createElement("div");s.innerHTML=n,t.style.position="relative",t.style.visibility="visible",t.innerHTML=s.innerHTML,s.querySelectorAll("script").forEach((function(t){t.parentNode&&t.parentNode.removeChild(t);let e=document.createElement("script");t.src?e.src=t.src:t.textContent?e.textContent=t.textContent:t.innerText&&(e.innerText=t.innerText),document.body.appendChild(e)})),this.trackStat("fallback_"+e)}getPostItems(t){let e=[];for(let i=0;i<t.children.length;i++){let n=t.children[i];this.isPostItemValid(n)&&e.push(n)}return e}getFontSize(t){const e=t.parentElement;if(e)for(let t=0;t<e.children.length;t++){const i=e.children[t];if("P"===i.nodeName)return parseFloat(window.getComputedStyle(i).fontSize)}return 16}isPostItemVisible(t){const e=window.getComputedStyle(t);return!!t.offsetParent&&"hidden"!==e.visibility&&"none"!==e.display&&t.offsetHeight>=this.getFontSize(t)}isPostItemValid(t,e=!1){if(!t||!r.includes(t.nodeName))return!1;if(e&&"DIV"===t.nodeName){let e=!1;const i=4,n=t=>{var e;return!(null===(e=document.evaluate('//div[contains(@class, "wpcnt")]/div[contains(@class, "wpa")]/div/div/div[starts-with(@id, "atatags-")]',t,null,XPathResult.ANY_UNORDERED_NODE_TYPE,null).singleNodeValue)||void 0===e||!e)},o=t=>{var e;return!(null===(e=document.evaluate('//div[contains(@class, "wordads-ad-wrapper")]',t,null,XPathResult.ANY_UNORDERED_NODE_TYPE,null).singleNodeValue)||void 0===e||!e)},s=(t,e)=>{if(e>i)return!1;for(let i=0;i<t.children.length;i++){const d=t.children[i];if(o(d))return!0;
1if(n(d))return!0;if(s(d,e+1))return!0}return!1};if(e=s(t,1),e)return!1}return this.isPostItemVisible(t)}getFloatingElements(t){let e=[],i=t.getElementsByTagName("*");for(let t=0;t<i.length;t++){let n=i[t],o=getComputedStyle(n),s=o.getPropertyValue("position"),d=o.getPropertyValue("float");"relative"!==s&&"absolute"!==s&&"none"===d||e.push(n)}return e}getElementGlobalPosition(t){let e=t.getBoundingClientRect();return{top:e.top+window.scrollY,left:e.left+window.scrollX,bottom:e.top+window.scrollY+e.height,right:e.left+window.scrollX+e.width}}collidesWithElements(t,e){let i=this.getElementGlobalPosition(t),n=!1;return e.forEach((t=>{let e=this.getElementGlobalPosition(t);i.bottom<e.top||i.top>e.bottom||i.right<e.left||i.left>e.left||(n=!0)})),n}getInlineFormatId(){}initInlineAds(){if(!this.shouldShowInlineAds())return;this.log(`Initializing ${o.SlotType.INLINE}`);let t=document.getElementById("wordads-inline-marker");if(!t)return void this.trackStat("inline_no_marker");let e=t.parentElement;if(!e)return;const i=this.getAvailableWidth(e),s=(0,n.getFilteredSlotSizesByWidth)(o.SlotType.INLINE,i);t.remove();let d=this.getMaxSlots(),r=0;const a=window.innerHeight,l=Math.ceil(1.1*a),c=Math.ceil(1.2*a);let h=e.getBoundingClientRect().top+window.scrollY+l;const u=this.getPostItems(e),g=this.getFloatingElements(e);if(u.length>0)for(let t=0;t<u.length;t++){const e=t>0?u[t-1]:null,i=t<u.length-1?u[t+1]:null,n=u[t],a=n.getBoundingClientRect().top+window.scrollY,l=a>h,p=e&&this.isPostItemValid(e,!0),m=this.isPostItemValid(n,!0),f=null===i||i&&this.isPostItemValid(i,!0),w=this.collidesWithElements(n,g);l&&r<d&&p&&m&&f&&!w&&(this.insertAdBefore(n,o.SlotType.INLINE,s,r,this.getInlineFormatId()),h=a+c,r++)}0===r&&this.trackStat("inline_no_insert")}getBottomStickyFormatId(){}initBottomSticky(){if(!this.shouldShowBottomStickyAds())return;this.log(`Initializing ${o.SlotType.BOTTOM_STICKY}`);const t=this.getRandomTagId(),{event:e,snippet:i}=this.createBottomStickyAdSnippet(t);document.body.append(i);const s=document.documentElement.clientWidth,d=(0,n.getFilteredSlotSizesByWidth)(o.SlotType.BOTTOM_STICKY,s),r=this.getBottomStickyFormatId();this.slots.push(Object.assign({tagId:t,type:o.SlotType.BOTTOM_STICKY,sizes:d,element:i,isLazy:!1,onAd:function(){var i;document.addEventListener("scroll",e,{passive:!0});const n=document.getElementById(t),o=null===(i=null==n?void 0:n.parentElement)||void 0===i?void 0:i.parentElement;o&&o.classList.add("ad-slot-filled")}},r?{formatId:r}:{}))}getSidebarStickyRightFormatId(){}initSidebarStickyRight(){var t,e;if(!this.shouldShowSidebarStickyRightAds())return;this.log(`Initializing ${o.SlotType.SIDEBAR_STICKY_RIGHT}`);const i=this.getRandomTagId(),{event:s,snippet:d,adContent:r}=this.createSidebarStickyAdSnippet(i,o.SlotType.SIDEBAR_STICKY_RIGHT),a=null!==(t=document.querySelectorAll(".wp-site-blocks"))&&void 0!==t?t:[];if(1===a.length)a[0].append(d);else{const t=null!==(e=document.querySelectorAll("div#page"))&&void 0!==e?e:[];1===t.length?t[0].append(d):document.body.append(d)}const{maxWidth:l,maxHeight:c}=this.getMaxAvailableSidebarStickySize(d);null==r||r.setAttribute("data-ad-height",c.toString()),null==r||r.setAttribute("data-ad-width",l.toString());const h=(0,n.getFilteredSlotSizesByWidthAndHeight)(o.SlotType.SIDEBAR_STICKY_RIGHT,l,c);if(!h.length)return this.log(`No size available for ${o.SlotType.SIDEBAR_STICKY_RIGHT}`),void d.remove();const u=this.getSidebarStickyRightFormatId();this.slots.push(Object.assign({tagId:i,type:o.SlotType.SIDEBAR_STICKY_RIGHT,sizes:h,element:d,isLazy:!1,onAd:()=>{this.updateSidebarStickyVisibility(d),window.addEventListener("resize",s,{passive:!0}),document.addEventListener("scroll",s,{passive:!0})}},u?{formatId:u}:{}))}appendTopTag(){const t=this.getRandomTagId(),e=document.createElement("div");e.id=t;const i=document.documentElement.clientWidth,s=(0,n.getFilteredSlotSizesByWidth)(o.SlotType.TOP,i),d=this.createAdSnippet(t,s),r=this.wrapSnippet(d,o.SlotType.TOP);return document.body.insertBefore(e,document.body.firstChild),e.insertAdjacentElement("beforebegin",r),e.remove(),this.slots.push({tagId:t,type:o.SlotType.TOP,sizes:s,element:r,isLazy:!0}),e}initTop(){if(!this.shouldShowTopAds())return;this.log(`Initializing ${o.SlotType.TOP}`);const t=Array.from(document.getElementsByClassName("wordads-tag"));let[e]=t.filter((t=>t.dataset.slotType===o.SlotType.TOP));e&&e.remove(),e=this.appendTopTag()}updateSidebarStickyVisibility(t){const e=t.offsetHeight;
1this.isWithinViewportHeight(e)&&!this.checkIfAdIsOverlappingContent(t)?(this.log("sidebar_sticky_right: ad slot can fit"),t.classList.remove("wordads-ad-hidden")):(this.log("sidebar_sticky_right: ad slot CANNOT fit"),t.classList.add("wordads-ad-hidden"))}isWithinViewportHeight(t){return t<=.8*window.innerHeight}getOverlappingElements(t,e,i){return t=Math.round(t),e=Math.round(e),document.elementsFromPoint(t,e).filter((t=>{return!((e=t)===i||i.contains(e)||e.contains(i));var e}))}isElementAboveSnippet(t,e){const i=e.getBoundingClientRect(),n=[[i.left+1,i.top+1],[i.right-1,i.top+1],[i.left+1,i.bottom-1],[i.right-1,i.bottom-1],[i.left+i.width/2,i.top+i.height/2]];for(const[i,o]of n){const n=document.elementsFromPoint(i,o);if(n.indexOf(t)<n.indexOf(e))return!0}return!1}checkIfAdIsOverlappingContent(t){const e=t.getBoundingClientRect(),i=[...this.getOverlappingElements(e.left,e.top,t),...this.getOverlappingElements(e.right,e.top,t),...this.getOverlappingElements(e.right,e.bottom,t),...this.getOverlappingElements(e.left,e.bottom,t)].map((t=>t.classList.contains("wordads-ad-wrapper")&&t.querySelector(".wordads-ad-content")||t)),n=[];for(const t of i){const i=t.getBoundingClientRect();if(!(Math.round(e.right)<=Math.round(i.left)||Math.round(e.left)>=Math.round(i.right)||Math.round(e.bottom)<=Math.round(i.top)||Math.round(e.top)>=Math.round(i.bottom))){const e=window.getComputedStyle(t);"none"!==e.display&&"hidden"!==e.visibility&&"0"!==e.opacity&&n.push(t)}}return n.some((e=>this.isElementAboveSnippet(e,t)))}getMaxAvailableSidebarStickySize(t){const e=(0,n.getSortedSlotSizes)(o.SlotType.SIDEBAR_STICKY_RIGHT);for(const[i,n]of e){t.style.width=`${i}px`,t.style.height=`${n}px`;const e=this.checkIfAdIsOverlappingContent(t);if(t.style.width="",t.style.height="",!e&&this.isWithinViewportHeight(n))return this.log(`sidebar_sticky_right: max available size without overlap, [${i}, ${n}]`),{maxWidth:i,maxHeight:n}}return this.log("sidebar_sticky_right: no slot size fits available space"),{maxWidth:0,maxHeight:0}}initAdTags(){var t;this.log("Initializing ad tags");const e=Array.from(document.getElementsByClassName("wordads-tag"));for(let i=0;i<e.length;i++){const o=e[i],s=null!==(t=o.dataset.slotType)&&void 0!==t?t:"",d=this.getSlotFormatId(s),r=this.getAvailableWidth(o.parentElement),a=(0,n.getFilteredSlotSizesByWidth)(s,r);this.log(`Initializing ad tag ${i+1}: ${s}, format id: ${d}`),s?this.isSlotTypeEnabled(s)?null!==d?a.length?(this.insertAdBefore(o,s,a,i,d),o.remove()):(this.log(`No available sizes for slot type: ${s}`),o.remove()):(this.log(`Invalid slot type: ${s}`),o.remove()):(this.log(`Disabled slot type: ${s}`),o.remove()):(this.log(`Slot type not provided: ${s}`),o.remove())}}getAvailableWidth(t){if(!t)return 0;const e=window.getComputedStyle(t),i=parseFloat(e.paddingLeft),n=parseFloat(e.paddingRight);return t.getBoundingClientRect().width-(i+n)}getFormat(t){}handleNoAdWithSmart(){}handleNoAd(t){let e=this.getSlotByTagId(t.tagId);e?((null==t?void 0:t.adNetwork)?this.logSlot(e,`Got NoAd from ${null==t?void 0:t.adNetwork}, requesting a fallback`):this.logSlot(e,"Got NoAd, requesting a fallback"),window.iponwebTags=window.iponwebTags||[],window.iponwebTags.includes(e.tagId)||this.insertFallbackAd(e.element,e.type),this.checkBrandSafety(t,e),this.trackStat("noad_"+e.type)):this.log(`NoAd: no slot found for tag id: ${t.tagId}, format: ${this.getFormat(t)}`)}handleAd(t){let e=this.getSlotByTagId(t.tagId);e?((null==t?void 0:t.adNetwork)?this.logSlot(e,`Got an Ad from ${null==t?void 0:t.adNetwork}`):this.logSlot(e,"Got an Ad"),o.StickySlotTypes.indexOf(e.type)>-1?e.element.style.position="fixed":e.element.style.position="relative",e.element.style.visibility="visible",e.onAd&&e.onAd(),this.trackStat("ad_"+e.type)):this.log(`Ad: no slot found for tag id: ${t.tagId}, format: ${this.getFormat(t)}`)}handlePostMessage(t){if("object"!=typeof t.data)return;if("wa-inline-frame"!==t.data.type)return;const e=t;let i=document.getElementsByTagName("iframe");for(let t=0;t<i.length;t++)if(i[t].contentWindow===e.source){i[t].style.height=Math.ceil(e.data.height)+"px";let n=i[t].closest(".wordads-ad");n&&(n.classList.contains("wordads-ad-responsive")||n.classList.add("wordads-ad-responsive"),e.data.maxWidth&&n.querySelectorAll(".wordads-ad-title, .wordads-ad-controls").forEach((t=>{t.style.maxWidth=e.data.maxWidth})));break}}getSlotByTagId(t){return this.slots.find((e=>e.tagId===t))}getRandomTagId(){return"wordads-ad-"+Math.trunc(1e6*Math.random())}throttle(t,e){let i=!1;return(...n)=>{i||(t(...n),i=!0,setTimeout((()=>{i=!1}),e))}}isElementInLazyViewport(t){let e=window.innerHeight,i=window.scrollY,n=i-e,o=i+2*e,s=this.getElementGlobalPosition(t);return!(s.bottom<=n||s.top>=o)}processAds(){this.log("processAds: "+this.slots.length),0!==this.slots.length&&this.slots.forEac
1h((t=>{if(t.isLoaded)return;const e=!t.isLazy||this.isElementInLazyViewport(t.element),i=this.checkIfAdIsOverlappingContent(t.element);i&&t.type===o.SlotType.TOP&&(this.logSlot(t,"Top overlaps with other elements, we have to remove it from slots"),this.slots=this.slots.filter((e=>e!==t)),t.element.remove()),!e||i&&t.type!==o.SlotType.BOTTOM_STICKY||(this.logSlot(t,"in view"),t.isLoaded=!0,this.callAdFlow(t))}))}tryInit(t){const e=Object.values(t).map((t=>t.loaded&&t.isInitialized())).filter(Boolean);Object.keys(t).length===e.length&&(this.log("All scripts loaded, initializing..."),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{this.init()})):this.init())}preInit(){this.log("Running Pre Init");const t=this.getLibrariesToFetch();for(const[e,i]of Object.entries(t)){if(i.isInitialized())continue;this.log(`Fetching ${e} script`),i.init();const n=document.createElement("script");n.src=i.url,n.async=!0,n.addEventListener("load",(()=>{this.log(`${e} is loaded`),t[e]=Object.assign(Object.assign({},i),{loaded:!0}),this.tryInit(t)})),document.head.appendChild(n)}}init(){this.log("Init..."),this.mergeConfig(),this.consent.init(),this.initAdNetwork(),this.consent.initCookieSync(),this.initAds()}initAds(){this.initialized||(this.initialized=!0,this.initInlineAds(),this.initTop(),this.initBottomSticky(),this.initSidebarStickyRight(),this.initAdTags(),this.processAds())}deepMerge(t,e){for(let i in e)e.hasOwnProperty(i)&&(e[i]instanceof Object&&t[i]instanceof Object?t[i]=this.deepMerge(t[i],e[i]):t[i]=e[i]);return t}}},240:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg width=%2730%27 height=%2730%27 viewBox=%270 0 30 30%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Crect x=%270.5%27 y=%270.5%27 width=%2729%27 height=%2729%27 rx=%2714.5%27 fill=%27white%27/%3E%3Crect x=%270.5%27 y=%270.5%27 width=%2729%27 height=%2729%27 rx=%2714.5%27 stroke=%27%23DDDDDF%27/%3E%3Cpath d=%27M19 11L15 15L19 19%27 stroke=%27%237C7F83%27 stroke-width=%271.5%27/%3E%3Cpath d=%27M11 19L15 15L11 11%27 stroke=%27%237C7F83%27 stroke-width=%271.5%27/%3E%3C/svg%3E"}},e={};function i(n){var o=e[n];if(void 0!==o)return o.exports;var s=e[n]={id:n,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.exports}i.m=t,i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.b=document.baseURI||self.location.href,i.nc=void 0,i(506)})();; 2( function() { 3 var cookieValue = document.cookie.replace( /(?:(?:^|.*;\s*)eucookielaw\s*\=\s*([^;]*).*$)|^.*$/, '$1' ); 4 var overlay = document.querySelector( '#eu-cookie-law' ); 5 var container = document.querySelector( '.widget_eu_cookie_law_widget' ); 6 var initialScrollPosition, scrollFunction; 7 8 function remove( el ) { 9 return el && el.parentElement && el.parentElement.removeChild( el ); 10 } 11 12 function triggerDismissEvent() { 13 try { 14 const dismissEvent = new Event( 'eucookielaw-dismissed' ); 15 document.dispatchEvent( dismissEvent ); 16 } catch ( err ) { } 17 } 18 19 function removeOverlay() { 20 remove( overlay ); 21 triggerDismissEvent(); 22 } 23 24 function fade( el, type, fn ) { 25 var duration = 400; 26 27 el.style.display = 'block'; 28 el.style.transitionProperty = 'opacity'; 29 el.style.transitionDuration = duration + 'ms'; 30 el.style.opacity = type === 'in' ? 0 : 1; 31 32 // Double rAF to ensure styles are applied cross-browser. 33 requestAnimationFrame( function () { 34 requestAnimationFrame( function() { 35 el.style.opacity = type === 'in' ? 1 : 0; 36 // Wait for animation. 37 setTimeout( function () { 38 // Clean up. 39 el.style.removeProperty( 'opacity' ); 40 el.style.removeProperty( 'transition-property' ); 41 el.style.removeProperty( 'transition-duration' ); 42 43 if ( type === 'out' ) { 44 el.style.display = 'none'; 45 } 46 47 if ( typeof fn === 'function' ) { 48 fn(); 49 } 50 }, duration + 50 ); 51 } ); 52 } ); 53 } 54 55 function appendWidget() { 56 document.body.appendChild( container ); 57 overlay.style.display = 'block'; 58 fade( container, 'in' ); 59 } 60 61 if ( typeof wp !== 'undefined' && !! wp.customize ) { 62 appendWidget(); 63 return; 64 } 65 66 if ( ! overlay || ! container ) { 67 return; 68 } 69 70 if ( overlay.classList.contains( 'ads-active' ) ) { 71 var adsCookieValue = document.cookie.replace( /(?:(?:^|.*;\s*)personalized-ads-consent\s*\=\s*([^;]*).*$)|^.*$/, '$1' ); 72 if ( cookieValue !== '' && adsCookieValue !== '' ) { 73 removeOverlay(); 74 } 75 } else if ( cookieValue !== '' ) { 76 removeOverlay(); 77 } 78 79 appendWidget(); 80 81 overlay.querySelector( 'form' ).addEventListener( 'submit', accept ); 82 83 if ( overlay.classList.contains( 'hide-on-scroll' ) ) { 84 initialScrollPosition = window.pageYOffset; 85 86 scrollFunction = function() { 87 if ( Math.abs( window.pageYOffset - initialScrollPosition ) > 50 ) { 88 accept(); 89 } 90 }; 91 92 window.addEventListener( 'scroll', scrollFunction ); 93 } else if ( overlay.classList.contains( 'hide-on-time' ) ) { 94 var timeout = parseInt( overlay.getAttribute( 'data-hide-timeout' ), 10 ) || 0; 95 setTimeout( accept, timeout * 1000 ); 96 } 97 98 var accepted = false;
99 function accept( event ) { 100 if ( accepted ) { 101 return; 102 } 103 accepted = true; 104 105 if ( event && event.preventDefault ) { 106 event.preventDefault(); 107 } 108 109 if ( overlay.classList.contains( 'hide-on-scroll' ) ) { 110 window.removeEventListener( 'scroll', scrollFunction ); 111 } 112 113 var expireTime = new Date(); 114 var consentExpiration = parseInt( overlay.getAttribute( 'data-consent-expiration' ), 10 ) || 0; 115 expireTime.setTime( expireTime.getTime() + ( consentExpiration * 24 * 60 * 60 * 1000 ) ); 116 117 document.cookie = 'eucookielaw=' + expireTime.getTime() + ';path=/;expires=' + expireTime.toGMTString(); 118 if ( overlay.classList.contains( 'ads-active' ) && overlay.classList.contains( 'hide-on-button' ) ) { 119 document.cookie = 'personalized-ads-consent=' + expireTime.getTime() + ';path=/;expires=' + expireTime.toGMTString(); 120 } 121 122 fade( overlay, 'out', function() { 123 removeOverlay(); 124 remove( container ); 125 } ); 126 } 127} )(); 128; 129/* global wpcom_reblog */ 130 131var jetpackLikesWidgetBatch = []; 132var jetpackLikesMasterReady = false; 133 134// Due to performance problems on pages with a large number of widget iframes that need to be loaded, 135// we are limiting the processing at any instant to unloaded widgets that are currently in viewport, 136// plus this constant that will allow processing of widgets above and bellow the current fold. 137// This aim of it is to improve the UX and hide the transition from unloaded to loaded state from users. 138var jetpackLikesLookAhead = 2000; // pixels 139 140// Keeps track of loaded comment likes widget so we can unload them when they are scrolled out of view. 141var jetpackCommentLikesLoadedWidgets = []; 142 143var jetpackLikesDocReadyPromise = new Promise( resolve => { 144 if ( document.readyState !== 'loading' ) { 145 resolve(); 146 } else { 147 window.addEventListener( 'DOMContentLoaded', () => resolve() ); 148 } 149} ); 150 151function JetpackLikesPostMessage( message, target ) { 152 if ( typeof message === 'string' ) { 153 try { 154 message = JSON.parse( message ); 155 } catch ( e ) { 156 return; 157 } 158 } 159 160 if ( target && typeof target.postMessage === 'function' ) { 161 try { 162 target.postMessage( 163 JSON.stringify( { 164 type: 'likesMessage', 165 data: message, 166 } ), 167 '*' 168 ); 169 } catch ( e ) { 170 return; 171 } 172 } 173} 174 175function JetpackLikesBatchHandler() { 176 const requests = []; 177 document.querySelectorAll( 'div.jetpack-likes-widget-unloaded' ).forEach( widget => { 178 if ( jetpackLikesWidgetBatch.indexOf( widget.id ) > -1 ) { 179 return; 180 } 181 182 if ( ! jetpackIsScrolledIntoView( widget ) ) { 183 return; 184 } 185 186 jetpackLikesWidgetBatch.push( widget.id ); 187 188 var regex = /like-(post|comment)-wrapper-(\d+)-(\d+)-(\w+)/, 189 match = regex.exec( widget.id ), 190 info; 191 192 if ( ! match || match.length !== 5 ) { 193 return; 194 } 195 196 info = { 197 blog_id: match[ 2 ], 198 width: widget.width, 199 }; 200 201 if ( 'post' === match[ 1 ] ) { 202 info.post_id = match[ 3 ]; 203 } else if ( 'comment' === match[ 1 ] ) { 204 info.comment_id = match[ 3 ]; 205 } 206 207 info.obj_id = match[ 4 ]; 208 209 requests.push( info ); 210 } ); 211 212 if ( requests.length > 0 ) { 213 JetpackLikesPostMessage( 214 { event: 'initialBatch', requests: requests }, 215 window.frames[ 'likes-master' ] 216 ); 217 } 218} 219 220function JetpackLikesMessageListener( event ) { 221 let message = event && event.data; 222 if ( typeof message === 'string' ) { 223 try { 224 message = JSON.parse( message ); 225 } catch ( err ) { 226 return; 227 } 228 } 229 230 const type = message && message.type; 231 const data = message && message.data; 232 233 if ( type !== 'likesMessage' || typeof data.event === 'undefined' ) { 234 return; 235 } 236 237 // We only allow messages from one origin 238 const allowedOrigin = 'https://widgets.wp.com'; 239 if ( allowedOrigin !== event.origin ) { 240 return; 241 } 242 243 switch ( data.event ) { 244 case 'masterReady': 245 jetpackLikesDocReadyPromise.then( () => { 246 jetpackLikesMasterReady = true; 247 248 const stylesData = { 249 event: 'injectStyles', 250 }; 251 const sdTextColor = document.querySelector( '.sd-text-color' ); 252 const sdLinkColor = document.querySelector( '.sd-link-color' ); 253 const sdTextColorStyles = ( sdTextColor && getComputedStyle( sdTextColor ) ) || {}; 254 const sdLinkColorStyles = ( sdLinkColor && getComputedStyle( sdLinkColor ) ) || {}; 255 256 // enable reblogs if they are enabled for the page 257 if ( document.body.classList.contains( 'jetpack-reblog-enabled' ) ) { 258 JetpackLikesPostMessage( { event: 'reblogsEnabled' }, window.frames[ 'likes-master' ] ); 259 } 260 261 stylesData.textStyles = { 262 color: sdTextColorStyles[ 'color' ],
263 fontFamily: sdTextColorStyles[ 'font-family' ], 264 fontSize: sdTextColorStyles[ 'font-size' ], 265 direction: sdTextColorStyles[ 'direction' ], 266 fontWeight: sdTextColorStyles[ 'font-weight' ], 267 fontStyle: sdTextColorStyles[ 'font-style' ], 268 textDecoration: sdTextColorStyles[ 'text-decoration' ], 269 }; 270 271 stylesData.linkStyles = { 272 color: sdLinkColorStyles[ 'color' ], 273 fontFamily: sdLinkColorStyles[ 'font-family' ], 274 fontSize: sdLinkColorStyles[ 'font-size' ], 275 textDecoration: sdLinkColorStyles[ 'text-decoration' ], 276 fontWeight: sdLinkColorStyles[ 'font-weight' ], 277 fontStyle: sdLinkColorStyles[ 'font-style' ], 278 }; 279 280 JetpackLikesPostMessage( stylesData, window.frames[ 'likes-master' ] ); 281 282 JetpackLikesBatchHandler(); 283 } ); 284 285 break; 286 287 // We're keeping this for planned future follow ups. 288 // @see: https://github.com/Automattic/jetpack/pull/42361#discussion_r1995338815 289 case 'showLikeWidget': 290 break; 291 292 // We're keeping this for planned future follow ups. 293 // @see: https://github.com/Automattic/jetpack/pull/42361#discussion_r1995338815 294 case 'showCommentLikeWidget': 295 break; 296 297 case 'killCommentLikes': 298 // If kill switch for comment likes is enabled remove all widgets wrappers and `Loading...` placeholders. 299 document 300 .querySelectorAll( '.jetpack-comment-likes-widget-wrapper' ) 301 .forEach( wrapper => wrapper.remove() ); 302 break; 303 304 case 'clickReblogFlair': 305 if ( wpcom_reblog && typeof wpcom_reblog.toggle_reblog_box_flair === 'function' ) { 306 wpcom_reblog.toggle_reblog_box_flair( data.obj_id, data.post_id ); 307 } 308 break; 309 310 case 'hideOtherGravatars': { 311 hideLikersPopover(); 312 break; 313 } 314 315 case 'showOtherGravatars': { 316 const container = document.querySelector( '#likes-other-gravatars' ); 317 318 if ( ! container ) { 319 break; 320 } 321 322 const list = container.querySelector( 'ul' ); 323 324 container.style.display = 'none'; 325 list.innerHTML = ''; 326 327 container 328 .querySelectorAll( '.likes-text span' ) 329 .forEach( item => ( item.textContent = data.totalLikesLabel ) ); 330 331 ( data.likers || [] ).forEach( async ( liker, index ) => { 332 if ( liker.profile_URL.substr( 0, 4 ) !== 'http' ) { 333 // We only display gravatars with http or https schema 334 return; 335 } 336 337 const element = document.createElement( 'li' ); 338 list.append( element ); 339 340 element.innerHTML = ` 341 <a href="${ encodeURI( liker.profile_URL ) }" rel="nofollow" target="_parent" class="wpl-liker"> 342 <img src="${ encodeURI( liker.avatar_URL ) }" 343 alt="" 344 style="width: 28px; height: 28px;" /> 345 <span></span> 346 </a> 347 `; 348 349 350 // Add some extra attributes through native methods, to ensure strings are sanitized. 351 element.classList.add( liker.css_class ); 352 element.querySelector( 'img' ).alt = data.avatarAltTitle.replace( '%s', liker.name ); 353 element.querySelector( 'span' ).innerText = liker.name; 354 355 if ( index === data.likers.length - 1 ) { 356 element.addEventListener( 'keydown', ( e ) => { 357 if ( e.key === 'Tab' && ! e.shiftKey ) { 358 e.preventDefault(); 359 hideLikersPopover(); 360 361 JetpackLikesPostMessage( 362 { event: 'focusLikesCount', parent: data.parent }, 363 window.frames[ 'likes-master' ] 364 ); 365 } 366 } ); 367 } 368 } ); 369 370 const positionPopup = function() { 371 const containerStyle = getComputedStyle(container); 372 const isRtl = containerStyle.direction === 'rtl'; 373 374 const el = document.querySelector( `*[name='${ data.parent }']` ); 375 const rect = el.getBoundingClientRect(); 376 const win = el.ownerDocument.defaultView; 377 378 const offset = { 379 top: rect.top + win.pageYOffset, 380 left: rect.left + win.pageXOffset, 381 }; 382 383 // don't display yet or we get skewed window.innerWidth later 384 container.style.display = 'none'; 385 386 let containerLeft = 0; 387 container.style.top = offset.top + data.position.top - 1 + 'px'; 388 389 if ( isRtl ) { 390 const visibleAvatarsCount = data && data.likers ? Math.min( data.likers.length, 5 ) : 0; 391 // 24px is the width of the avatar + 4px is the padding between avatars 392 containerLeft = offset.left + data.position.left + 24 * visibleAvatarsCount + 4; 393 container.style.transform = 'translateX(-100%)'; 394 } else { 395 containerLeft = offset.left + data.position.left; 396 } 397 container.style.left = containerLeft + 'px'; 398 399 // Container width - padding
400 const initContainerWidth = data.width - 20; 401 const rowLength = Math.floor( initContainerWidth / 37 ); 402 // # of rows + (avatar + avatar padding) + text above + container padding 403 let height = Math.ceil( data.likers.length / rowLength ) * 37 + 17 + 22; 404 if ( height > 204 ) { 405 height = 204; 406 } 407 408 // If the popup is overflows viewport width, we should show it on the next line 409 // Push it offscreen to calculated rendered width 410 const windowWidth = win.innerWidth; 411 container.style.left = '-9999px'; 412 container.style.display = 'block'; 413 414 // If the popup exceeds the viewport width, 415 // flip the position of the popup. 416 const containerWidth = container.offsetWidth; 417 const containerRight = containerLeft + containerWidth; 418 419 if ( containerRight > windowWidth && ! isRtl) { 420 containerLeft = rect.left + rect.width - containerWidth; 421 } else if ( containerLeft - containerWidth < 0 && isRtl ) { 422 container.style.transform = 'none'; 423 containerLeft = rect.left; 424 } 425 // Set the container left 426 container.style.left = containerLeft + 'px'; 427 428 container.setAttribute( 'aria-hidden', 'false' ); 429 } 430 431 positionPopup(); 432 container.focus(); 433 434 const debounce = function( func, wait ) { 435 var timeout; 436 return function() { 437 var context = this; 438 var args = arguments; 439 clearTimeout( timeout ); 440 timeout = setTimeout( function() { 441 func.apply( context, args ); 442 }, wait ); 443 }; 444 }; 445 446 const debouncedPositionPopup = debounce( positionPopup, 100 ); 447 448 // Keep a reference of this function in the element itself 449 // so that we can destroy it later 450 container.__resizeHandler = debouncedPositionPopup; 451 452 // When window is resized, resize the popup. 453 window.addEventListener( "resize", debouncedPositionPopup ); 454 } 455 } 456} 457 458window.addEventListener( 'message', JetpackLikesMessageListener ); 459 460function hideLikersPopover() { 461 const container = document.querySelector( '#likes-other-gravatars' ); 462 463 if ( container ) { 464 container.style.display = 'none'; 465 container.setAttribute( 'aria-hidden', 'true' ); 466 467 // Remove the resize event listener and cleanup. 468 const resizeHandler = container.__resizeHandler; 469 if ( resizeHandler ) { 470 window.removeEventListener( "resize", resizeHandler ); 471 delete container.__resizeHandler; 472 } 473 } 474} 475 476document.addEventListener( 'click', hideLikersPopover ); 477 478function JetpackLikesWidgetQueueHandler() { 479 var wrapperID; 480 481 if ( ! jetpackLikesMasterReady ) { 482 setTimeout( JetpackLikesWidgetQueueHandler, 500 ); 483 return; 484 } 485 486 // Restore widgets to initial unloaded state when they are scrolled out of view. 487 jetpackUnloadScrolledOutWidgets(); 488 489 var unloadedWidgetsInView = jetpackGetUnloadedWidgetsInView(); 490 491 if ( unloadedWidgetsInView.length > 0 ) { 492 // Grab any unloaded widgets for a batch request 493 JetpackLikesBatchHandler(); 494 } 495 496 for ( var i = 0, length = unloadedWidgetsInView.length; i <= length - 1; i++ ) { 497 wrapperID = unloadedWidgetsInView[ i ].id; 498 499 if ( ! wrapperID ) { 500 continue; 501 } 502 503 jetpackLoadLikeWidgetIframe( wrapperID ); 504 } 505} 506 507function jetpackLoadLikeWidgetIframe( wrapperID ) { 508 if ( typeof wrapperID === 'undefined' ) { 509 return; 510 } 511 512 const wrapper = document.querySelector( '#' + wrapperID ); 513 wrapper.querySelectorAll( 'iframe' ).forEach( iFrame => iFrame.remove() ); 514 515 const placeholder = wrapper.querySelector( '.likes-widget-placeholder' ); 516 517 // Post like iframe 518 if ( placeholder && placeholder.classList.contains( 'post-likes-widget-placeholder' ) ) { 519 const postLikesFrame = document.createElement( 'iframe' ); 520 521 postLikesFrame.classList.add( 'post-likes-widget', 'jetpack-likes-widget' ); 522 postLikesFrame.name = wrapper.dataset.name; 523 postLikesFrame.src = wrapper.dataset.src; 524 postLikesFrame.height = '55px'; 525 postLikesFrame.width = '100%'; 526 postLikesFrame.frameBorder = '0'; 527 postLikesFrame.scrolling = 'no'; 528 postLikesFrame.title = wrapper.dataset.title; 529 530 placeholder.after( postLikesFrame ); 531 } 532 533 // Comment like iframe 534 if ( placeholder.classList.contains( 'comment-likes-widget-placeholder' ) ) { 535 const commentLikesFrame = document.createElement( 'iframe' ); 536 537 commentLikesFrame.class = 'comment-likes-widget-frame jetpack-likes-widget-frame'; 538 commentLikesFrame.name = wrapper.dataset.name; 539 commentLikesFrame.src = wrapper.dataset.src; 540 commentLikesFrame.height = '18px'; 541 commentLikesFrame.width = '100%'; 542 commentLikesFrame.frameBorder = '0'; 543 commentLikesFrame.scrolling = 'no'; 544 545 wrapper.querySelector( '.comment-like-feedback' ).after( commentLikesFrame ); 546 547 jetpackCommentLikesLoadedWidgets.push( commentLikesFrame ); 548 } 549 550 wrapper.classList.remove( 'jetpack-likes-widget-unloaded' ); 551 wrapper.classList.add( 'jetpack-likes-widget-loading' ); 552 553 wrapper.querySelector( 'iframe' ).addEventListener( 'load', e => { 554 JetpackLikesPostMessage( 555 { event: 'loadLikeWidget', name: e.target.name, width: e.target.width }, 556 window.frames[ 'likes-master' ] 557 ); 558 559 wrapper.classList.remove( 'jetpack-likes-widget-loading' ); 560 wrapper.classList.add( 'jetpack-likes-widget-loaded' ); 561 } ); 562} 563 564function jetpackGetUnloadedWidgetsInView() { 565 const unloadedWidgets = document.querySelectorAll( 'div.jetpack-likes-widget-unloaded' ); 566 567 return [ ...unloadedWidgets ].filter( item => jetpackIsScrolledIntoView( item ) ); 568} 569 570function jetpackIsScrolledIntoView( element ) { 571 const top = element.getBoundingClientRect().top; 572 const bottom = element.getBoundingClientRect().bottom; 573
574 // Allow some slack above and bellow the fold with jetpackLikesLookAhead, 575 // with the aim of hiding the transition from unloaded to loaded widget from users. 576 return top + jetpackLikesLookAhead >= 0 && bottom <= window.innerHeight + jetpackLikesLookAhead; 577} 578 579function jetpackUnloadScrolledOutWidgets() { 580 for ( let i = jetpackCommentLikesLoadedWidgets.length - 1; i >= 0; i-- ) { 581 const currentWidgetIframe = jetpackCommentLikesLoadedWidgets[ i ]; 582 583 if ( ! jetpackIsScrolledIntoView( currentWidgetIframe ) ) { 584 const widgetWrapper = 585 currentWidgetIframe && 586 currentWidgetIframe.parentElement && 587 currentWidgetIframe.parentElement.parentElement; 588 589 // Restore parent class to 'unloaded' so this widget can be picked up by queue manager again if needed. 590 widgetWrapper.classList.remove( 'jetpack-likes-widget-loaded' ); 591 widgetWrapper.classList.remove( 'jetpack-likes-widget-loading' ); 592 widgetWrapper.classList.add( 'jetpack-likes-widget-unloaded' ); 593 594 // Bring back the loading placeholder into view. 595 widgetWrapper 596 .querySelectorAll( '.comment-likes-widget-placeholder' ) 597 .forEach( item => ( item.style.display = 'block' ) ); 598 599 // Remove it from the list of loaded widgets. 600 jetpackCommentLikesLoadedWidgets.splice( i, 1 ); 601 602 // Remove comment like widget iFrame. 603 currentWidgetIframe.remove(); 604 } 605 } 606} 607 608var jetpackWidgetsDelayedExec = function ( after, fn ) { 609 var timer; 610 return function () { 611 clearTimeout( timer ); 612 timer = setTimeout( fn, after ); 613 }; 614}; 615 616var jetpackOnScrollStopped = jetpackWidgetsDelayedExec( 250, JetpackLikesWidgetQueueHandler ); 617 618// Load initial batch of widgets, prior to any scrolling events. 619JetpackLikesWidgetQueueHandler(); 620 621// Add event listener to execute queue handler after scroll. 622window.addEventListener( 'scroll', jetpackOnScrollStopped, true ); 623; 624/** 625 * Handles toggling the main navigation menu for small screens. 626 */ 627jQuery( document ).ready( function( $ ) { 628 var $masthead = $( '#masthead' ), 629 timeout = false; 630 631 $.fn.smallMenu = function() { 632 $masthead.find( '.site-navigation' ).removeClass( 'main-navigation' ).addClass( 'main-small-navigation' ); 633 $masthead.find( '.site-navigation h1' ).removeClass( 'assistive-text' ).addClass( 'menu-toggle' ); 634 635 $( '.menu-toggle' ).unbind( 'click' ).click( function() { 636 $masthead.find( '.menu' ).toggle(); 637 $( this ).toggleClass( 'toggled-on' ); 638 } ); 639 }; 640 641 // Check viewport width on first load. 642 if ( $( window ).width() < 600 ) 643 $.fn.smallMenu(); 644 645 // Check viewport width when user resizes the browser window. 646 $( window ).resize( function() { 647 var browserWidth = $( window ).width(); 648 649 if ( false !== timeout ) 650 clearTimeout( timeout ); 651 652 timeout = setTimeout( function() { 653 if ( browserWidth < 600 ) { 654 $.fn.smallMenu(); 655 } else { 656 $masthead.find( '.site-navigation' ).removeClass( 'main-small-navigation' ).addClass( 'main-navigation' ); 657 $masthead.find( '.site-navigation h1' ).removeClass( 'menu-toggle' ).addClass( 'assistive-text' ); 658 $masthead.find( '.menu' ).removeAttr( 'style' ); 659 } 660 }, 200 ); 661 } ); 662 663 var container = $( '.site-navigation' ); 664 665 // Fix child menus for touch devices. 666 function fixMenuTouchTaps( container ) { 667 var touchStartFn, 668 parentLink = container.find( '.menu-item-has-children > a, .page_item_has_children > a' ); 669 670 if ( 'ontouchstart' in window ) { 671 touchStartFn = function( e ) { 672 var menuItem = this.parentNode; 673 674 if ( ! menuItem.classList.contains( 'focus' ) ) { 675 e.preventDefault(); 676 for( var i = 0; i < menuItem.parentNode.children.length; ++i ) { 677 if ( menuItem === menuItem.parentNode.children[i] ) { 678 continue; 679 } 680 menuItem.parentNode.children[i].classList.remove( 'focus' ); 681 } 682 menuItem.classList.add( 'focus' ); 683 } else { 684 menuItem.classList.remove( 'focus' ); 685 } 686 }; 687 688 for ( var i = 0; i < parentLink.length; ++i ) { 689 parentLink[i].addEventListener( 'touchstart', touchStartFn, false ) 690 } 691 } 692 } 693 694 fixMenuTouchTaps( container ); 695} );; 696/* 697 * jQuery FlexSlider v2.1 698 * http://www.woothemes.com/flexslider/ 699 * 700 * Copyright 2012 WooThemes 701 * Free to use under the GPLv2 license. 702 * http://www.gnu.org/licenses/gpl-2.0.html 703 * 704 * Contributing author: Tyler Smith (@mbmufffin) 705 */ 706 707;(function ($) { 708 709 //FlexSlider: Object Instance 710 $.flexslider = function(el, options) { 711 var slider = $(el), 712 vars = $.extend({}, $.flexslider.defaults, options), 713 namespace = vars.namespace, 714 touch = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch, 715 eventType = (touch) ? "touchend" : "click", 716 vertical = vars.direction === "vertical", 717 reverse = vars.reverse, 718 carousel = (vars.itemWidth > 0), 719 fade = vars.animation === "fade", 720 asNav = vars.asNavFor !== "", 721 methods = {}; 722 723 // Store a reference to the slider object 724 $.data(el, "flexslider", slider); 725 726 // Privat slider methods 727 methods = { 728 init: function() { 729 slider.animating = false;
730 slider.currentSlide = vars.startAt; 731 slider.animatingTo = slider.currentSlide; 732 slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last); 733 slider.containerSelector = vars.selector.substr(0,vars.selector.search(' ')); 734 slider.slides = $(vars.selector, slider); 735 slider.container = $(slider.containerSelector, slider); 736 slider.count = slider.slides.length; 737 // SYNC: 738 slider.syncExists = $(vars.sync).length > 0; 739 // SLIDE: 740 if (vars.animation === "slide") vars.animation = "swing"; 741 slider.prop = (vertical) ? "top" : "marginLeft"; 742 slider.args = {}; 743 // SLIDESHOW: 744 slider.manualPause = false; 745 // TOUCH/USECSS: 746 slider.transitions = !vars.video && !fade && vars.useCSS && (function() { 747 var obj = document.createElement('div'), 748 props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']; 749 for (var i in props) { 750 if ( obj.style[ props[i] ] !== undefined ) { 751 slider.pfx = props[i].replace('Perspective','').toLowerCase(); 752 slider.prop = "-" + slider.pfx + "-transform"; 753 return true; 754 } 755 } 756 return false; 757 }()); 758 // CONTROLSCONTAINER: 759 if (vars.controlsContainer !== "") slider.controlsContainer = $(vars.controlsContainer).length > 0 && $(vars.controlsContainer); 760 // MANUAL: 761 if (vars.manualControls !== "") slider.manualControls = $(vars.manualControls).length > 0 && $(vars.manualControls); 762 763 // RANDOMIZE: 764 if (vars.randomize) { 765 slider.slides.sort(function() { return (Math.round(Math.random())-0.5); }); 766 slider.container.empty().append(slider.slides); 767 } 768 769 slider.doMath(); 770 771 // ASNAV: 772 if (asNav) methods.asNav.setup(); 773 774 // INIT 775 slider.setup("init"); 776 777 // CONTROLNAV: 778 if (vars.controlNav) methods.controlNav.setup(); 779 780 // DIRECTIONNAV: 781 if (vars.directionNav) methods.directionNav.setup(); 782 783 // KEYBOARD: 784 if (vars.keyboard && ($(slider.containerSelector).length === 1 || vars.multipleKeyboard)) { 785 $(document).bind('keyup', function(event) { 786 var keycode = event.keyCode; 787 if (!slider.animating && (keycode === 39 || keycode === 37)) { 788 var target = (keycode === 39) ? slider.getTarget('next') : 789 (keycode === 37) ? slider.getTarget('prev') : false; 790 slider.flexAnimate(target, vars.pauseOnAction); 791 } 792 }); 793 } 794 // MOUSEWHEEL: 795 if (vars.mousewheel) { 796 slider.bind('mousewheel', function(event, delta, deltaX, deltaY) { 797 event.preventDefault(); 798 var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev'); 799 slider.flexAnimate(target, vars.pauseOnAction); 800 }); 801 } 802 803 // PAUSEPLAY 804 if (vars.pausePlay) methods.pausePlay.setup(); 805 806 // SLIDSESHOW 807 if (vars.slideshow) { 808 if (vars.pauseOnHover) { 809 slider.hover(function() { 810 if (!slider.manualPlay && !slider.manualPause) slider.pause(); 811 }, function() { 812 if (!slider.manualPause && !slider.manualPlay) slider.play(); 813 }); 814 } 815 // initialize animation 816 (vars.initDelay > 0) ? setTimeout(slider.play, vars.initDelay) : slider.play(); 817 } 818 819 // TOUCH 820 if (touch && vars.touch) methods.touch(); 821 822 // FADE&&SMOOTHHEIGHT || SLIDE: 823 if (!fade || (fade && vars.smoothHeight)) $(window).bind("resize focus", methods.resize); 824 825 826 // API: start() Callback 827 setTimeout(function(){ 828 vars.start(slider); 829 }, 200); 830 }, 831 asNav: { 832 setup: function() { 833 slider.asNav = true; 834 slider.animatingTo = Math.floor(slider.currentSlide/slider.move); 835 slider.currentItem = slider.currentSlide; 836 slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide"); 837 slider.slides.click(function(e){ 838 e.preventDefault(); 839 var $slide = $(this), 840 target = $slide.index(); 841 if (!$(vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) { 842 slider.direction = (slider.currentItem < target) ? "next" : "prev"; 843 slider.flexAnimate(target, vars.pauseOnAction, false, true, true); 844 } 845 }); 846 } 847 }, 848 controlNav: { 849 setup: function() { 850 if (!slider.manualControls) {
851 methods.controlNav.setupPaging(); 852 } else { // MANUALCONTROLS: 853 methods.controlNav.setupManual(); 854 } 855 }, 856 setupPaging: function() { 857 var type = (vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging', 858 j = 1, 859 item; 860 861 slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>'); 862 863 if (slider.pagingCount > 1) { 864 for (var i = 0; i < slider.pagingCount; i++) { 865 item = (vars.controlNav === "thumbnails") ? '<img src="' + slider.slides.eq(i).attr("data-thumb") + '"/>' : '<a>' + j + '</a>'; 866 slider.controlNavScaffold.append('<li>' + item + '</li>'); 867 j++; 868 } 869 } 870 871 // CONTROLSCONTAINER: 872 (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold); 873 methods.controlNav.set(); 874 875 methods.controlNav.active(); 876 877 slider.controlNavScaffold.delegate('a, img', eventType, function(event) { 878 event.preventDefault(); 879 var $this = $(this), 880 target = slider.controlNav.index($this); 881 882 if (!$this.hasClass(namespace + 'active')) { 883 slider.direction = (target > slider.currentSlide) ? "next" : "prev"; 884 slider.flexAnimate(target, vars.pauseOnAction); 885 } 886 }); 887 // Prevent iOS click event bug 888 if (touch) { 889 slider.controlNavScaffold.delegate('a', "click touchstart", function(event) { 890 event.preventDefault(); 891 }); 892 } 893 }, 894 setupManual: function() { 895 slider.controlNav = slider.manualControls; 896 methods.controlNav.active(); 897 898 slider.controlNav.live(eventType, function(event) { 899 event.preventDefault(); 900 var $this = $(this), 901 target = slider.controlNav.index($this); 902 903 if (!$this.hasClass(namespace + 'active')) { 904 (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev"; 905 slider.flexAnimate(target, vars.pauseOnAction); 906 } 907 }); 908 // Prevent iOS click event bug 909 if (touch) { 910 slider.controlNav.live("click touchstart", function(event) { 911 event.preventDefault(); 912 }); 913 } 914 }, 915 set: function() { 916 var selector = (vars.controlNav === "thumbnails") ? 'img' : 'a'; 917 slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider); 918 }, 919 active: function() { 920 slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active"); 921 }, 922 update: function(action, pos) { 923 if (slider.pagingCount > 1 && action === "add") { 924 slider.controlNavScaffold.append($('<li><a>' + slider.count + '</a></li>')); 925 } else if (slider.pagingCount === 1) { 926 slider.controlNavScaffold.find('li').remove(); 927 } else { 928 slider.controlNav.eq(pos).closest('li').remove(); 929 } 930 methods.controlNav.set(); 931 (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active(); 932 } 933 }, 934 directionNav: { 935 setup: function() { 936 var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li><a class="' + namespace + 'prev" href="#">' + vars.prevText + '</a></li><li><a class="' + namespace + 'next" href="#">' + vars.nextText + '</a></li></ul>'); 937 938 // CONTROLSCONTAINER: 939 if (slider.controlsContainer) { 940 $(slider.controlsContainer).append(directionNavScaffold); 941 slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer); 942 } else { 943 slider.append(directionNavScaffold); 944 slider.directionNav = $('.' + namespace + 'direction-nav li a', slider); 945 } 946
947 methods.directionNav.update(); 948 949 slider.directionNav.bind(eventType, function(event) { 950 event.preventDefault(); 951 var target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev'); 952 slider.flexAnimate(target, vars.pauseOnAction); 953 }); 954 // Prevent iOS click event bug 955 if (touch) { 956 slider.directionNav.bind("click touchstart", function(event) { 957 event.preventDefault(); 958 }); 959 } 960 }, 961 update: function() { 962 var disabledClass = namespace + 'disabled'; 963 if (slider.pagingCount === 1) { 964 slider.directionNav.addClass(disabledClass); 965 } else if (!vars.animationLoop) { 966 if (slider.animatingTo === 0) { 967 slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass); 968 } else if (slider.animatingTo === slider.last) { 969 slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass); 970 } else { 971 slider.directionNav.removeClass(disabledClass); 972 } 973 } else { 974 slider.directionNav.removeClass(disabledClass); 975 } 976 } 977 }, 978 pausePlay: { 979 setup: function() { 980 var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a></a></div>'); 981 982 // CONTROLSCONTAINER: 983 if (slider.controlsContainer) { 984 slider.controlsContainer.append(pausePlayScaffold); 985 slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer); 986 } else { 987 slider.append(pausePlayScaffold); 988 slider.pausePlay = $('.' + namespace + 'pauseplay a', slider); 989 } 990 991 methods.pausePlay.update((vars.slideshow) ? namespace + 'pause' : namespace + 'play'); 992 993 slider.pausePlay.bind(eventType, function(event) { 994 event.preventDefault(); 995 if ($(this).hasClass(namespace + 'pause')) { 996 slider.manualPause = true; 997 slider.manualPlay = false; 998 slider.pause(); 999 } else { 1000 slider.manualPause = false; 1001 slider.manualPlay = true; 1002 slider.play(); 1003 } 1004 }); 1005 // Prevent iOS click event bug 1006 if (touch) { 1007 slider.pausePlay.bind("click touchstart", function(event) { 1008 event.preventDefault(); 1009 }); 1010 } 1011 }, 1012 update: function(state) { 1013 (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').text(vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').text(vars.pauseText); 1014 } 1015 }, 1016 touch: function() { 1017 var startX, 1018 startY, 1019 offset, 1020 cwidth, 1021 dx, 1022 startT, 1023 scrolling = false; 1024 1025 el.addEventListener('touchstart', onTouchStart, false); 1026 function onTouchStart(e) { 1027 if (slider.animating) { 1028 e.preventDefault(); 1029 } else if (e.touches.length === 1) { 1030 slider.pause(); 1031 // CAROUSEL: 1032 cwidth = (vertical) ? slider.h : slider. w; 1033 startT = Number(new Date()); 1034 // CAROUSEL: 1035 offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 : 1036 (carousel && reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) : 1037 (carousel && slider.currentSlide === slider.last) ? slider.limit : 1038 (carousel) ? ((slider.itemW + vars.itemMargin) * slider.move) * slider.currentSlide : 1039 (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth; 1040 startX = (vertical) ? e.touches[0].pageY : e.touches[0].pageX; 1041 startY = (vertical) ? e.touches[0].pageX : e.touches[0].pageY; 1042 1043 el.addEventListener('touchmove', onTouchMove, false); 1044 el.addEventListener('touchend', onTouchEnd, false); 1045 } 1046 } 1047 1048 function onTouchMove(e) { 1049 dx = (vertical) ? startX - e.touches[0].pageY : startX - e.touches[0].pageX; 1050 scrolling = (vertical) ? (Math.abs(dx) < Math.abs(e.touches[0].pageX - startY)) : (Math.abs(dx) < Math.abs(e.touches[0].pageY - startY)); 1051 1052 if (!scrolling || Number(new Date()) - startT > 500) { 1053 e.preventDefault(); 1054 if (!fade && slider.transitions) { 1055 if (!vars.animationLoop) { 1056 dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1); 1057 } 1058 slider.setProps(offset + dx, "setTouch"); 1059 } 1060 } 1061 } 1062 1063 function onTouchEnd(e) { 1064 if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) { 1065 var updateDx = (reverse) ? -dx : dx, 1066 target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev'); 1067 1068 if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) { 1069 slider.flexAnimate(target, vars.pauseOnAction); 1070 } else { 1071 slider.flexAnimate(slider.currentSlide, vars.pauseOnAction, true); 1072 } 1073 } 1074 // finish the touch by undoing the touch session 1075 el.removeEventListener('touchmove', onTouchMove, false); 1076 el.removeEventListener('touchend', onTouchEnd, false); 1077 startX = null; 1078 startY = null; 1079 dx = null; 1080 offset = null; 1081 } 1082 }, 1083 resize: function() { 1084 if (!slider.animating && slider.is(':visible')) { 1085 if (!carousel) slider.doMath(); 1086 1087 if (fade) { 1088 // SMOOTH HEIGHT: 1089 methods.smoothHeight(); 1090 } else if (carousel) { //CAROUSEL: 1091 slider.slides.width(slider.computedW); 1092 slider.update(slider.pagingCount); 1093 slider.setProps(); 1094 } 1095 else if (vertical) { //VERTICAL: 1096 slider.viewport.height(slider.h); 1097 slider.setProps(slider.h, "setTotal"); 1098 } else { 1099 // SMOOTH HEIGHT: 1100 if (vars.smoothHeight) methods.smoothHeight(); 1101 slider.newSlides.width(slider.computedW); 1102 slider.setProps(slider.computedW, "setTotal"); 1103 } 1104 } 1105 }, 1106 smoothHeight: function(dur) { 1107 if (!vertical || fade) { 1108 var $obj = (fade) ? slider : slider.viewport; 1109 (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur) : $obj.height(slider.slides.eq(slider.animatingTo).height()); 1110 } 1111 }, 1112 sync: function(action) { 1113 var $obj = $(vars.sync).data("flexslider"), 1114 target = slider.animatingTo; 1115 1116 switch (action) { 1117 case "animate": $obj.flexAnimate(target, vars.pauseOnAction, false, true); break; 1118 case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break; 1119 case "pause": $obj.pause(); break; 1120 } 1121 } 1122 } 1123 1124 // public methods 1125 slider.flexAnimate = function(target, pause, override, withSync, fromNav) { 1126 if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev"; 1127
1128 if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) { 1129 if (asNav && withSync) { 1130 var master = $(vars.asNavFor).data('flexslider'); 1131 slider.atEnd = target === 0 || target === slider.count - 1; 1132 master.flexAnimate(target, true, false, true, fromNav); 1133 slider.direction = (slider.currentItem < target) ? "next" : "prev"; 1134 master.direction = slider.direction; 1135 1136 if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) { 1137 slider.currentItem = target; 1138 slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide"); 1139 target = Math.floor(target/slider.visible); 1140 } else { 1141 slider.currentItem = target; 1142 slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide"); 1143 return false; 1144 } 1145 } 1146 1147 slider.animating = true; 1148 slider.animatingTo = target; 1149 // API: before() animation Callback 1150 vars.before(slider); 1151 1152 // SLIDESHOW: 1153 if (pause) slider.pause(); 1154 1155 // SYNC: 1156 if (slider.syncExists && !fromNav) methods.sync("animate"); 1157 1158 // CONTROLNAV 1159 if (vars.controlNav) methods.controlNav.active(); 1160 1161 // !CAROUSEL: 1162 // CANDIDATE: slide active class (for add/remove slide) 1163 if (!carousel) slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide'); 1164 1165 // INFINITE LOOP: 1166 // CANDIDATE: atEnd 1167 slider.atEnd = target === 0 || target === slider.last; 1168 1169 // DIRECTIONNAV: 1170 if (vars.directionNav) methods.directionNav.update(); 1171 1172 if (target === slider.last) { 1173 // API: end() of cycle Callback 1174 vars.end(slider); 1175 // SLIDESHOW && !INFINITE LOOP: 1176 if (!vars.animationLoop) slider.pause(); 1177 } 1178 1179 // SLIDE: 1180 if (!fade) { 1181 var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW, 1182 margin, slideString, calcNext; 1183 1184 // INFINITE LOOP / REVERSE: 1185 if (carousel) { 1186 margin = (vars.itemWidth > slider.w) ? vars.itemMargin * 2 : vars.itemMargin; 1187 calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo; 1188 slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext; 1189 } else if (slider.currentSlide === 0 && target === slider.count - 1 && vars.animationLoop && slider.direction !== "next") { 1190 slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0; 1191 } else if (slider.currentSlide === slider.last && target === 0 && vars.animationLoop && slider.direction !== "prev") { 1192 slideString = (reverse) ? 0 : (slider.count + 1) * dimension; 1193 } else { 1194 slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension; 1195 } 1196 slider.setProps(slideString, "", vars.animationSpeed); 1197 if (slider.transitions) { 1198 if (!vars.animationLoop || !slider.atEnd) { 1199 slider.animating = false; 1200 slider.currentSlide = slider.animatingTo; 1201 } 1202 slider.container.unbind("webkitTransitionEnd transitionend"); 1203 slider.container.bind("webkitTransitionEnd transitionend", function() { 1204 slider.wrapup(dimension); 1205 }); 1206 } else { 1207 slider.container.animate(slider.args, vars.animationSpeed, vars.easing, function(){ 1208 slider.wrapup(dimension); 1209 }); 1210 } 1211 } else { // FADE: 1212 slider.slides.eq(slider.currentSlide).fadeOut(vars.animationSpeed, vars.easing); 1213 slider.slides.eq(target).fadeIn(vars.animationSpeed, vars.easing, slider.wrapup); 1214 } 1215 // SMOOTH HEIGHT: 1216 if (vars.smoothHeight) methods.smoothHeight(vars.animationSpeed); 1217 } 1218 } 1219 slider.wrapup = function(dimension) { 1220 // SLIDE: 1221 if (!fade && !carousel) { 1222 if (slider.currentSlide === 0 && slider.animatingTo === slider.last && vars.animationLoop) { 1223 slider.setProps(dimension, "jumpEnd"); 1224 } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && vars.animationLoop) { 1225 slider.setProps(dimension, "jumpStart"); 1226 } 1227 } 1228 slider.animating = false;
1229 slider.currentSlide = slider.animatingTo; 1230 // API: after() animation Callback 1231 vars.after(slider); 1232 } 1233 1234 // SLIDESHOW: 1235 slider.animateSlides = function() { 1236 if (!slider.animating) slider.flexAnimate(slider.getTarget("next")); 1237 } 1238 // SLIDESHOW: 1239 slider.pause = function() { 1240 clearInterval(slider.animatedSlides); 1241 slider.playing = false; 1242 // PAUSEPLAY: 1243 if (vars.pausePlay) methods.pausePlay.update("play"); 1244 // SYNC: 1245 if (slider.syncExists) methods.sync("pause"); 1246 } 1247 // SLIDESHOW: 1248 slider.play = function() { 1249 slider.animatedSlides = setInterval(slider.animateSlides, vars.slideshowSpeed); 1250 slider.playing = true; 1251 // PAUSEPLAY: 1252 if (vars.pausePlay) methods.pausePlay.update("pause"); 1253 // SYNC: 1254 if (slider.syncExists) methods.sync("play"); 1255 } 1256 slider.canAdvance = function(target, fromNav) { 1257 // ASNAV: 1258 var last = (asNav) ? slider.pagingCount - 1 : slider.last; 1259 return (fromNav) ? true : 1260 (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true : 1261 (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false : 1262 (target === slider.currentSlide && !asNav) ? false : 1263 (vars.animationLoop) ? true : 1264 (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false : 1265 (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false : 1266 true; 1267 } 1268 slider.getTarget = function(dir) { 1269 slider.direction = dir; 1270 if (dir === "next") { 1271 return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1; 1272 } else { 1273 return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1; 1274 } 1275 } 1276 1277 // SLIDE: 1278 slider.setProps = function(pos, special, dur) { 1279 var target = (function() { 1280 var posCheck = (pos) ? pos : ((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo, 1281 posCalc = (function() { 1282 if (carousel) { 1283 return (special === "setTouch") ? pos : 1284 (reverse && slider.animatingTo === slider.last) ? 0 : 1285 (reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) : 1286 (slider.animatingTo === slider.last) ? slider.limit : posCheck; 1287 } else { 1288 switch (special) { 1289 case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos; 1290 case "setTouch": return (reverse) ? pos : pos; 1291 case "jumpEnd": return (reverse) ? pos : slider.count * pos; 1292 case "jumpStart": return (reverse) ? slider.count * pos : pos; 1293 default: return pos; 1294 } 1295 } 1296 }()); 1297 return (posCalc * -1) + "px"; 1298 }()); 1299 1300 if (slider.transitions) { 1301 target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)"; 1302 dur = (dur !== undefined) ? (dur/1000) + "s" : "0s"; 1303 slider.container.css("-" + slider.pfx + "-transition-duration", dur); 1304 } 1305 1306 slider.args[slider.prop] = target; 1307 if (slider.transitions || dur === undefined) slider.container.css(slider.args); 1308 } 1309 1310 slider.setup = function(type) { 1311 // SLIDE: 1312 if (!fade) { 1313 var sliderOffset, arr; 1314 1315 if (type === "init") { 1316 slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container); 1317 // INFINITE LOOP: 1318 slider.cloneCount = 0; 1319 slider.cloneOffset = 0; 1320 // REVERSE: 1321 if (reverse) { 1322 arr = $.makeArray(slider.slides).reverse(); 1323 slider.slides = $(arr); 1324 slider.container.empty().append(slider.slides); 1325 } 1326 } 1327 // INFINITE LOOP && !CAROUSEL: 1328 if (vars.animationLoop && !carousel) { 1329 slider.cloneCount = 2; 1330 slider.cloneOffset = 1; 1331 // clear out old clones 1332 if (type !== "init") slider.container.find('.clone').remove(); 1333 slider.container.append(slider.slides.first().clone().addClass('clone')).prepend(sli
1333der.slides.last().clone().addClass('clone')); 1334 } 1335 slider.newSlides = $(vars.selector, slider); 1336 1337 sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset; 1338 // VERTICAL: 1339 if (vertical && !carousel) { 1340 slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%"); 1341 setTimeout(function(){ 1342 slider.newSlides.css({"display": "block"}); 1343 slider.doMath(); 1344 slider.viewport.height(slider.h); 1345 slider.setProps(sliderOffset * slider.h, "init"); 1346 }, (type === "init") ? 100 : 0); 1347 } else { 1348 slider.container.width((slider.count + slider.cloneCount) * 200 + "%"); 1349 slider.setProps(sliderOffset * slider.computedW, "init"); 1350 setTimeout(function(){ 1351 slider.doMath(); 1352 slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"}); 1353 // SMOOTH HEIGHT: 1354 if (vars.smoothHeight) methods.smoothHeight(); 1355 }, (type === "init") ? 100 : 0); 1356 } 1357 } else { // FADE: 1358 slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"}); 1359 if (type === "init") slider.slides.eq(slider.currentSlide).fadeIn(vars.animationSpeed, vars.easing); 1360 // SMOOTH HEIGHT: 1361 if (vars.smoothHeight) methods.smoothHeight(); 1362 } 1363 // !CAROUSEL: 1364 // CANDIDATE: active slide 1365 if (!carousel) slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide"); 1366 } 1367 1368 slider.doMath = function() { 1369 var slide = slider.slides.first(), 1370 slideMargin = vars.itemMargin, 1371 minItems = vars.minItems, 1372 maxItems = vars.maxItems; 1373 1374 slider.w = slider.width(); 1375 slider.h = slide.height(); 1376 slider.boxPadding = slide.outerWidth() - slide.width(); 1377 1378 // CAROUSEL: 1379 if (carousel) { 1380 slider.itemT = vars.itemWidth + slideMargin; 1381 slider.minW = (minItems) ? minItems * slider.itemT : slider.w; 1382 slider.maxW = (maxItems) ? maxItems * slider.itemT : slider.w; 1383 slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * minItems))/minItems : 1384 (slider.maxW < slider.w) ? (slider.w - (slideMargin * maxItems))/maxItems : 1385 (vars.itemWidth > slider.w) ? slider.w : vars.itemWidth; 1386 slider.visible = Math.floor(slider.w/(slider.itemW + slideMargin)); 1387 slider.move = (vars.move > 0 && vars.move < slider.visible ) ? vars.move : slider.visible; 1388 slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1); 1389 slider.last = slider.pagingCount - 1; 1390 slider.limit = (slider.pagingCount === 1) ? 0 : 1391 (vars.itemWidth > slider.w) ? ((slider.itemW + (slideMargin * 2)) * slider.count) - slider.w - slideMargin : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin; 1392 } else { 1393 slider.itemW = slider.w; 1394 slider.pagingCount = slider.count; 1395 slider.last = slider.count - 1; 1396 } 1397 slider.computedW = slider.itemW - slider.boxPadding; 1398 } 1399 1400 slider.update = function(pos, action) { 1401 slider.doMath(); 1402 1403 // update currentSlide and slider.animatingTo if necessary 1404 if (!carousel) { 1405 if (pos < slider.currentSlide) { 1406 slider.currentSlide += 1; 1407 } else if (pos <= slider.currentSlide && pos !== 0) { 1408 slider.currentSlide -= 1; 1409 } 1410 slider.animatingTo = slider.currentSlide; 1411 } 1412 1413 // update controlNav 1414 if (vars.controlNav && !slider.manualControls) { 1415 if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) { 1416 methods.controlNav.update("add"); 1417 } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) { 1418 if (carousel && slider.currentSlide > slider.last) { 1419 slider.currentSlide -= 1; 1420 slider.animatingTo -= 1; 1421 } 1422 methods.controlNav.update("remove", slider.last); 1423 } 1424 } 1425 // update directionNav
1426 if (vars.directionNav) methods.directionNav.update(); 1427 1428 } 1429 1430 slider.addSlide = function(obj, pos) { 1431 var $obj = $(obj); 1432 1433 slider.count += 1; 1434 slider.last = slider.count - 1; 1435 1436 // append new slide 1437 if (vertical && reverse) { 1438 (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj); 1439 } else { 1440 (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj); 1441 } 1442 1443 // update currentSlide, animatingTo, controlNav, and directionNav 1444 slider.update(pos, "add"); 1445 1446 // update slider.slides 1447 slider.slides = $(vars.selector + ':not(.clone)', slider); 1448 // re-setup the slider to accomdate new slide 1449 slider.setup(); 1450 1451 //FlexSlider: added() Callback 1452 vars.added(slider); 1453 } 1454 slider.removeSlide = function(obj) { 1455 var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj; 1456 1457 // update count 1458 slider.count -= 1; 1459 slider.last = slider.count - 1; 1460 1461 // remove slide 1462 if (isNaN(obj)) { 1463 $(obj, slider.slides).remove(); 1464 } else { 1465 (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove(); 1466 } 1467 1468 // update currentSlide, animatingTo, controlNav, and directionNav 1469 slider.doMath(); 1470 slider.update(pos, "remove"); 1471 1472 // update slider.slides 1473 slider.slides = $(vars.selector + ':not(.clone)', slider); 1474 // re-setup the slider to accomdate new slide 1475 slider.setup(); 1476 1477 // FlexSlider: removed() Callback 1478 vars.removed(slider); 1479 } 1480 1481 //FlexSlider: Initialize 1482 methods.init(); 1483 } 1484 1485 //FlexSlider: Default Settings 1486 $.flexslider.defaults = { 1487 namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin 1488 selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril 1489 animation: "fade", //String: Select your animation type, "fade" or "slide" 1490 easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported! 1491 direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical" 1492 reverse: false, //{NEW} Boolean: Reverse the animation direction 1493 animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end 1494 smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode 1495 startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide) 1496 slideshow: true, //Boolean: Animate slider automatically 1497 slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds 1498 animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds 1499 initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds 1500 randomize: false, //Boolean: Randomize slide order 1501 1502 // Usability features 1503 pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended. 1504 pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering 1505 useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available 1506 touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices 1507 video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches 1508 1509 // Primary Controls 1510 controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage 1511 directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false) 1512 prevText: "Previous", //String: Set the text for the "previous" directionNav item 1513 nextText: "Next", //String: Set the text for the "next" directionNav item 1514 1515 // Secondary Navigation 1516 keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys 1517 multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present. 1518 mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
1519 pausePlay: false, //Boolean: Create pause/play dynamic element 1520 pauseText: "Pause", //String: Set the text for the "pause" pausePlay item 1521 playText: "Play", //String: Set the text for the "play" pausePlay item 1522 1523 // Special properties 1524 controlsContainer: "", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found. 1525 manualControls: "", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs. 1526 sync: "", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care. 1527 asNavFor: "", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider 1528 1529 // Carousel Options 1530 itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding. 1531 itemMargin: 0, //{NEW} Integer: Margin between carousel items. 1532 minItems: 0, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this. 1533 maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit. 1534 move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items. 1535 1536 // Callback API 1537 start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide 1538 before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation 1539 after: function(){}, //Callback: function(slider) - Fires after each slider animation completes 1540 end: function(){}, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous) 1541 added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added 1542 removed: function(){} //{NEW} Callback: function(slider) - Fires after a slide is removed 1543 } 1544 1545 1546 //FlexSlider: Plugin Function 1547 $.fn.flexslider = function(options) { 1548 if (options === undefined) options = {}; 1549 1550 if (typeof options === "object") { 1551 return this.each(function() { 1552 var $this = $(this), 1553 selector = (options.selector) ? options.selector : ".slides > li", 1554 $slides = $this.find(selector); 1555 1556 if ($slides.length === 1) { 1557 $slides.fadeIn(400); 1558 if (options.start) options.start($this); 1559 } else if ($this.data('flexslider') === undefined) { 1560 new $.flexslider(this, options); 1561 } 1562 }); 1563 } else { 1564 // Helper strings to quickly perform functions on the slider 1565 var $slider = $(this).data('flexslider'); 1566 switch (options) { 1567 case "play": $slider.play(); break; 1568 case "pause": $slider.pause(); break; 1569 case "next": $slider.flexAnimate($slider.getTarget("next"), true); break; 1570 case "prev": 1571 case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break; 1572 default: if (typeof options === "number") $slider.flexAnimate(options, true); 1573 } 1574 } 1575 } 1576 1577})(jQuery);; 1578( function( $ ) { 1579 $( window ).load( function() { 1580 $( '.featured' ).css( { 1581 display: 'none' 1582 } ); 1583 1584 $( '.featured:first-child' ).css( { 1585 display: 'list-item' 1586 } ); 1587 1588 $( '.featured-posts-wrapper' ).animate( { 1589 opacity:1 1590 },400 ); 1591 1592 $( '.featured-posts' ).flexslider( { 1593 animation: 'fade', 1594 slideshow: false, 1595 before: function( slider ){ 1596 $( window ).trigger( 'resize' ); 1597 } 1598 } ); 1599 1600 $( '.featured-posts-super-wrapper' ).removeClass( 'loading' ); 1601 } ); 1602} )( jQuery );; 1603!function(){var e=document.currentScript;function t(t){var n=document.createElement("script"),o=e||document.getElementsByTagName("script")[0];n.setAttribute("async",!0),n.setAttribute("src",t),o.parentNode.insertBefore(n,o)}function n(e,t){return Element.prototype.matches?e.matches(t):Element.prototype.msMatchesSelector?e.msMatchesSelector(t):void 0}function o(e,t){if(e.closest)return e.closest(t);var o=e;do{if(n(o,t))return o;o=o.parentElement||o.parentNode}while(null!==o&&1===o.nodeType);return null}function i(e,t){for(var n=0;n<e.length;n++)t(e[n],n,e)}var r,s=".sharing-hidden .inner",a="data-sharing-more-button-id";function c(e){this.button=e,this.pane=o(e,"div").querySelector(s),this.openedBy=null,this.recentlyOpenedByHover=!1,c.instances.push(this),this.pane.setAttribute(a,c.instances.length-1),this.attachHandlers()}if(c.instances=[],c.hoverOpenDelay=200,c.recentOpenDelay=400,c.hoverCloseDelay=300,c.instantiateOrReuse=function(e){var t=o(e,"div").querySelector(s),n=t&&t.getAttribute(a),i=c.instances[n];return i||new c(e)},c.getButtonInstanceFromPane=function(e){var t=e&&e.getAttribute(a);return c.instances[t]},c.closeAll=function(){for(var e=0;e<c.instances.length;e++)c.instances[e].close()},c.prototype.open=function(){var e,t,n=[0,0];function o(e){var t=e.getBoundingClientRect();return[t.left+(window.scrollX||window.pageXOffset||0),t.top+(window.scrollY||window.pageYOffset||0)]}function i(e,t){return parseInt(getComputedStyle(e).getPropertyValue(t)||0)}for(e=o(this.button),t=this.button.offsetParent||document.documentElement;t&&(t===document.body||t===document.documentElement)&&"static"===getComputedStyle(t).getPropertyValue("position");)t=t.parentNode;t&&t!==this.button&&1===t.nodeType&&(n=[(n=o(t))[0]+i(t,"border-left-width"),n[1]+i(t,"border-top-width")]);var r,s=e[0]-n[0]-i(this.button,"margin-left"),a=e[1]-n[1]-i(this.button,"margin-top");this.pane.style.left=s+"px",this.pane.style.top=a+this.button.offsetHeight+3+"px",(r=this.pane)&&r.style.removeProperty("display")},c.prototype.close=function(){var e;(e=this.pane)&&(e.style.display="none"),this.openedBy=null},c.prototype.toggle=function(){var e;(e=this.pane)&&"none"!==e.style.display?this.close():this.open()}
1603,c.prototype.nonHoverOpen=function(){clearTimeout(this.openTimer),clearTimeout(this.closeTimer),this.recentlyOpenedByHover?(this.recentlyOpenedByHover=!1,clearTimeout(this.hoverOpenTimer),this.open()):this.toggle()},c.prototype.resetCloseTimer=function(){clearTimeout(this.closeTimer),this.closeTimer=setTimeout(this.close.bind(this),c.hoverCloseDelay)},c.prototype.attachHandlers=function(){this.buttonClick=function(e){e.preventDefault(),e.stopPropagation(),this.openedBy="click",this.nonHoverOpen()}.bind(this),this.buttonKeydown=function(e){13!==e.keyCode&&32!==e.keyCode||(e.preventDefault(),e.stopPropagation(),this.openedBy="keydown",this.nonHoverOpen())}.bind(this),this.buttonEnter=function(){this.openedBy||(this.openTimer=setTimeout(function(){this.open(),this.openedBy="hover",this.recentlyOpenedByHover=!0,this.hoverOpenTimer=setTimeout(function(){this.recentlyOpenedByHover=!1}.bind(this),c.recentOpenDelay)}.bind(this),c.hoverOpenDelay)),clearTimeout(this.closeTimer)}.bind(this),this.buttonLeave=function(){"hover"===this.openedBy&&this.resetCloseTimer(),clearTimeout(this.openTimer)}.bind(this),this.paneEnter=function(){clearTimeout(this.closeTimer)}.bind(this),this.paneLeave=function(){"hover"===this.openedBy&&this.resetCloseTimer()}.bind(this),this.documentClick=function(){this.close()}.bind(this),this.button.addEventListener("click",this.buttonClick),this.button.addEventListener("keydown",this.buttonKeydown),document.addEventListener("click",this.documentClick),void 0===document.ontouchstart&&(this.button.addEventListener("mouseenter",this.buttonEnter),this.button.addEventListener("mouseleave",this.buttonLeave),this.pane.addEventListener("mouseenter",this.paneEnter),this.pane.addEventListener("mouseleave",this.paneLeave))},window.sharing_js_options&&window.sharing_js_options.counts){var u={done_urls:[],get_counts:function(){var e,n,o,i,r;if("undefined"!=typeof WPCOM_sharing_counts)for(e in WPCOM_sharing_counts)if(o=WPCOM_sharing_counts[e],void 0===u.done_urls[o]){for(i in n={pinterest:[window.location.protocol+"//api.pinterest.com/v1/urls/count.json?callback=WPCOMSharing.update_pinterest_count&url="+encodeURIComponent(e)]})if(document.querySelector("a[data-shared=sharing-"+i+"-"+o+"]")){for(;r=n[i].pop();)t(r);window.sharing_js_options.is_stats_active&&u.bump_sharing_count_stat(i)}u.done_urls[o]=!0}},update_pinterest_count:function(e){void 0!==e.count&&1*e.count>0&&u.inject_share_count("sharing-pinterest-"+WPCOM_sharing_counts[e.url],e.count)},inject_share_count:function(e,t){i(document.querySelectorAll("a[data-shared="+e+"] > span"),function(e){var n,o=e.querySelector(".share-count");(n=o)&&n.parentNode&&n.parentNode.removeChild(n);var i=document.createElement("span");i.className="share-count",i.textContent=u.format_count(t),e.appendChild(i)})},format_count:function(e){return e<1e3?e:e>=1e3&&e<1e4?String(e).substring(0,1)+"K+":"10K+"},bump_sharing_count_stat:function(e){(new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv&x_sharing-count-request="+e+"&r="+Math.random()}};window.WPCOMSharing=u}function d(e,t){e.setAttribute("jetpack-share-click-count",t)}function l(e){var t=e.getAttribute("jetpack-share-click-count");return null===t?0:parseInt(t,10)}function h(e,t){var n,o=new XMLHttpRequest;o.open("POST",e,!0),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),o.setRequestHeader("x-requested-with","XMLHttpRequest"),o.send((n=t,(encodeURIComponent("email-share-nonce")+"="+encodeURIComponent(n)).replace(/%20/g,"+")))}function p(){m()}function m(){window.WPCOMSharing&&window.WPCOMSharing.get_counts(),i(document.querySelectorAll(".sharedaddy a"),function(e){var t=e.getAttribute("href");t&&-1!==t.indexOf("share=")&&-1===t.indexOf("&nb=1")&&e.setAttribute("href",t+"&nb=1")}),i(document.querySelectorAll(".sharedaddy a.sharing-anchor"),function(e){c.instantiateOrReuse(e)}),void 0!==document.ontouchstart&&document.body.classList.add("jp-sharing-input-touch"),i(document.querySelectorAll(".sharedaddy ul"),function(e){"true"!==e.getAttribute("data-sharing-events-added")&&(e.setAttribute("data-sharing-events-added","true"),i(e.querySelectorAll("a.share-print"),function(e){e.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation();var n=e.getAttribute("href")||"",i=function(){if(-1===n.indexOf("#print")){var e=(new Date).getTime();t=e,o=n,(i=document.createElement("iframe")).setAttribute("style","position:fixed; top:100; left:100; height:1px; width:1px; border:none;"),i.setAttribute("id","printFrame-"+t),i.setAttribute("name",i.getAttribute("id")),i.setAttribute("src",o),i.setAttribute("onload",'frames["printFrame-'+t+'"].focus();frames["printFrame-'+t+'"].print();'),document.body.appendChild(i)}else window.print();var t,o,i}
1603,r=o(e,s);if(r){var a=c.getButtonInstanceFromPane(r);a&&(a.close(),i())}else i()})}),i(e.querySelectorAll("a.share-press-this"),function(e){var t="wp-press-this-"+Math.random().toString(36).slice(2);e.addEventListener("click",function(n){n.preventDefault(),n.stopPropagation();var o="";if(window.getSelection?o=window.getSelection():document.getSelection?o=document.getSelection():document.selection&&(o=document.selection.createRange().text),o){var i=e.getAttribute("href");e.setAttribute("href",i+"&sel="+encodeURI(o))}window.open(e.getAttribute("href"),t,"toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570")||(document.location.href=e.getAttribute("href"))})}),i(e.querySelectorAll("a.share-email"),function(t){d(t,0);var n,o,r=t.getAttribute("data-email-share-nonce"),s=t.getAttribute("data-email-share-track-url");r&&s&&(n=s,o=window.location.protocol+"//"+window.location.hostname+"/",0===String(n).indexOf(o))&&t.addEventListener("click",function(){var n;d(n=t,l(n)+1),l(t)>2&&function(e,t){var n=t.parentElement;if(n.classList.contains("sd-content")){i(n.querySelectorAll(".share-email-error"),function(e){e.parentElement.removeChild(e)});var o=document.createElement("div");o.className="share-email-error";var r=document.createElement("h6");r.className="share-email-error-title",r.innerText=e.getAttribute("data-email-share-error-title"),o.appendChild(r);var s=document.createElement("p");s.className="share-email-error-text",s.innerText=e.getAttribute("data-email-share-error-text"),o.appendChild(s),n.appendChild(o)}}(t,e),h(s,r)})}))}),i(document.querySelectorAll("li.share-email, li.share-custom a.sharing-anchor"),function(e){e.classList.add("share-service-visible")})}"loading"!==document.readyState?p():document.addEventListener("DOMContentLoaded",p),document.body.addEventListener("is.post-load",m);var f={};!0!==window.WPCOM_sharing_popups_bound&&(document.body.addEventListener("click",function(e){var t=e.target;if(t&&1===t.nodeType){var n=function(e){if("A"===e.nodeName)return e;var t=e.parentNode;return t&&"A"===t.nodeName?t:null}(t);if(n){var o=function(e){var t=window.WPCOM_sharing_popups;if(!t)return null;for(var n="share-",o=(e.getAttribute("class")||"").split(/\s+/),i=0;i<o.length;i++)if(0===o[i].indexOf(n)){var r=o[i].slice(6);if("string"==typeof t[r])return r}return null}(n);o&&(e.preventDefault(),r&&r.close(),r=window.open(n.getAttribute("href"),function(e){return"string"!=typeof f[e]&&(f[e]="wpcom"+e+"-"+Math.random().toString(36).slice(2)),f[e]}(o),window.WPCOM_sharing_popups[o]))}}}),window.WPCOM_sharing_popups_bound=!0)}();;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.