PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.5
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.5
3.4.5 3.4.4 3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 All 198 releases
← All changes | resources/frontend/js/restrict-content.js +26 -3 3.4.4 → 3.4.5 View file →
@@ -101,8 +101,25 @@
101 101 );
102 102 }
103 103
104 104 /**
105 + * Re-enables the inputs in the given container, following a failed request.
106 + *
107 + * @since 3.4.5
108 + *
109 + * @param {Object} container Container element.
110 + */
111 +function convertKitRestrictContentEnableInputs(container) {
112 + container
113 + .querySelectorAll(
114 + 'input[type="text"], input[type="email"], input[type="submit"]'
115 + )
116 + .forEach(function (input) {
117 + input.removeAttribute('disabled');
118 + });
119 +}
120 +
121 +/**
105 122 * Returns whether the heading should be displayed above the login form, which is
106 123 * the case when the modal is used.
107 124 *
108 125 * @since 3.4.2
@@ -267,8 +284,12 @@
267 284 .catch(function (error) {
268 285 if (convertkit_restrict_content.debug) {
269 286 console.error(error);
270 287 }
288 +
289 + // Re-enable inputs and hide loading overlay, so the form can be resubmitted.
290 + convertKitRestrictContentEnableInputs(container);
291 + convertKitRestrictContentLoading(false);
271 292 });
272 293 }
273 294
274 295 /**
@@ -334,8 +355,12 @@
334 355 .catch(function (error) {
335 356 if (convertkit_restrict_content.debug) {
336 357 console.error(error);
337 358 }
359 +
360 + // Re-enable inputs and hide loading overlay, so the form can be resubmitted.
361 + convertKitRestrictContentEnableInputs(container);
362 + convertKitRestrictContentLoading(false);
338 363 });
339 364 }
340 365
341 366 /**
@@ -362,10 +387,8 @@
362 387 // - submit the form.
363 388 if (otpInput.value.length === 6) {
364 389 otpInput.setSelectionRange(0, 0);
365 390 otpInput.blur();
366 - document
367 - .querySelector('#convertkit-restrict-content-form')
368 - .requestSubmit();
391 + otpInput.closest('form').requestSubmit();
369 392 }
370 393 });
371 394 }