You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
5.9 KiB
JavaScript
1 line
5.9 KiB
JavaScript
!function n(o,r,s){function a(i,e){if(!r[i]){if(!o[i]){var t="function"==typeof require&&require;if(!e&&t)return t(i,!0);if(c)return c(i,!0);throw new Error("Cannot find module '"+i+"'")}e=r[i]={exports:{}};o[i][0].call(e.exports,function(e){var t=o[i][1][e];return a(t||e)},e,e.exports,n,o,r,s)}return r[i].exports}for(var c="function"==typeof require&&require,e=0;e<s.length;e++)a(s[e]);return a}({1:[function(e,t,i){"use strict";function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,o,r,s,a=[],c=!0,u=!1;try{if(r=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;c=!1}else for(;!(c=(n=r.call(i)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(u)throw o}}return a}}(e,t)||function(e,t){var i;if(e)return"string"==typeof e?n(e,t):"Map"===(i="Object"===(i=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(e,t):void 0}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var o,r,s,c;(window.WPFormsEditPostEducation||(o=document,r=window,s=jQuery,c={isNoticeVisible:!1,init:function(){s(r).on("load",function(){"function"==typeof s.ready.then?s.ready.then(c.load):c.load()})},load:function(){var e;c.isGutenbergEditor()?e=setInterval(function(){var t,i;o.querySelector('.editor-post-title__input, iframe[name="editor-canvas"]')&&(clearInterval(e),c.isFse()?(t=o.querySelector('iframe[name="editor-canvas"]'),(i=new MutationObserver(function(){var e=t.contentDocument||t.contentWindow.document||{};"complete"===e.readyState&&e.querySelector(".editor-post-title__input")&&(c.maybeShowGutenbergNotice(),c.bindFseEvents(),i.disconnect())})).observe(o.body,{subtree:!0,childList:!0})):(c.maybeShowGutenbergNotice(),c.bindGutenbergEvents()))},200):(c.maybeShowClassicNotice(),c.bindClassicEvents())},bindClassicEvents:function(){var e=s(o);c.isNoticeVisible||e.on("input","#title",c.maybeShowClassicNotice),e.on("click",".wpforms-edit-post-education-notice-close",c.closeNotice)},bindGutenbergEvents:function(){var e=s(o);e.on("DOMSubtreeModified",".edit-post-layout",c.distractionFreeModeToggle),c.isNoticeVisible||e.on("input",".editor-post-title__input",c.maybeShowGutenbergNotice).on("DOMSubtreeModified",".editor-post-title__input",c.maybeShowGutenbergNotice)},bindFseEvents:function(){var e=s('iframe[name="editor-canvas"]');s(o).on("DOMSubtreeModified",".edit-post-layout",c.distractionFreeModeToggle),e.contents().on("DOMSubtreeModified",".editor-post-title__input",c.maybeShowGutenbergNotice)},isGutenbergEditor:function(){return"undefined"!=typeof wp&&void 0!==wp.blocks},isFse:function(){return Boolean(s('iframe[name="editor-canvas"]').length)},showGutenbergNotice:function(){wp.data.dispatch("core/notices").createInfoNotice(wpforms_edit_post_education.gutenberg_notice.template,c.getGutenbergNoticeSettings());var t=setInterval(function(){var e=s(".wpforms-edit-post-education-notice-body");e.length&&((e=e.closest(".components-notice")).addClass("wpforms-edit-post-education-notice"),e.find(".is-secondary, .is-link").removeClass("is-secondary").removeClass("is-link").addClass("is-primary"),clearInterval(t))},100)},getGutenbergNoticeSettings:function(){var n,o,e,r,t,s="wpforms-edit-post-product-education-guide",i={id:s,isDismissible:!0,HTML:!0,__unstableHTML:!0,actions:[{className:"wpforms-edit-post-education-notice-guide-button",variant:"primary",label:wpforms_edit_post_education.gutenberg_notice.button}]};return wpforms_edit_post_education.gutenberg_guide?(n=wp.components.Guide,o=wp.element.useState,e=wp.plugins.registerPlugin,r=wp.plugins.unregisterPlugin,t=function(){var e=a(o(!0),2),t=e[0],i=e[1];return t?React.createElement(n,{className:"edit-post-welcome-guide",onFinish:function(){r(s),i(!1)},pages:c.getGuidePages()}):null},i.onDismiss=c.updateUserMeta,i.actions[0].onClick=function(){return e(s,{render:t})}):i.actions[0].url=wpforms_edit_post_education.gutenberg_notice.url,i},getGuidePages:function(){var t=[];return wpforms_edit_post_education.gutenberg_guide.forEach(function(e){t.push({content:React.createElement(React.Fragment,null,React.createElement("h1",{className:"edit-post-welcome-guide__heading"},e.title),React.createElement("p",{className:"edit-post-welcome-guide__text"},e.content)),image:React.createElement("img",{className:"edit-post-welcome-guide__image",src:e.image,alt:e.title})})}),t},maybeShowClassicNotice:function(){c.isNoticeVisible||c.isTitleMatchKeywords(s("#title").val())&&(c.isNoticeVisible=!0,s(".wpforms-edit-post-education-notice").removeClass("wpforms-hidden"))},maybeShowGutenbergNotice:function(){var e;c.isNoticeVisible||(e="TEXTAREA"===(e=c.isFse()?s('iframe[name="editor-canvas"]').contents().find(".editor-post-title__input"):s(".editor-post-title__input")).prop("tagName")?e.val():e.text(),c.isTitleMatchKeywords(e)&&(c.isNoticeVisible=!0,c.showGutenbergNotice()))},distractionFreeModeToggle:function(){var e;c.isNoticeVisible&&(e=s(o),Boolean(e.find(".is-distraction-free").length))&&!Boolean(s(".wpforms-edit-post-education-notice").length)&&e.find(".wpforms-edit-post-education-notice-body").closest(".components-notice").addClass("wpforms-edit-post-education-notice")},isTitleMatchKeywords:function(e){return new RegExp(/\b(contact|form)\b/i).test(e)},closeNotice:function(){s(this).closest(".wpforms-edit-post-education-notice").remove(),c.updateUserMeta()},updateUserMeta:function(){s.post(wpforms_edit_post_education.ajax_url,{action:"wpforms_education_dismiss",nonce:wpforms_edit_post_education.education_nonce,section:"edit-post-notice"})}})).init()},{}]},{},[1]); |