PageSourceSearch

https://www.parker.edu/wp-content/plugins/parker-salesforce-integr…/application.js?ver=1790564793

js parker.edu collected 2026-10-01 12:06:08 UTC 9,104 bytes, 175 lines download raw bytes

1function initParkerApplicationUi() {
2    parkerDebugLog("Application DOM Content Loaded");
3
4    // Initialize Modals
5    ModalManager.initModal('#sms-modal', '.sms-modal-trigger');
6    // ModalManager.initModal('#misdemeanor-modal', '.sms-modal-trigger');
7    // Closable — the user may have typed the wrong email and want to correct it before
8    // the email-existence check fires again.
9    ModalManager.initModal('#contact-exists-modal', null, true);
10    // Password modal is now closable so we can record an explicit "abandoned at password"
11    // signal. The JS in script.js attaches an extra listener that watches for the modal to
12    // close BEFORE password submission and fires parker_update_lead_status with
13    // status='abandoned_password'.
14    ModalManager.initModal('#password-modal', null, true);
15    ModalManager.initModal('#error-modal');
16
17    // Set Context for Applications
18    const programsDropdown = document.querySelector('#TargetX_SRMb__Program__c');
19    const programTermsDropdown = document.querySelector('#custom_program_term');
20    if (!programsDropdown && !programTermsDropdown) {
21        document.body.setAttribute("data-context", "application");
22        parkerDebugLog("data-context set to:", document.body.getAttribute("data-context"));
23    }
24
25    // Navigation for the "you already have an account" modal buttons is handled inline in
26    // generate_contact_exists_modal_html() so each button can target its own URL (login vs.
27    // forgot-password). No JS handler needed here.
28
29    // Update Emergency Contact Label
30    const EmergencyContactName = document.querySelector("[name='TargetX_SRMb__Family_Relationship__c']");
31    if (EmergencyContactName) {
32        const EmergencyContactNameLabel = document.querySelector(`label[for='${EmergencyContactName.id}']`);
33        if (EmergencyContactNameLabel) {
34            EmergencyContactNameLabel.textContent = "Contact Name";
35        }
36    }
37
38    // Update Ethnicity Label
39    const ethnicityLabel = document.querySelector("label[for='TargetX_SRMb__IPEDS_Ethnicities__c']");
40    if (ethnicityLabel) {
41        ethnicityLabel.innerHTML = `
42            Race <span style="font-size: 14px; font-style: italic;">
43            (&nbsp;&nbsp;<span style="border: 1px solid #1d3c87; padding: 0 5px 0 1px; border-radius: 3px;">Ctrl</span> + Click or <span style="font-size: 18px; font-style: italic;">&#8984;</span> + Click for multiple selection)
44            </span>`;
45    }
46
47    // Set Default Waiver Code
48    const waiverCodeInput = document.querySelector("[name='Coupon_code__c']");
49    if (waiverCodeInput && window.waiverCode) {
50        waiverCodeInput.value = window.waiverCode;
51    }
52
53    // Radio Configuration
54    const smsDisclaimer = document.querySelector('#sms-disclaimer');
55    const radioConfigurations = [
56        { fieldId: "Text_Ok__c", labelText: "Is it okay for us to text you?", extraElement: smsDisclaimer, isHorizontal: true },
57        { fieldId: "hed__Military_Service__c", labelText: "Are you currently on active duty?", isHorizontal: true },
58        { fieldId: "TargetX_SRMb__US_Veteran__c", labelText: "Are you a United States veteran?", isHorizontal: true },
59        { fieldId: "Need_Financial_Aid__c", labelText: "Do you need financial aid?", isHorizontal: true },
60        { fieldId: "Misdemeanor_Felony__c", labelText: "Have you ever been convicted of a misdemeanor or felony?", isHorizontal: true },
61        { fieldId: "Was_Parker_First_choice__c", labelText: "Was Parker University your first choice?", isHorizontal: true },
62        { fieldId: "Interested_in_attending_a_Parker_Seminar__c", labelText: "Are you interested in attending a Parker Seminar?", isHorizontal: true }
63    ];
64    FieldHandler.transformToBooleanRadios(radioConfigurations);
65
66    // Visibility Configurations
67    const visibilityConfigurations = [
68        { fieldName: "hed__Military_Service__c", targetFieldName: "TargetX_SRMb__Military_Branch2__c", expectedValue: "true" },
69        { fieldName: "TargetX_SRMb__US_Veteran__c", targetFieldName: "TargetX_SRMb__Military_Branch__c", expectedValue: "true" },
70    ];
71
72    // Attach Change Listeners
73    const fieldNames = [...new Set(visibilityConfigurations.map(({ fieldName }) => fieldName))];
74    fieldNames.forEach((fieldName) => {
75        const fieldElements = document.querySelectorAll(`[name='${fieldName}']`);
76        fieldElements.forEach((field) =>
77            field.addEventListener("change", () => {
78                FieldHandler.handleVisibilities(visibilityConfigurations);
79            })
80        );
81    });
82
83    // Ensure Fields and Groups Are Hidden Initially
84    visibilityConfigurations.forEach(({ targetFieldName }) => {
85        const targetField = document.querySelector(`[name='${targetFieldName}']`);
86        const formGroup = targetField?.closest(".form-group");
87        if (formGroup) {
88            FieldHandler.toggleVisibility(formGroup, false);
89        }
90    });
91
92    // Trigger Initial Visibility Check
93    FieldHandler.handleVisibilities(visibilityConfigurations);
94
95    // Handle Citizenship Dropdown
96    const citizenshipSelect = document.querySelector("[name='TargetX_SRMb__Citizenship__c']");
97    const visaTypeInput = document.querySelector("[name='TargetX_SRMb__Visa_Type__c']");
98    const visaNumberInput = document.querySelector("[name='TargetX_SRMb__Visa_Number__c']");
99    const visaDateInput = document.querySelector("[name='TargetX_SRMb__Visa_Date_Issued__c']");
100
101    if (citizenshipSelect) {
102        citizenshipSelect.addEventListener("change", () => {
103            const isNonresidentAlien = citizenshipSelect.value === "Nonresident Alien";
104            FieldHandler.toggleVisibility(visaTypeInput?.closest('.form-group'), isNonresidentAlien);
105            FieldHandler.toggleVisibility(visaNumberInput?.closest('.form-group'), isNonresidentAlien);
106            FieldHandler.toggleVisibility(visaDateInput?.closest('.form-group'), isNonresidentAlien);
107        });
108    }
109
110    // Handle Country Dropdown
111    const countrySelect = document.getElementById('country');
112    const localityInput = document.getElementById('locality');
113    const regionSelect = document.getElementById('region');
114    const regionInput = document.getElementById('region-input');
115    const postalInput = document.getElementById('postal');
116
117    if (countrySelect) {
118        countryData.forEach(country => {
119            const [code, details] = Object.entries(country)[0];
120            const option = document.createElement('option');
121            option.value = code;
122            option.textContent = details.name;
123            countrySelect.appendChild(option);
124        });
125
126        let debounceTimer;
127        countrySelect.addEventListener("change", () => {
128            clearTimeout(debounceTimer);
129            debounceTimer = setTimeout(() => {
130                const selectedCountry = countrySelect.value;
131                const countryDetails = countryData.find(
132                    (country) => Object.keys(country)[0] === selectedCountry
133                )?.[selectedCountry];
134
135                FieldHandler.toggleVisibility(localityInput, !!selectedCountry);
136                if (selectedCountry) {
137                    localityInput.placeholder = countryDetails?.locality || "City";
138
139                    const regions = regionData[selectedCountry];
140                    const hasRegionInData = !!(countryDetails?.region || regions?.length > 0);
141
142                    FieldHandler.toggleVisibility(regionInput, hasRegionInData && !regions?.length);
143                    FieldHandler.toggleVisibility(regionSelect, hasRegionInData && regions?.length);
144                    FieldHandler.toggleVisibility(postalInput, !!countryDetails?.postal);
145
146                    if (regions?.length) {
147                        regionSelect.innerHTML = `<option value="">${countryDetails?.region || "State"}</option>`;
148                        regions.forEach((region) => {
149                            const option = document.createElement("option");
150                            option.value = region;
151                            option.textContent = region;
152                            regionSelect.appendChild(option);
153                        });
154                    }
155                } else {
156                    FieldHandler.toggleVisibility(regionSelect, false);
157                    FieldHandler.toggleVisibility(regionInput, false);
158                    FieldHandler.toggleVisibility(postalInput, false);
159                }
160            }, 300); // Debounce delay of 300ms
161        });
162    }
163
164    FieldHandler.toggleVisibility(visaTypeInput?.closest('.form-group'), false);
165    FieldHandler.toggleVisibility(visaNumberInput?.closest('.form-group'), false);
166    FieldHandler.toggleVisibility(visaDateInput?.closest('.form-group'), false);
167    FieldHandler.toggleVisibility(localityInput, false);
168    FieldHandler.toggleVisibility(regionSelect, false);
169    FieldHandler.toggleVisibility(regionInput, false);
170    FieldHandler.toggleVisibility(postalInput, false);
171}
172
173window.initParkerApplicationUi = initParkerApplicationUi;
174
175document.addEventListener("DOMContentLoaded", initParkerApplicationUi);

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.