PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | stripe/js/connect_settings.js +17 -19 6.5.2 → trunk View file →
@@ -1,15 +1,15 @@
1 1 ( function() {
2 2 function setupStripeConnectListener() {
3 - onclickPreventDefault( '#frm_disconnect_stripe', handleStripeDisconnectClick );
4 - onclickPreventDefault( '#frm_reauth_stripe', handleStripeReauthClick );
5 - onclickPreventDefault( '#frm_connect_with_oauth', handleConnectWithOauth );
3 + onclickPreventDefault( '.frm_disconnect_stripe', handleStripeDisconnectClick );
4 + onclickPreventDefault( '.frm_reauth_stripe', handleStripeReauthClick );
5 + onclickPreventDefault( '.frm_connect_with_oauth', handleConnectWithOauth );
6 6 renderStripeConnectSettingsButton();
7 7 }
8 8
9 9 function renderStripeConnectSettingsButton() {
10 - var container = document.getElementById( 'frm_strp_settings_container' );
11 - if ( null !== container ) {
10 + const container = document.getElementById( 'frm_strp_settings_container' );
11 + if ( container ) {
12 12 postAjax(
13 13 {
14 14 action: 'frm_strp_connect_get_settings_button'
15 15 },
@@ -23,14 +23,14 @@
23 23 function onclickPreventDefault( selector, callback ) {
24 24 jQuery( document ).on( 'click', selector, function( event ) {
25 25 event.preventDefault();
26 26 callback( this );
27 - });
27 + } );
28 28 }
29 29
30 30 function handleStripeDisconnectClick( trigger ) {
31 31 const testMode = isTriggerInTestMode( trigger );
32 - const spinner = frmDom.span({ className: 'frm-wait frm_visible_spinner' });
32 + const spinner = frmDom.span( { className: 'frm-wait frm_visible_spinner' } );
33 33
34 34 spinner.style.margin = 0; // The default 20px margin causes the spinner to look bad.
35 35 trigger.replaceWith( spinner );
36 36
@@ -46,9 +46,9 @@
46 46 function handleStripeReauthClick( trigger ) {
47 47 strpSettingsAjaxRequest(
48 48 'frm_stripe_connect_reauth',
49 49 function( data ) {
50 - if ( 'undefined' !== typeof data.connect_url ) {
50 + if ( data.connect_url !== undefined ) {
51 51 window.location = data.connect_url;
52 52 } else {
53 53 renderStripeConnectSettingsButton();
54 54 }
@@ -61,9 +61,9 @@
61 61 trigger.classList.add( 'frm_loading_button' );
62 62 strpSettingsAjaxRequest(
63 63 'frm_stripe_connect_oauth',
64 64 function( data ) {
65 - if ( 'undefined' !== typeof data.redirect_url ) {
65 + if ( data.redirect_url !== undefined ) {
66 66 window.location = data.redirect_url;
67 67 } else {
68 68 renderStripeConnectSettingsButton();
69 69 }
@@ -72,11 +72,11 @@
72 72 );
73 73 }
74 74
75 75 function strpSettingsAjaxRequest( action, success, testMode ) {
76 - var data = {
77 - action: action,
78 - testMode: testMode,
76 + const data = {
77 + action,
78 + testMode,
79 79 nonce: frmGlobal.nonce
80 80 };
81 81 postAjax( data, success );
82 82 }
@@ -81,26 +81,24 @@
81 81 postAjax( data, success );
82 82 }
83 83
84 84 function postAjax( data, success ) {
85 - var xmlHttp, params;
86 -
87 - xmlHttp = new XMLHttpRequest();
88 - params = typeof data === 'string' ? data : Object.keys( data ).map(
85 + const xmlHttp = new XMLHttpRequest();
86 + const params = typeof data === 'string' ? data : Object.keys( data ).map(
89 87 function( k ) {
90 - return encodeURIComponent( k ) + '=' + encodeURIComponent( data[ k ]);
88 + return `${ encodeURIComponent( k ) }=${ encodeURIComponent( data[ k ] ) }`;
91 89 }
92 90 ).join( '&' );
93 91
94 92 xmlHttp.open( 'post', ajaxurl, true );
95 93 xmlHttp.onreadystatechange = function() {
96 - var response;
94 + let response;
97 95 if ( xmlHttp.readyState > 3 && xmlHttp.status == 200 ) {
98 96 response = xmlHttp.responseText;
99 97 if ( response !== '' ) {
100 98 response = JSON.parse( response );
101 99 if ( response.success ) {
102 - if ( 'undefined' === typeof response.data ) {
100 + if ( response.data === undefined ) {
103 101 response.data = {};
104 102 }
105 103 success( response.data );
106 104 }