1 line
2.9 KiB
JavaScript
1 line
2.9 KiB
JavaScript
!function(d,f){"use strict";var r,t,e,n=f.querySelector&&d.addEventListener,b=!1;function h(e,t){d.parent.postMessage({message:e,value:t,secret:r},"*")}function a(){if(!b){b=!0;var e,r=f.querySelector(".wp-embed-share-dialog"),t=f.querySelector(".wp-embed-share-dialog-open"),n=f.querySelector(".wp-embed-share-dialog-close"),a=f.querySelectorAll(".wp-embed-share-input"),i=f.querySelectorAll(".wp-embed-share-tab-button button"),s=f.getElementsByTagName("a");if(a)for(e=0;e<a.length;e++)a[e].addEventListener("click",function(e){e.target.select()});if(t&&t.addEventListener("click",function(){r.className=r.className.replace("hidden",""),f.querySelector('.wp-embed-share-tab-button [aria-selected="true"]').focus()}),n&&n.addEventListener("click",function(){o()}),i)for(e=0;e<i.length;e++)i[e].addEventListener("click",l),i[e].addEventListener("keydown",u);if(f.addEventListener("keydown",function(e){var t;27===e.keyCode&&-1===r.className.indexOf("hidden")?o():9===e.keyCode&&(t=e,e=f.querySelector('.wp-embed-share-tab-button [aria-selected="true"]'),n!==t.target||t.shiftKey?e===t.target&&t.shiftKey&&(n.focus(),t.preventDefault()):(e.focus(),t.preventDefault()))},!1),d.self!==d.top)for(h("height",Math.ceil(f.body.getBoundingClientRect().height)),e=0;e<s.length;e++)s[e].addEventListener("click",c)}function o(){r.className+=" hidden",f.querySelector(".wp-embed-share-dialog-open").focus()}function l(e){var t=f.querySelector('.wp-embed-share-tab-button [aria-selected="true"]');t.setAttribute("aria-selected","false"),f.querySelector("#"+t.getAttribute("aria-controls")).setAttribute("aria-hidden","true"),e.target.setAttribute("aria-selected","true"),f.querySelector("#"+e.target.getAttribute("aria-controls")).setAttribute("aria-hidden","false")}function u(e){var t,r=e.target,n=r.parentElement.previousElementSibling,a=r.parentElement.nextElementSibling;if(37===e.keyCode)t=n;else{if(39!==e.keyCode)return!1;t=a}(t="rtl"===f.documentElement.getAttribute("dir")?t===n?a:n:t)&&(t=t.firstElementChild,r.setAttribute("tabindex","-1"),r.setAttribute("aria-selected",!1),f.querySelector("#"+r.getAttribute("aria-controls")).setAttribute("aria-hidden","true"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected","true"),t.focus(),f.querySelector("#"+t.getAttribute("aria-controls")).setAttribute("aria-hidden","false"))}function c(e){var t=e.target,t=(t.hasAttribute("href")?t:t.parentElement).getAttribute("href");h("link",t),e.preventDefault()}}n&&(!function e(){d.self===d.top||r||(r=d.location.hash.replace(/.*secret=([\d\w]{10}).*/,"$1"),clearTimeout(t),t=setTimeout(function(){e()},100))}(),f.documentElement.className=f.documentElement.className.replace(/\bno-js\b/,"")+" js",f.addEventListener("DOMContentLoaded",a,!1),d.addEventListener("load",a,!1),d.addEventListener("resize",function(){d.self!==d.top&&(clearTimeout(e),e=setTimeout(function(){h("height",Math.ceil(f.body.getBoundingClientRect().height))},100))},!1))}(window,document); |