/* Do not modify this file directly. It is compiled from other files. */ /* global WPCOM_sharing_counts, grecaptcha */ !function(){var e=document.currentScript,t=!1;function n(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 o(e,t){return Element.prototype.matches?e.matches(t):Element.prototype.msMatchesSelector?e.msMatchesSelector(t):void 0}function r(e,t){if(e.closest)return e.closest(t);var n=e;do{if(o(n,t))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null}function i(e,t){for(var n=0;n0&&p.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){a(e.querySelector(".share-count"));var n=document.createElement("span");n.className="share-count",n.textContent=p.format_count(t),e.appendChild(n)})},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=p}function f(e){return/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(e)}function m(){s(document.querySelector("#sharing_email"))}function g(){var e=document.querySelector("#sharing_email");e&&document.body.appendChild(e),F()}function F(){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){h.instantiateOrReuse(e)}),void 0!==document.ontouchstart&&document.body.classList.add("jp-sharing-input-touch"),i(document.querySelectorAll(".sharedaddy ul"),function(e){if("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")||"",o=function(){if(-1===n.indexOf("#print")){var e=(new Date).getTime();t=e,o=n,(r=document.createElement("iframe")).setAttribute("style","position:fixed; top:100; left:100; height:1px; width:1px; border:none;"),r.setAttribute("id","printFrame-"+t),r.setAttribute("name",r.getAttribute("id")),r.setAttribute("src",o),r.setAttribute("onload",'frames["printFrame-'+t+'"].focus();frames["printFrame-'+t+'"].print();'),document.body.appendChild(r)}else window.print();var t,o,r},i=r(e,l);if(i){var a=h.getButtonInstanceFromPane(i);a&&(a.close(),o())}else o()})}),i(e.querySelectorAll("a.share-press-this"),function(e){e.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation();var n="";if(window.getSelection?n=window.getSelection():document.getSelection?n=document.getSelection():document.selection&&(n=document.selection.createRange().text),n){var o=e.getAttribute("href");e.setAttribute("href",o+"&sel="+encodeURI(n))}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(e){var o=document.querySelector("#sharing_email");e.addEventListener("click",function(r){if(r.preventDefault(),r.stopPropagation(),"object"!=typeof grecaptcha&&!t){var i=document.querySelector(".g-recaptcha");i&&"true"===i.getAttribute("data-lazy")&&(t=!0,n(decodeURI(i.getAttribute("data-url"))))}var s=e.getAttribute("href"),l=window.location.protocol+"//"+window.location.hostname+"/";if(0!==s.indexOf(l))return!0;if(c(o)){a(document.querySelector("#sharing_email .response"));var d=document.querySelector("#sharing_email form");u(d),d.querySelector("input[type=submit]").removeAttribute("disabled"),u(d.querySelector("a.sharing_cancel")),"object"==typeof grecaptcha&&"function"==typeof grecaptcha.reset&&window.___grecaptcha_cfg.count&&grecaptcha.reset();var p=e.getBoundingClientRect(),f=window.pageXOffset||document.documentElement.scrollLeft||0,g=window.pageYOffset||document.documentElement.scrollTop||0;o.style.left=f+p.left+"px",o.style.top=g+p.top+p.height+"px",u(o),h.closeAll()}else m()}),o.querySelector("a.sharing_cancel").addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),s(o.querySelector(".errors")),s(o),s(document.querySelector("#sharing_background"))});var l=o.querySelector("input[type=submit]");l.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation();var n=r(l,"form"),a=n.querySelector("input[name=source_email]"),c=n.querySelector("input[name=target_email]");if(l.setAttribute("disabled",!0),s(n.querySelector("a.sharing_cancel")),i(n.querySelectorAll("img.loading"),function(e){u(e)}),s(n.querySelector(".errors")),i(n.querySelectorAll(".error"),function(e){e.classList.remove("error")}),f(a.value)||a.classList.add("error"),f(c.value)||c.classList.add("error"),!n.querySelector(".error")){for(var d=[],h=0;h