// NOTICE! This file exists in WPCOM & WPCOMSH. Updates need to be synced to both repos. (function () { document.addEventListener("DOMContentLoaded", function () { const hostnames = ['wordpress.com', 'w.link', 'automattic.com']; // Make sure we never show the banner on these hostnames. if (hostnames.includes(window.location.hostname)) { return; } var bumpStat = function (statName) { new Image().src = document.location.protocol + "//pixel.wp.com/b.gif" + "?v=wpcom-no-pv" + "&x_simple_gifting_banner=" + statName + "&rand=" + Math.random(); }; if (!document.cookie.includes("wpcom_gifting_banner_gifter=true")) { giftingBanner(); bumpStat("viewed_total"); document.getElementById("wpcom-gifting-banner-button").onclick = function () { bumpStat("clicked"); window.location.href = gifting_banner.checkout_link; }; document.getElementById("wpcom-gifting-banner-more-info-button").onclick = function () { bumpStat("moreinfo"); window.open(gifting_banner.more_info_link, "_blank"); }; } }); function giftingBanner() { // Check for hash in URL to see if we should dismiss the banner var hash = location.hash; if ("#gift-thank-you" === hash) { var expiration = new Date(); expiration.setTime( expiration.getTime() + 1000 * 60 * 60 * 24 * gifting_banner.dismiss_days_count ); var expires = "expires=" + expiration.toUTCString(); document.cookie = "wpcom_gifting_banner_gifter=true;" + expires + ";path=/"; location.hash = ""; return; } var notice = document.createElement("div"); notice.setAttribute("id", "wpcom-gifting-banner"); notice.classList.add("wpcom-gifting-banner"); document.documentElement.classList.add("has-wpcom-gifting-banner"); notice.innerHTML = '
' + '' + '
' + '' + '🎁' + '' + "
" + '' + "
"; const title = document.createTextNode(gifting_banner.i18n.title); const subtitle = document.createTextNode(gifting_banner.i18n.subtitle); const more_info_button = document.createElement("BUTTON"); more_info_button.setAttribute( "id", "wpcom-gifting-banner-more-info-button" ); more_info_button.setAttribute( "class", "wpcom-gifting-banner__more-info-button" ); const button_text = document.createTextNode( gifting_banner.i18n.button_text ); notice .getElementsByClassName("wpcom-gifting-banner__title")[0] .appendChild(title); notice .getElementsByClassName("wpcom-gifting-banner__subtitle")[0] .appendChild(subtitle); notice .getElementsByClassName("wpcom-gifting-banner__subtitle")[0] .appendChild(more_info_button); notice .getElementsByClassName("wpcom-gifting-banner__button")[0] .appendChild(button_text); document.body.prepend(notice); } })(); ; (()=>{var t={79366:(t,r,e)=>{"object"==typeof window&&window.Jetpack_Block_Assets_Base_Url&&(e.p=window.Jetpack_Block_Assets_Base_Url)}},r={};function e(o){var n=r[o];if(void 0!==n)return n.exports;var i=r[o]={exports:{}};return t[o](i,i.exports,e),i.exports}e.n=t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},e.d=(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),e.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),(()=>{var t;e.g.importScripts&&(t=e.g.location+"");var r=e.g.document;if(!t&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(t=r.currentScript.src),!t)){var o=r.getElementsByTagName("script");if(o.length)for(var n=o.length-1;n>-1&&(!t||!/^http(s?):/.test(t));)t=o[n--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=t+"../"})(),(()=>{"use strict";e(79366)})()})();;