File Editor
Directories:
.. (Back)
Files:
challenge-admin.js
challenge-admin.min.js
challenge-builder.js
challenge-builder.min.js
challenge-core.js
challenge-core.min.js
challenge-embed.js
challenge-embed.min.js
Create New File
Create
Edit File: challenge-embed.min.js
"use strict";var WPFormsChallenge=window.WPFormsChallenge||{};WPFormsChallenge.embed=window.WPFormsChallenge.embed||function(o,e,c){var t={init:function(){c(t.ready),c(e).on("load",function(){"function"==typeof c.ready.then?c.ready.then(t.load):t.load()})},ready:function(){t.setup(),t.events(),t.observeFullscreenMode()},load:function(){-1<e.location.href.indexOf("post-new.php")?(t.lastStep(),c(".wpforms-challenge-dot-completed").hide()):(WPFormsChallenge.core.isGutenberg()?(WPFormsChallenge.core.initTooltips(5,".block-editor .edit-post-header",{side:"bottom"}),t.updateTooltipVisibility()):WPFormsChallenge.core.initTooltips(5,".wpforms-insert-form-button",{side:"right"}),WPFormsChallenge.core.updateTooltipUI())},setup:function(){5===WPFormsChallenge.core.loadStep()&&(c(".wpforms-challenge").addClass("wpforms-challenge-completed"),t.showPopup()),c(".wpforms-challenge").show()},events:function(){c(".wpforms-challenge-step5-done").on("click",t.lastStep),c(".wpforms-challenge-popup-close, .wpforms-challenge-end").on("click",t.completeChallenge),c("#wpforms-challenge-contact-form .wpforms-challenge-popup-contact-btn").on("click",t.submitContactForm)},lastStep:function(){WPFormsChallenge.core.timer.pause(),WPFormsChallenge.core.stepCompleted(5),c(".wpforms-challenge").addClass("wpforms-challenge-completed"),t.showPopup()},showPopup:function(){var e=WPFormsChallenge.core.timer.getSecondsLeft();c(".wpforms-challenge-popup-container").show(),(0<e?(e=WPFormsChallenge.core.timer.getSecondsSpent(e),c("#wpforms-challenge-congrats-minutes").text(WPFormsChallenge.core.timer.getMinutesFormatted(e)),c("#wpforms-challenge-congrats-seconds").text(WPFormsChallenge.core.timer.getSecondsFormatted(e)),c("#wpforms-challenge-congrats-popup")):c("#wpforms-challenge-contact-popup")).show()},hidePopup:function(){c(".wpforms-challenge-popup-container").hide(),c(".wpforms-challenge-popup").hide()},completeChallenge:function(){var e={status:"completed",seconds_spent:WPFormsChallenge.core.timer.getSecondsSpent(),seconds_left:WPFormsChallenge.core.timer.getSecondsLeft()};t.hidePopup(),WPFormsChallenge.core.removeChallengeUI(),WPFormsChallenge.core.clearLocalStorage(),WPFormsChallenge.admin.saveChallengeOption(e).done(WPFormsChallenge.core.triggerPageSave)},submitContactForm:function(e){e.preventDefault();var e=c(this),o=e.closest("#wpforms-challenge-contact-form"),o={action:"wpforms_challenge_send_contact_form",_wpnonce:WPFormsChallenge.admin.l10n.nonce,contact_data:{message:o.find(".wpforms-challenge-contact-message").val(),contact_me:o.find(".wpforms-challenge-contact-permission").prop("checked")}};e.prop("disabled",!0),c.post(ajaxurl,o,function(e){e.success||console.error("Error sending WPForms Challenge Contact Form.")}).done(t.completeChallenge)},observeFullscreenMode:function(){var r=c("body"),a=r.hasClass("is-fullscreen-mode"),e={targetNode:r[0],config:{attributes:!0},callback:function(e,o){var t,l,n=c(".wpforms-challenge-tooltip-step5"),s=n.find(".tooltipster-arrow");for(l in e)"attributes"===(t=e[l]).type&&"class"===t.attributeName&&(t=r.hasClass("is-fullscreen-mode"))!==a&&((a=t)?(n.css({top:"93px",left:"0"}),s.css("left","91px")):(n.css({top:"125px",left:"66px"}),s.css("left","130px")))}};e.observer=new MutationObserver(e.callback),e.observer.observe(e.targetNode,e.config)},updateTooltipVisibility:function(){var e=o.querySelector(".interface-interface-skeleton__body");if(null===e)return t.updateTooltipVisibilityDefault();new MutationObserver(function(e){var o,t=c(".wpforms-challenge-tooltip-step5");for(o of e)"childList"===o.type&&t.toggleClass("wpforms-challenge-tooltip-step5-hide")}).observe(e,{attributes:!0,childList:!0})},updateTooltipVisibilityDefault:function(){c(".editor-inserter__toggle").on("click",function(){c(".wpforms-challenge-tooltip-step5").toggleClass("wpforms-challenge-tooltip-step5-hide")})}};return t}(document,window,jQuery),WPFormsChallenge.embed.init();
Save Changes
Rename File
Rename