1 2(function() { 3 var getFormConfig = {}; 4 var getFormConfig = function(){ 5if(maestro.Resource.preview) { 6 switch(maestro.Form.data.configurationTemplateBrand) { 7 case "JDX": 8 maestro.Form.updateBranding({ 9 css: { 10 id: "runtimeCssResource", 11 cssUrl: "./css/jaguar.css" 12 } 13 }); 14 break; 15 case "LRDX": 16 maestro.Form.updateBranding({ 17 css: { 18 id: "runtimeCssResource", 19 cssUrl: "./css/landrover.css" 20 } 21 }); 22 break; 23 default: 24 maestro.Form.updateBranding({ 25 css: { 26 id: "runtimeCssResource", 27 cssUrl: "./css/default.css" 28 } 29 }); 30 } 31} 32maestro.Resource.preview = false; 33 34 35 var isNameplate = (!maestro.Util.isBlank(maestro.Form.prefill.nameplateInstructions) || !maestro.Util.isBlank(maestro.Form.prefill.variantInstructions)); 36 37 38 // Get default form configuration 39 maestro.DynamicData.call("Get Form Config", {}).then(function(response) { 40 for(path in response){ 41 if (isNameplate && (path == "configurationHeaderImageUrl" || path == "configurationBrandName" || path == "configurationPrivacyPolicy" || path == "configurationTermsConditions" || path == "configurationFooterPrivacyPolicy" || path == "configurationCookiePolicy" || path == "configurationThankYouImage" || path == "configurationThankYouImageMobile")){ 42 continue; 43 }else if (path == "configurationHeaderImageUrl"){ 44 maestro.Form.data[path] = location.protocol+"\/\/"+location.host+response[path]; 45 }else{ 46 maestro.Form.data[path] = response[path]; 47 } 48 } 49 50 let scriptUrlsVar = maestro.Form.prefill.JLRConfiguration.jsFormConfig; 51 if(scriptUrlsVar && scriptUrlsVar !==undefined && null != scriptUrlsVar){ 52 let scriptUrls = JSON.parse(scriptUrlsVar); 53 scriptUrls.forEach((url) => { 54 const script = document.createElement("script"); 55 script.src = url; 56 script.async = true; // Loads script asynchronously 57 script.onerror = () => console.error(`Error loading ${url}`); 58 document.head.appendChild(script); 59 }); 60 } 61 62 // Update header image 63 if(maestro.Form.data.configurationHeaderImageVisible !== false) { 64 var imgPath = maestro.Util.isBlank(maestro.Form.prefill.JLRConfiguration.HeaderImageURL)? maestro.Form.data.configurationHeaderImageUrl : maestro.Form.prefill.JLRConfiguration.HeaderImageURL 65 $('.jlr-header-image-banner-block img').attr('src', imgPath); 66 } 67 68 // Make a mandatory marker red 69 $( document ).ready(function() { 70 setTimeout(function() { 71 $("span:contains('*'):not(:has(*))").css({ 72 color:'red', 73 }); 74 }, 100); 75 76 }); 77 78 }).catch(function(err) { 79 maestro.Form.data.status = "Error fetching greeting"; 80 }).finally(function() { 81 82 }); 83 84 85 // Get CTA configuration 86 maestro.DynamicData.call("Get CTA Config", {}).then(function(response) { 87 if(response) { 88 maestro.Form.data.ctaData = response; 89 } 90 }).catch(function(err) { 91 maestro.Form.data.status = "Error fetching CTA configuration"; 92 }).finally(function() { 93 94 }); 95} 96 97 this.getFormConfig = getFormConfig 98}).call(this); 99
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.