' + newsletterRecord.description + ''; featuredContent.appendChild(featuredHeader); featuredContent.appendChild(featuredDescription); featuredContent.append(featuredCheckbox); featuredDiv.appendChild(featuredImage); featuredDiv.appendChild(featuredContent); featuredSection.appendChild(featuredLabel); featuredSection.appendChild(featuredSubLabel); featuredSection.appendChild(featuredDiv); return featuredSection; } function buildNewsletter(newsletterRecord, affiliate) { var listingDiv = document.createElement('div'); listingDiv.classList.add('newsletterlist__listings--listing'); listingDiv.setAttribute('data-category', newsletterRecord.category); var listingImage = document.createElement('img'); listingImage.src = imgAssets + affiliate + '/' + newsletterRecord.image; listingImage.height = 72; listingImage.alt = newsletterRecord.name; var listingHeader = document.createElement('h3'); var listingHeaderLabel = document.createElement('span'); listingHeaderLabel.classList.add('newsletterlist__listings--listing-checkbox-wrapper'); var listingHeaderInput = document.createElement('input'); listingHeaderInput.type = 'checkbox'; listingHeaderInput.name = 'lists[' + newsletterRecord.st_list + ']'; listingHeaderInput.id = 'lists[' + newsletterRecord.st_list + ']'; listingHeaderInput.classList.add('newsletterlist__listings--listing-checkbox'); var listingButtonIcon = document.createElement('span'); listingButtonIcon.classList.add('button-icon'); var listingButtonText = document.createElement('span'); listingButtonText.classList.add('button-text'); var listingButton = document.createElement('div'); listingButton.classList.add('listing-button'); listingButton.appendChild(listingButtonIcon); listingButton.appendChild(listingButtonText); var listingCheckbox = document.createElement('label'); listingCheckbox.classList.add('newsletterlist__listings--listing-checkbox-label'); listingCheckbox.setAttribute('for', 'lists[' + newsletterRecord.st_list + ']'); listingCheckbox.appendChild(listingHeaderInput); listingCheckbox.appendChild(listingButton); var listingSchedule = document.createElement('span'); listingSchedule.classList.add('newsletterlist__listings--listing-schedule'); listingSchedule.append(" " + newsletterRecord.frequency); listingHeaderLabel.append(newsletterRecord.name); listingHeader.append(listingHeaderLabel); listingHeader.append(listingSchedule) var listingDescription = document.createElement('div'); listingDescription.classList.add('newsletterlist__listings--listing-description'); listingDescription.innerHTML = '

' + newsletterRecord.description + ''; listingDiv.appendChild(listingImage); listingDiv.appendChild(listingHeader); listingDiv.appendChild(listingDescription); listingDiv.append(listingCheckbox); return listingDiv; } function useNewsletterData(data) { console.log(data); document.title = data.title + ' Newsletters'; var listingsdiv = document.querySelector('.js-all-listings'); for (i = 0; i < data.newsletter_data.length; i++) { if (data.featured !== data.newsletter_data[i].name) { var newsletterDiv = buildNewsletter(data.newsletter_data[i], data.affiliate); listingsdiv.appendChild(newsletterDiv); }; } var featuredDiv = document.querySelector('.newsletterlist__featured'); for (i = 0; i < data.newsletter_data.length; i++) { if (data.featured === data.newsletter_data[i].name) { var newsletterDiv = buildFeaturedNewsletter(data.newsletter_data[i], data.affiliate); featuredDiv.appendChild(newsletterDiv); break; } } var brandUrl = document.querySelector('.js-brand-url'); brandUrl.href = data.brandUrl; brandUrl.setAttribute('aria-label', data.title); var brandLogo = document.querySelector('.js-brand-logo'); brandLogo.src = imgAssets + data.affiliate + '/' + data.brandLogo; brandLogo.alt = data.title; // New code block 3/25 // if (data.subHeader !== '' && data.subHeader !== undefined) { // var brandSubhead = document.querySelector('.js-subheader'); // brandSubhead.innerText = data.subHeader; // brandSubhead.style.display = 'block'; // } // Sailthru "data-autofill" workaround var subscribedLists = ["Suppress_for_perm_pass_subex1"]; subscribedLists.forEach(function(list) { var newsletterCheckbox = document.querySelector('input[name="lists[' + list + ']"]'); if (newsletterCheckbox != null) { newsletterCheckbox.click(); newsletterCheckbox.classList.add('subscribed'); } var newsletterCheckboxLabel = document.querySelector('label[for="lists[' + list + ']"]'); if (newsletterCheckboxLabel != null) { newsletterCheckboxLabel.classList.add('subscribed'); } }) } function initNewsletterPage(affiliate) { var jsonFilename = jsonAssets + affiliate + '.json'; loadNewsletterJSON(jsonFilename, useNewsletterData); } Newsletters

Email Newsletters

By signing up you agree to our user agreement (including the class action waiver and arbitration provisions) and privacy policy.