1/* Atomic form: navigate when an action returns redirect_url (core only updates form state). */ 2(function () { 3 'use strict'; 4 5 if (typeof window.fetch !== 'function') { 6 return; 7 } 8 9 const origFetch = window.fetch; 10 11 window.fetch = function (input, init) { 12 return origFetch.call(this, input, init).then(function (response) { 13 try { 14 15 const body = init && init.body; 16 if (!(body instanceof FormData)) { 17 return response; 18 } 19 if (body.get('action') !== 'elementor_pro_atomic_forms_send_form') { 20 return response; 21 } 22 const ct = response.headers.get('content-type') || ''; 23 if (ct.indexOf('application/json') === -1) { 24 return response; 25 } 26 27 response 28 .clone() 29 .json() 30 .then(function (data) { 31 if (!data || !data.success || !data.data || !data.data.data) { 32 return; 33 } 34 const results = data.data.data.actionResults; 35 if (!Array.isArray(results)) { 36 return; 37 } 38 for (let i = 0; i < results.length; i++) { 39 const r = results[i]; 40 if ( 41 r && 42 r.status === 'success' && 43 typeof r.redirect_url === 'string' && 44 r.redirect_url 45 ) { 46 try { 47 const url = new URL(r.redirect_url, window.location.href); 48 if (url.protocol === 'http:' || url.protocol === 'https:') { 49 window.location.assign(url.href); 50 } 51 } catch (e) { 52 // Invalid URL â ignore. 53 } 54 break; 55 } 56 } 57 }) 58 .catch(function () {}); 59 } catch (e) { 60 // Non-fatal; return normal response. 61 } 62 return response; 63 }); 64 }; 65})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.