PluginProbe
Embed Privacy / 1.11.0
Embed Privacy v1.11.0
1.14.0 1.13.0 trunk 0.1 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.1.3 1.10.0 1.10.1 1.10.10 1.10.2 1.10.3 1.10.4 1.10.5 1.10.6 1.10.7 1.10.8 1.10.9 1.11.0 1.11.1 1.11.2 All 68 releases
embed-privacy / assets / js / embed-privacy.min.js

embed-privacy.min.js in Embed Privacy 1.11.0, at assets/js/embed-privacy.min.js

1 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (()=>{function e(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var c=r[n];" "==c.charAt(0);)c=c.substring(1,c.length);if(0==c.indexOf(t))return c.substring(t.length,c.length)}return null}function t(e,t,r){var n="";if(r){var c=new Date;c.setTime(c.getTime()+24*r*60*60*1e3),n="; expires="+c.toUTCString()}document.cookie=e+"="+(t||"")+n+"; path=/"}document.addEventListener("DOMContentLoaded",(function(){var r=document.querySelectorAll(".embed-privacy-inner .embed-privacy-input"),n=document.querySelectorAll(".embed-privacy-inner .embed-privacy-label"),c=document.querySelectorAll(".embed-privacy-overlay"),i=document.querySelectorAll(".embed-privacy-overlay a");function a(r){var n=r.getAttribute("data-embed-provider"),c=e("embed-privacy")?JSON.parse(e("embed-privacy")):"";r.checked?(null!==c&&0!==Object.keys(c).length&&c.constructor===Object?(c[n]=!0,t("embed-privacy",JSON.stringify(c),365)):t("embed-privacy",'{"'+n+'":true}',365),o(document.querySelectorAll(".embed-privacy-overlay")),r.closest(".embed-privacy-container").querySelector(".embed-privacy-content > :first-child").focus()):null!==c&&(delete c[n],0!==Object.keys(c).length?t("embed-privacy",JSON.stringify(c),365):("embed-privacy",document.cookie="embed-privacy=; expires=0; path=/"))}function o(t){var r=e("embed-privacy")?JSON.parse(e("embed-privacy")):"";if(t||(t=c),null!==r&&Object.keys(r).length)for(var n=Object.keys(r),i=0;i<t.length;i++){var a=t[i].parentNode.getAttribute("data-embed-provider");n.includes(a)&&t[i].click()}}function d(e,t,r,n){for(var c=0;c<e.length;c++){e[c].addEventListener("click",(function(e){"INPUT"!==e.currentTarget.tagName&&l(e.currentTarget)}));const t=e[c].parentNode.querySelector(".embed-privacy-enable");t&&(t.addEventListener("click",(function(e){l(e.currentTarget.parentNode.querySelector(".embed-privacy-overlay")),e.currentTarget.parentNode.removeChild(e.currentTarget)})),t.addEventListener("keypress",(function(e){"Enter"!==e.code&&"Space"!==e.code||(e.preventDefault(),l(e.currentTarget.parentNode.querySelector(".embed-privacy-overlay")),e.currentTarget.parentNode.removeChild(e.currentTarget))})))}for(c=0;c<t.length;c++)t[c].addEventListener("click",(function(e){e.stopPropagation()}));for(c=0;c<r.length;c++)r[c].addEventListener("click",(function(e){e.stopPropagation(),a(e.currentTarget,e.currentTarget.closest(".embed-privacy-overlay"))}));for(c=0;c<n.length;c++)n[c].addEventListener("click",(function(e){e.stopPropagation()}));o(e)}function l(e){var t=e.parentNode,r=e.nextElementSibling;t.classList.remove("is-disabled"),t.classList.add("is-enabled"),e.style.display="none";var n,c,i=JSON.parse(window["_"+e.parentNode.getAttribute("data-embed-id")]);r.innerHTML=(n=i.embed,(c=document.createElement("textarea")).innerHTML=n,c.value);var a=t.parentNode;a.classList.contains("wp-block-embed__wrapper")&&a.style.removeProperty("height");for(var o=r.querySelectorAll("script"),d=0;d<o.length;d++){var l=document.createElement("script");o[d].src?l.src=o[d].src:l.innerHTML=o[d].innerHTML,r.appendChild(l)}if(t.querySelector(".embed-privacy-content > :first-child").focus(),"undefined"!=typeof jQuery){const e=jQuery(".wp-video-shortcode");e.length&&e.mediaelementplayer()}}function s(){for(var e=0;e<c.length;e++){var t=c[e].parentNode.parentNode;t.classList.contains("wp-block-embed__wrapper")&&(t.style.removeProperty("height"),t.offsetHeight<c[e].offsetHeight&&(t.style.height=c[e].offsetHeight+"px"))}}d(c,i,r,n),function(){const e=document.getElementById("activity-stream");if(!e)return;const t=new MutationObserver((e=>{for(const t of e){const e=t.target.querySelectorAll(".embed-privacy-inner .embed-privacy-input"),r=t.target.querySelectorAll(".embed-privacy-inner .embed-privacy-label"),n=t.target.querySelectorAll(".embed-privacy-overlay"),c=t.target.querySelectorAll(".embed-privacy-overlay a");n.length&&d(n,c,e,r)}}));t.observe(e,{childList:!0})}(),function(){const t=document.querySelector(".embed-privacy-opt-out");if(!t)return;var r=t.querySelectorAll(".embed-privacy-opt-out-input");const n="1"===t.getAttribute("data-show-all");if(!r)return;const c=function(){const t=e("embed-privacy")?JSON.parse(e("embed-privacy")):"";return t?Object.keys(t):[]}();for(var i=0;i<r.length;i++){if(-1!==c.indexOf(r[i].getAttribute("data-embed-provider")))r[i].checked=!0;else if(!n){r[i].parentNode.parentNode.classList.add("is-hidden");continue}r[i].addEventListener("click",(function(e){var t=e.currentTarget;t&&a(t)}))}const o=t.querySelectorAll(".embed-privacy-provider:not(.is-hidden)");n||o.length||t.remove()}(),s(),window.addEventListener("resize",(function(){s()}))}))})();