kollapsminoriteten/wp-content/plugins/jetpack/_inc/build/sharedaddy/sharing.min.js

1 line
11 KiB
JavaScript
Raw Normal View History

2022-04-02 10:26:41 +02:00
!function(){var e=document.currentScript,t=!1;function n(t){var n=document.createElement("script"),r=e||document.getElementsByTagName("script")[0];n.setAttribute("async",!0),n.setAttribute("src",t),r.parentNode.insertBefore(n,r)}function r(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 n=e;do{if(r(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;n<e.length;n++)t(e[n],n,e)}function u(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function s(e){e&&(e.style.display="none")}function a(e){e&&e.style.removeProperty("display")}function c(e){return!e||"none"===e.style.display}var l=".sharing-hidden .inner",d="data-sharing-more-button-id";function h(e){this.button=e,this.pane=o(e,"div").querySelector(l),this.openedBy=null,this.recentlyOpenedByHover=!1,h.instances.push(this),this.pane.setAttribute(d,h.instances.length-1),this.attachHandlers()}if(h.instances=[],h.hoverOpenDelay=200,h.recentOpenDelay=400,h.hoverCloseDelay=300,h.instantiateOrReuse=function(e){var t=o(e,"div").querySelector(l),n=t&&t.getAttribute(d),r=h.instances[n];return r||new h(e)},h.getButtonInstanceFromPane=function(e){var t=e&&e.getAttribute(d);return h.instances[t]},h.closeAll=function(){for(var e=0;e<h.instances.length;e++)h.instances[e].close()},h.prototype.open=function(){var e,t,n=[0,0];function r(e){var t=e.getBoundingClientRect();return[t.left+(window.scrollX||window.pageXOffset||0),t.top+(window.scrollY||window.pageYOffset||0)]}function o(e,t){return parseInt(getComputedStyle(e).getPropertyValue(t)||0)}for(e=r(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=r(t))[0]+o(t,"border-left-width"),n[1]+o(t,"border-top-width")]);var i=e[0]-n[0]-o(this.button,"margin-left"),u=e[1]-n[1]-o(this.button,"margin-top");this.pane.style.left=i+"px",this.pane.style.top=u+this.button.offsetHeight+3+"px",a(this.pane)},h.prototype.close=function(){s(this.pane),this.openedBy=null},h.prototype.toggle=function(){c(this.pane)?this.open():this.close()},h.prototype.resetCloseTimer=function(){clearTimeout(this.closeTimer),this.closeTimer=setTimeout(this.close.bind(this),h.hoverCloseDelay)},h.prototype.attachHandlers=function(){this.buttonClick=function(e){e.preventDefault(),e.stopPropagation(),this.openedBy="click",clearTimeout(this.openTimer),clearTimeout(this.closeTimer),f(),this.recentlyOpenedByHover?(this.recentlyOpenedByHover=!1,clearTimeout(this.hoverOpenTimer),this.open()):this.toggle()}.bind(this),this.buttonEnter=function(){this.openedBy||(this.openTimer=setTimeout(function(){f(),this.open(),this.openedBy="hover",this.recentlyOpenedByHover=!0,this.hoverOpenTimer=setTimeout(function(){this.recentlyOpenedByHover=!1}.bind(this),h.recentOpenDelay)}.bind(this),h.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),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 p={done_urls:[],get_counts:function(){var e,t,r,o,i;if("undefined"!=typeof WPCOM_sharing_counts)for(e in WPCOM_sharing_counts)if(r=WPCOM_sharing_counts[e],void 0===p.done_urls[r]){for(o in t={pinterest:[window.location.protocol+"//