moved to custom JS var, moved firstRow to onReady
This commit is contained in:
parent
1fde350405
commit
584a9bc716
@ -68,215 +68,13 @@
|
|||||||
linkedInAutofillClicked = true;
|
linkedInAutofillClicked = true;
|
||||||
});
|
});
|
||||||
hiddenInputCreator('country', function (newValue) {
|
hiddenInputCreator('country', function (newValue) {
|
||||||
console.log('%s value changed to %s', this.ID, newValue);
|
// console.log('%s value changed to %s', this.ID, newValue);
|
||||||
// map to the country we have in our select dropdown
|
// map to the country we have in our select dropdown
|
||||||
var countries = {
|
var newCountry = {{JS - ISO Country Code to EVBG Country Name}}(newValue);
|
||||||
US: 'United States',
|
|
||||||
GB: 'United Kingdom',
|
|
||||||
AE: 'United Arab Emirates',
|
|
||||||
CA: 'Canada',
|
|
||||||
IN: 'India',
|
|
||||||
AF: 'Afghanistan',
|
|
||||||
AL: 'Albania',
|
|
||||||
DZ: 'Algeria',
|
|
||||||
AD: 'Andorra',
|
|
||||||
AO: 'Angola',
|
|
||||||
AG: 'Antigua and Barbuda',
|
|
||||||
AR: 'Argentina',
|
|
||||||
AM: 'Armenia',
|
|
||||||
AU: 'Australia',
|
|
||||||
AT: 'Austria',
|
|
||||||
AZ: 'Azerbaijan',
|
|
||||||
BH: 'Bahrain',
|
|
||||||
BD: 'Bangladesh',
|
|
||||||
BB: 'Barbados',
|
|
||||||
BY: 'Belarus',
|
|
||||||
BE: 'Belgium',
|
|
||||||
BZ: 'Belize',
|
|
||||||
BJ: 'Benin',
|
|
||||||
BM: 'Bermuda',
|
|
||||||
BT: 'Bhutan',
|
|
||||||
BO: 'Bolivia',
|
|
||||||
BA: 'Bosnia and Herzegovina',
|
|
||||||
BW: 'Botswana',
|
|
||||||
BR: 'Brazil',
|
|
||||||
BN: 'Brunei',
|
|
||||||
BG: 'Bulgaria',
|
|
||||||
BF: 'Burkina Faso',
|
|
||||||
BI: 'Burundi',
|
|
||||||
KH: 'Cambodia',
|
|
||||||
CM: 'Cameroon',
|
|
||||||
CV: 'Cape Verde',
|
|
||||||
CF: 'Central African Republic',
|
|
||||||
TD: 'Chad',
|
|
||||||
CL: 'Chile',
|
|
||||||
CN: 'China',
|
|
||||||
CO: 'Colombia',
|
|
||||||
KM: 'Comoros',
|
|
||||||
CD: 'Congo Democratic Republic of the',
|
|
||||||
CG: 'Congo',
|
|
||||||
CR: 'Costa Rica',
|
|
||||||
HR: 'Croatia',
|
|
||||||
CU: 'Cuba',
|
|
||||||
CY: 'Cyprus',
|
|
||||||
CZ: 'Czech Republic',
|
|
||||||
DK: 'Denmark',
|
|
||||||
DJ: 'Djibouti',
|
|
||||||
DM: 'Dominica',
|
|
||||||
DO: 'Dominican Republic',
|
|
||||||
TL: 'East Timor',
|
|
||||||
EC: 'Ecuador',
|
|
||||||
EG: 'Egypt',
|
|
||||||
SV: 'El Salvador',
|
|
||||||
GQ: 'Equatorial Guinea',
|
|
||||||
ER: 'Eritrea',
|
|
||||||
EE: 'Estonia',
|
|
||||||
ET: 'Ethiopia',
|
|
||||||
FJ: 'Fiji',
|
|
||||||
FI: 'Finland',
|
|
||||||
FR: 'France',
|
|
||||||
GA: 'Gabon',
|
|
||||||
GE: 'Georgia',
|
|
||||||
DE: 'Germany',
|
|
||||||
GH: 'Ghana',
|
|
||||||
GR: 'Greece',
|
|
||||||
GL: 'Greenland',
|
|
||||||
GD: 'Grenada',
|
|
||||||
GT: 'Guatemala',
|
|
||||||
GW: 'Guinea-Bissau',
|
|
||||||
GN: 'Guinea',
|
|
||||||
GY: 'Guyana',
|
|
||||||
HT: 'Haiti',
|
|
||||||
HN: 'Honduras',
|
|
||||||
HU: 'Hungary',
|
|
||||||
IS: 'Iceland',
|
|
||||||
ID: 'Indonesia',
|
|
||||||
IR: 'Iran',
|
|
||||||
IQ: 'Iraq',
|
|
||||||
IE: 'Ireland, Republic of',
|
|
||||||
IL: 'Israel',
|
|
||||||
IT: 'Italy',
|
|
||||||
CI: 'Ivory Coast',
|
|
||||||
JM: 'Jamaica',
|
|
||||||
JP: 'Japan',
|
|
||||||
JO: 'Jordan',
|
|
||||||
KZ: 'Kazakhstan',
|
|
||||||
KE: 'Kenya',
|
|
||||||
KI: 'Kiribati',
|
|
||||||
KV: 'Kosovo',
|
|
||||||
KW: 'Kuwait',
|
|
||||||
KG: 'Kyrgyzstan',
|
|
||||||
LA: 'Laos',
|
|
||||||
LV: 'Latvia',
|
|
||||||
LB: 'Lebanon',
|
|
||||||
LS: 'Lesotho',
|
|
||||||
LR: 'Liberia',
|
|
||||||
LY: 'Libya',
|
|
||||||
LI: 'Liechtenstein',
|
|
||||||
LT: 'Lithuania',
|
|
||||||
LU: 'Luxembourg',
|
|
||||||
MK: 'Macedonia',
|
|
||||||
MG: 'Madagascar',
|
|
||||||
MW: 'Malawi',
|
|
||||||
MY: 'Malaysia',
|
|
||||||
MV: 'Maldives',
|
|
||||||
ML: 'Mali',
|
|
||||||
MT: 'Malta',
|
|
||||||
MH: 'Marshall Islands',
|
|
||||||
MR: 'Mauritania',
|
|
||||||
MU: 'Mauritius',
|
|
||||||
MX: 'Mexico',
|
|
||||||
MD: 'Moldova',
|
|
||||||
MC: 'Monaco',
|
|
||||||
MN: 'Mongolia',
|
|
||||||
ME: 'Montenegro',
|
|
||||||
MA: 'Morocco',
|
|
||||||
MZ: 'Mozambique',
|
|
||||||
MM: 'Myanmar',
|
|
||||||
NA: 'Namibia',
|
|
||||||
NR: 'Nauru',
|
|
||||||
NP: 'Nepal',
|
|
||||||
NL: 'Netherlands',
|
|
||||||
NZ: 'New Zealand',
|
|
||||||
NI: 'Nicaragua',
|
|
||||||
NE: 'Niger',
|
|
||||||
NG: 'Nigeria',
|
|
||||||
KP: 'North Korea',
|
|
||||||
NO: 'Norway',
|
|
||||||
OM: 'Oman',
|
|
||||||
PK: 'Pakistan',
|
|
||||||
PW: 'Palau',
|
|
||||||
PS: 'Palestine',
|
|
||||||
PA: 'Panama',
|
|
||||||
PG: 'Papua New Guinea',
|
|
||||||
PY: 'Paraguay',
|
|
||||||
PE: 'Peru',
|
|
||||||
PH: 'Philippines',
|
|
||||||
PL: 'Poland',
|
|
||||||
PT: 'Portugal',
|
|
||||||
QA: 'Qatar',
|
|
||||||
RO: 'Romania',
|
|
||||||
RU: 'Russia',
|
|
||||||
RW: 'Rwanda',
|
|
||||||
KN: 'Saint Kitts and Nevis',
|
|
||||||
LC: 'Saint Lucia',
|
|
||||||
VC: 'Saint Vincent and the Grenadines',
|
|
||||||
WS: 'Samoa',
|
|
||||||
SM: 'San Marino',
|
|
||||||
ST: 'São Tomé and Príncipe',
|
|
||||||
SA: 'Saudi Arabia',
|
|
||||||
SN: 'Senegal',
|
|
||||||
RS: 'Serbia',
|
|
||||||
SC: 'Seychelles',
|
|
||||||
SL: 'Sierra Leone',
|
|
||||||
SG: 'Singapore',
|
|
||||||
SK: 'Slovakia',
|
|
||||||
SI: 'Slovenia',
|
|
||||||
SB: 'Solomon Islands',
|
|
||||||
SO: 'Somalia',
|
|
||||||
ZA: 'South Africa',
|
|
||||||
KR: 'South Korea',
|
|
||||||
SS: 'South Sudan',
|
|
||||||
ES: 'Spain',
|
|
||||||
LK: 'Sri Lanka',
|
|
||||||
SD: 'Sudan',
|
|
||||||
SR: 'Suriname',
|
|
||||||
SZ: 'Swaziland',
|
|
||||||
SE: 'Sweden',
|
|
||||||
CH: 'Switzerland',
|
|
||||||
SY: 'Syria',
|
|
||||||
TW: 'Taiwan',
|
|
||||||
TJ: 'Tajikistan',
|
|
||||||
TZ: 'Tanzania',
|
|
||||||
TH: 'Thailand',
|
|
||||||
BS: 'The Bahamas',
|
|
||||||
GM: 'The Gambia',
|
|
||||||
TG: 'Togo',
|
|
||||||
TO: 'Tonga',
|
|
||||||
TT: 'Trinidad and Tobago',
|
|
||||||
TN: 'Tunisia',
|
|
||||||
TR: 'Turkey',
|
|
||||||
TM: 'Turkmenistan',
|
|
||||||
TV: 'Tuvalu',
|
|
||||||
UG: 'Uganda',
|
|
||||||
UA: 'Ukraine',
|
|
||||||
UY: 'Uruguay',
|
|
||||||
UZ: 'Uzbekistan',
|
|
||||||
VU: 'Vanuatu',
|
|
||||||
VA: 'Vatican City',
|
|
||||||
VE: 'Venezuela',
|
|
||||||
VN: 'Vietnam',
|
|
||||||
EH: 'Western Sahara',
|
|
||||||
YE: 'Yemen',
|
|
||||||
ZM: 'Zambia',
|
|
||||||
ZW: 'Zimbabwe',
|
|
||||||
};
|
|
||||||
var newCountry = '{{JS - ISO Country Code to EVBG Country Name}}(newValue)';
|
|
||||||
console.log("newCountry: %s", newCountry);
|
|
||||||
// sets the value in the form the user can see
|
// sets the value in the form the user can see
|
||||||
if (typeof MktoForms2 !== 'undefined') {
|
if (typeof MktoForms2 !== 'undefined') {
|
||||||
mktoForm.setValues({
|
mktoForm.setValues({
|
||||||
Country: /*countries[newValue.toUpperCase()]*/ newCountry
|
Country: newCountry
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -319,15 +117,15 @@
|
|||||||
// add the elements to the DOM
|
// add the elements to the DOM
|
||||||
iframeHolderDiv.appendChild(fillScript);
|
iframeHolderDiv.appendChild(fillScript);
|
||||||
autoFillLocation.prepend(iframeHolderDiv);
|
autoFillLocation.prepend(iframeHolderDiv);
|
||||||
firstRow.appendChild(hiddenLinkedInInputs); // fragment vaporizes leaving input elements
|
|
||||||
|
|
||||||
if (typeof MktoForms2 !== 'undefined') {
|
if (typeof MktoForms2 !== 'undefined') {
|
||||||
MktoForms2.whenReady(function (form) {
|
MktoForms2.whenReady(function (form) {
|
||||||
// need the id of the form so we can hook up autofill
|
// need the id of the form so we can hook up autofill
|
||||||
// doing this way will work on any Marketo form
|
// doing this way will work on any Marketo form
|
||||||
fillScript.setAttribute('data-form', 'mktoForm_' + form.getId());
|
fillScript.setAttribute('data-form', 'mktoForm_' + form.getId());
|
||||||
firstRow = document.querySelector('form .mktoFormRow'); // so we can use it above
|
firstRow = document.querySelector('form .mktoFormRow');
|
||||||
mktoForm = form; // so we can use it above
|
mktoForm = form; // so we can use it above
|
||||||
|
firstRow.appendChild(hiddenLinkedInInputs); // fragment vaporizes leaving input elements
|
||||||
form.onSubmit(function (form) {
|
form.onSubmit(function (form) {
|
||||||
// tell GA about it, but only if we know they autofilled
|
// tell GA about it, but only if we know they autofilled
|
||||||
if (linkedInAutofillClicked) {
|
if (linkedInAutofillClicked) {
|
||||||
|
Loading…
Reference in New Issue
Block a user