WordPress/wp-includes/js/comment-reply.min.js

2 lines
3.0 KiB
JavaScript

/*! This file is auto-generated */
window.addComment=function(y){var u,p,f,v=y.document,I={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=y.MutationObserver||y.WebKitMutationObserver||y.MozMutationObserver,i="querySelector"in v&&"addEventListener"in y,n=!!v.documentElement.dataset;function t(){d(),function(){if(!e)return;new e(o).observe(v.body,{childList:!0,subtree:!0})}()}function d(e){if(i&&(u=C(I.cancelReplyId),p=C(I.commentFormId),u)){u.addEventListener("touchstart",l),u.addEventListener("click",l);var t=function(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode)return p.removeEventListener("keydown",t),e.preventDefault(),p.submit.click(),!1};p&&p.addEventListener("keydown",t);for(var n,d=function(e){var t=I.commentReplyClass;e&&e.childNodes||(e=v);t=v.getElementsByClassName?e.getElementsByClassName(t):e.querySelectorAll("."+t);return t}(e),o=0,r=d.length;o<r;o++)(n=d[o]).addEventListener("touchstart",a),n.addEventListener("click",a)}}function l(e){var t,n,d=C(I.temporaryFormId);d&&f&&(C(I.parentIdFieldId).value="0",t=d.textContent,d.parentNode.replaceChild(f,d),this.style.display="none",n=(d=(n=C(I.commentReplyTitleId))&&n.firstChild)&&d.nextSibling,d&&d.nodeType===Node.TEXT_NODE&&t&&(n&&"A"===n.nodeName&&n.id!==I.cancelReplyId&&(n.style.display=""),d.textContent=t),e.preventDefault())}function a(e){var t=C(I.commentReplyTitleId),n=t&&t.firstChild.textContent,d=this,o=m(d,"belowelement"),r=m(d,"commentid"),i=m(d,"respondelement"),t=m(d,"postid"),n=m(d,"replyto")||n;o&&r&&i&&t&&!1===y.addComment.moveForm(o,r,i,t,n)&&e.preventDefault()}function o(e){for(var t=e.length;t--;)if(e[t].addedNodes.length)return void d()}function m(e,t){return n?e.dataset[t]:e.getAttribute("data-"+t)}function C(e){return v.getElementById(e)}return i&&"loading"!==v.readyState?t():i&&y.addEventListener("DOMContentLoaded",t,!1),{init:d,moveForm:function(e,t,n,d,o){var r=C(e);f=C(n);var i,l,a,m=C(I.parentIdFieldId),c=C(I.postIdFieldId),e=C(I.commentReplyTitleId),e=(n=e&&e.firstChild)&&n.nextSibling;if(r&&f&&m){void 0===o&&(o=n&&n.textContent),function(e){var t=I.temporaryFormId,n=C(t),d=C(I.commentReplyTitleId),d=d?d.firstChild.textContent:"";if(n)return;(n=v.createElement("div")).id=t,n.style.display="none",n.textContent=d,e.parentNode.insertBefore(n,e)}(f),d&&c&&(c.value=d),m.value=t,u.style.display="",r.parentNode.insertBefore(f,r.nextSibling),n&&n.nodeType===Node.TEXT_NODE&&(e&&"A"===e.nodeName&&e.id!==I.cancelReplyId&&(e.style.display="none"),n.textContent=o),u.onclick=function(){return!1};try{for(var s=0;s<p.elements.length;s++)if(i=p.elements[s],l=!1,"getComputedStyle"in y?a=y.getComputedStyle(i):v.documentElement.currentStyle&&(a=i.currentStyle),(i.offsetWidth<=0&&i.offsetHeight<=0||"hidden"===a.visibility)&&(l=!0),"hidden"!==i.type&&!i.disabled&&!l){i.focus();break}}catch(e){}return!1}}}}(window);