Your IP : 216.73.216.95


Current Path : /var/test/www/html/wp-content/plugins/jetpack/_inc/build/
Upload File :
Current File : /var/test/www/html/wp-content/plugins/jetpack/_inc/build/connect-button.min.js

/* Do not modify this file directly. It is compiled from other files. */
/* global jpConnect */
jQuery(document).ready(function(n){var e=n(".jp-connect-button, .jp-banner__alt-connect-button").eq(0),t=n(".jp-connect-full__tos-blurb"),a=n('<iframe class="jp-jetpack-connect__iframe" />'),o=n("#jetpack-connection-cards, .jp-connect-full__dismiss-paragraph"),i="";e.on("click",function(e){if(e.preventDefault(),"undefined"==typeof URLSearchParams)i="";else{var t=new URLSearchParams(n(this).prop("search"));i=t&&t.get("from")}o.length&&o.fadeOut(600),c.selectAndStartConnectionFlow()});var c={isRegistering:!1,isPaidPlan:!1,selectAndStartConnectionFlow:function(){var e=n("#jetpack-connection-cards");e.length&&e.fadeOut(600),c.isRegistering||("original"===jpConnect.forceVariation?c.handleOriginalFlow():c.handleConnectInPlaceFlow())},handleOriginalFlow:function(){window.location=e.attr("href")},handleConnectInPlaceFlow:function(){if(e.hasClass("jp-banner__alt-connect-button"))window.location=jpConnect.connectInPlaceUrl;else{c.isRegistering=!0,t.hide(),e.hide(),c.triggerLoadingState();var a=jpConnect.apiBaseUrl+"/connection/register";window.Initial_State&&window.Initial_State.calypsoEnv&&(a=a+"?"+n.param({calypso_env:window.Initial_State.calypsoEnv})),n.ajax({url:a,type:"POST",data:{registration_nonce:jpConnect.registrationNonce,_wpnonce:jpConnect.apiNonce},error:c.handleConnectionError,success:c.handleConnectionSuccess})}},triggerLoadingState:function(){var e=n("<span>").addClass("jp-connect-full__button-container-loading").text(jpConnect.buttonTextRegistering).appendTo(".jp-connect-full__button-container"),t=n("<div>").addClass("jp-spinner"),a=n("<div>").addClass("jp-spinner__outer").appendTo(t);n("<div>").addClass("jp-spinner__inner").appendTo(a),e.after(t)},handleConnectionSuccess:function(e){c.fetchPlanType(),window.addEventListener("message",c.receiveData),a.attr("src",e.authorizeUrl+"&from="+i),a.on("load",function(){a.show(),n(".jp-connect-full__button-container").hide()}),a.hide(),n(".jp-connect-full__button-container").after(a);var t=document.createElement("link");t.rel="preload",t.as="script",t.href=jpConnect.preFetchScript,document.head.appendChild(t)},fetchPlanType:function(){n.ajax({url:jpConnect.apiBaseUrl+"/site",type:"GET",data:{_wpnonce:jpConnect.apiSiteDataNonce},success:function(n){var e=JSON.parse(n.data);c.isPaidPlan=e.options.is_pending_plan||!e.plan.is_free}})},receiveData:function(n){if(n.origin===jpConnect.jetpackApiDomain&&n.source===a.get(0).contentWindow)switch(n.data){case"close":window.removeEventListener("message",this.receiveData),c.handleAuthorizationComplete();break;case"wpcom_nocookie":a.hide(),c.handleConnectionError()}},handleAuthorizationComplete:function(){c.isRegistering=!1,c.isPaidPlan?window.location.assign(jpConnect.dashboardUrl):window.location.assign(jpConnect.plansPromptUrl),window.location.hash&&window.location.reload(!0)},handleConnectionError:function(n){c.isRegistering=!1,c.handleOriginalFlow()}};"setup"===location.hash.replace(/#\//,"")&&(o.length&&o.hide(),c.selectAndStartConnectionFlow())});