(function () { if (window.__rinksInterestFormLoaded) return; window.__rinksInterestFormLoaded = true; /* REQUIRED: the published Rinks handler Cloud Page URL */ var HANDLER_URL = 'https://mc7txmycwvzxsyss0sdtq5m6w-3y.pub.sfmc-content.com/hyqh2fvr3ln'; var ROOT_ID = 'rinks-interest-form'; var SOURCE_VALUE = 'Rinks Newsletter - Website Lead Gen'; var PRIVACY_URL = 'https://www.therinks.com/privacy-policy/'; /* [ field name , title , description , (optional) fine print ] Order and labels match the SFMC preference center. The LAST item (pref_sms) is the SMS channel — treated separately from email. */ var PREFERENCES = [ ['pref_newsletter', 'Rinks Newsletter', 'Weekly events and offers from The Rinks & Great Park Ice'], ['pref_hockey', 'Rinks Hockey', 'News and events for all Rinks Hockey programming'], ['pref_figure_skating', 'Rinks Figure Skating', 'News and events for all Rinks Figure Skating programming'], ['pref_travel_hs', 'Rinks Travel & High School Hockey', 'Updates about Jr. Ducks, Lady Ducks, OCHC, & ADHSHL'], ['pref_locations', 'Rinks Locations', 'Quarterly updates for Rinks facilities and Great Park Ice'], ['pref_youth_hockey', 'Rinks Youth Hockey', 'News and events for all Rinks Youth Hockey programming'], ['pref_adult_hockey', 'Rinks Adult Hockey', 'News and events for all Rinks Adult Hockey programming'], ['pref_ducks_learn', 'Rinks Anaheim Ducks Learn to Play', 'Updates about the Anaheim Ducks Learn to Play program'], ['pref_learn_to_skate', 'Rinks Learn to Skate', 'Updates and schedules for Rinks Learn to Skate programs'], ['pref_sd_county', 'Rinks San Diego County Programs', 'Updates about Rinks programs and events in San Diego County'], ['pref_sms', 'Rinks SMS', 'Text message updates and alerts from The Rinks', 'By subscribing to Rinks SMS and providing my mobile number, I agree to receive text message notifications from The Rinks at 81883. Message frequency varies depending on activity. Message and data rates may apply.'] ]; var SMS_ID = 'pref_sms'; function esc(s) { return String(s == null ? '' : s).replace(/&/g, '&').replace(//g, '>'); } /* Scoped CSS */ var css = [ '#rinks-interest-form *,#rinks-interest-form *::before,#rinks-interest-form *::after{box-sizing:border-box;}', '#rinks-interest-form{font-family:inherit;color:#111;max-width:680px;}', '#rinks-interest-form .rif-group{margin-bottom:20px;}', '#rinks-interest-form label.rif-label{display:block;font-size:15px;font-weight:400;color:#111;margin-bottom:6px;}', '#rinks-interest-form .rif-req{color:#cc0000;margin-left:2px;}', '#rinks-interest-form input[type="text"],#rinks-interest-form input[type="email"],#rinks-interest-form input[type="tel"]{width:100%;padding:10px 12px;font-size:15px;border:1.5px solid #888;border-radius:4px;outline:none;color:#111;background:#fff;-webkit-appearance:none;appearance:none;transition:border-color .15s;}', '#rinks-interest-form input[type="text"]:focus,#rinks-interest-form input[type="email"]:focus,#rinks-interest-form input[type="tel"]:focus{border-color:#333;}', '#rinks-interest-form input.rif-invalid,#rinks-interest-form input.rif-invalid:focus{border-color:#cc0000;}', /* preference banner */ '#rinks-interest-form .rif-pref-banner{background:#d1481f;color:#fff;font-weight:700;text-transform:uppercase;text-align:center;letter-spacing:.5px;padding:14px 16px;font-size:15px;line-height:1.3;margin:8px 0 20px;border-radius:2px;}', /* preference list (title + description, single column) */ '#rinks-interest-form .rif-pref-item{display:flex;align-items:flex-start;gap:12px;margin-bottom:18px;cursor:pointer;}', '#rinks-interest-form .rif-pref-item input[type="checkbox"]{width:18px;height:18px;margin-top:2px;cursor:pointer;flex-shrink:0;position:relative;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:1.5px solid #888;border-radius:3px;background-color:#fff;background-image:none;padding:0;vertical-align:middle;}', '#rinks-interest-form .rif-pref-item input[type="checkbox"]:checked{background-color:#e04e27;border-color:#e04e27;}', '#rinks-interest-form .rif-pref-item input[type="checkbox"]:checked::after{content:\'\';display:block;position:absolute;left:5px;top:2px;width:5px;height:9px;border:2px solid #fff;border-top:none;border-left:none;-webkit-transform:rotate(45deg);transform:rotate(45deg);}', '#rinks-interest-form .rif-pref-text{display:flex;flex-direction:column;}', '#rinks-interest-form .rif-pref-title{font-weight:700;color:#e04e27;font-size:15px;line-height:1.3;}', '#rinks-interest-form .rif-pref-desc{font-size:13px;color:#555;margin-top:2px;line-height:1.4;}', '#rinks-interest-form .rif-pref-fine{font-size:11px;color:#777;margin-top:5px;line-height:1.4;}', /* consent statements (no checkbox) */ '#rinks-interest-form .rif-consent{font-size:12.5px;color:#555;line-height:1.55;margin:6px 0 14px;}', '#rinks-interest-form .rif-consent a{color:#e04e27;text-decoration:underline;}', '#rinks-interest-form .rif-error-msg{font-size:13px;color:#cc0000;margin-top:5px;display:none;}', '#rinks-interest-form .rif-inline-error{font-size:.875rem;color:#991b1b;background:#fef2f2;border:1px solid #fca5a5;border-radius:4px;padding:12px 16px;margin-bottom:16px;display:none;}', '#rinks-interest-form input.rif-submit,#rinks-interest-form .rif-submit{display:inline-block !important;width:auto !important;margin-top:8px !important;padding:10px 26px !important;background:#e04e27 !important;background-image:none !important;color:#fff !important;font-size:15px !important;font-weight:600 !important;line-height:normal !important;border:none !important;border-radius:4px !important;cursor:pointer !important;font-family:inherit !important;text-align:center !important;text-decoration:none !important;text-transform:none !important;opacity:1 !important;-webkit-appearance:none !important;appearance:none !important;box-shadow:none !important;}', '#rinks-interest-form input.rif-submit:hover:not(:disabled),#rinks-interest-form .rif-submit:hover:not(:disabled){background:#c53f1d !important;}', '#rinks-interest-form input.rif-submit:disabled,#rinks-interest-form .rif-submit:disabled{opacity:.6 !important;cursor:not-allowed !important;}', '#rinks-interest-form .rif-msg{display:none;padding:24px;border-radius:4px;margin-top:8px;}', '#rinks-interest-form .rif-success{background:#f0fdf4;border:1px solid #86efac;}', '#rinks-interest-form .rif-success h3{color:#166534;font-size:1.1rem;margin:0 0 6px;}', '#rinks-interest-form .rif-success p{color:#166534;font-size:.9rem;margin:0;}', '#rinks-interest-form .rif-error-box{background:#fef2f2;border:1px solid #fca5a5;}', '#rinks-interest-form .rif-error-box h3{color:#991b1b;font-size:1.1rem;margin:0 0 6px;}', '#rinks-interest-form .rif-error-box p{color:#991b1b;font-size:.9rem;margin:0;}' ].join(''); var styleEl = document.createElement('style'); styleEl.textContent = css; document.head.appendChild(styleEl); /* ── Form HTML ──────────────────────────────────────────── */ var prefItems = PREFERENCES.map(function (p) { var fine = p[3] ? '' + esc(p[3]) + '' : ''; return ''; }).join(''); var formHTML = '
' + '
Please complete all required fields.
' + '
' + '' + '' + '
Please enter valid email address
' + '
' + '
' + '' + '' + '
Please enter first name
' + '
' + '
' + '' + '' + '
Please enter last name
' + '
' + '
' + '' + '' + '
A mobile number is required to receive Rinks SMS.
' + '
' + '
' + '' + '' + '
' + '
SELECT THE TYPES OF EMAILS YOU’D LIKE TO RECEIVE
' + '
' + prefItems + '
' /* Privacy acknowledgment — statement, no checkbox */ + '' /* Email consent — statement, no checkbox */ + '' + '' + '
' + '
' + '
' + '

You’re All Set!

' + '

Thanks for your interest — your preferences have been saved.

' + '
' + '
' + '

Something Went Wrong

' + '

We weren\'t able to save your preferences. Please try again in a moment.

' + '
'; function render() { var root = document.getElementById(ROOT_ID); if (!root) { console.warn('[Rinks Interest Form] #' + ROOT_ID + ' not found.'); return; } root.innerHTML = formHTML; initForm(); } function getQueryParam(name) { var m = new RegExp('[?&]' + name + '=([^&#]*)').exec(window.location.search); return m ? decodeURIComponent(m[1].replace(/\+/g, ' ')) : ''; } var EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; function initForm() { var RULES = [ { id: 'rif_email', box: 'rif_err_email', test: function (v) { return EMAIL_RE.test(v); } }, { id: 'rif_firstName', box: 'rif_err_firstName', test: function (v) { return v.length > 0; } }, { id: 'rif_lastName', box: 'rif_err_lastName', test: function (v) { return v.length > 0; } } ]; function check(rule, showError) { var input = document.getElementById(rule.id); var box = document.getElementById(rule.box); var ok = rule.test(input.value.replace(/^\s+|\s+$/g, '')); if (ok) { box.style.display = 'none'; input.classList.remove('rif-invalid'); } else if (showError) { box.style.display = 'block'; input.classList.add('rif-invalid'); } return ok; } /* phone is required only when Rinks SMS is selected */ function checkPhoneForSms(showError) { var sms = document.getElementById('rif_' + SMS_ID); var phone = document.getElementById('rif_phone'); var box = document.getElementById('rif_err_phone'); var ok = !sms.checked || phone.value.replace(/^\s+|\s+$/g, '').length > 0; if (ok) { box.style.display = 'none'; phone.classList.remove('rif-invalid'); } else if (showError) { box.style.display = 'block'; phone.classList.add('rif-invalid'); } return ok; } for (var i = 0; i < RULES.length; i++) { (function (rule) { var input = document.getElementById(rule.id); input.addEventListener('input', function () { check(rule, false); }); input.addEventListener('blur', function () { if (document.getElementById(rule.box).style.display === 'block') { check(rule, true); } }); })(RULES[i]); } document.getElementById('rif_phone').addEventListener('input', function () { checkPhoneForSms(false); }); document.getElementById('rif_' + SMS_ID).addEventListener('change', function () { checkPhoneForSms(false); }); /* populate email box from ?email= on the host page URL */ var pfEmail = getQueryParam('email'); if (pfEmail) { document.getElementById('rif_email').value = pfEmail; } /* ── Submit ────────────────────────────────────────────── */ document.getElementById('rif-form').addEventListener('submit', function (e) { e.preventDefault(); var inlineErr = document.getElementById('rif_inlineError'); inlineErr.style.display = 'none'; var firstBad = null; for (var j = 0; j < RULES.length; j++) { if (!check(RULES[j], true) && firstBad === null) { firstBad = RULES[j].id; } } if (!checkPhoneForSms(true) && firstBad === null) { firstBad = 'rif_phone'; } if (firstBad !== null) { inlineErr.style.display = 'block'; document.getElementById(firstBad).focus(); return; } var btn = document.getElementById('rif_submitBtn'); btn.disabled = true; btn.value = 'Submitting...'; var form = document.getElementById('rif-form'); var params = new URLSearchParams(new FormData(form)); var callbackName = '__rinksSubmit_' + Date.now(); params.set('callback', callbackName); params.set('submitted', 'true'); var scriptEl = document.createElement('script'); var timeoutId; function cleanup() { clearTimeout(timeoutId); try { delete window[callbackName]; } catch (x) { window[callbackName] = undefined; } if (scriptEl.parentNode) { scriptEl.parentNode.removeChild(scriptEl); } } function showError(message) { inlineErr.textContent = message || 'Please complete all required fields.'; inlineErr.style.display = 'block'; inlineErr.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); btn.disabled = false; btn.value = 'Submit'; } window[callbackName] = function (result) { cleanup(); if (result && result.success) { document.getElementById('rif-form').style.display = 'none'; document.getElementById('rif_success').style.display = 'block'; } else { showError(result && result.error); } }; scriptEl.onerror = function () { cleanup(); document.getElementById('rif-form').style.display = 'none'; document.getElementById('rif_error').style.display = 'block'; }; timeoutId = setTimeout(function () { cleanup(); showError('The request timed out. Please try again.'); }, 15000); scriptEl.src = HANDLER_URL + '?' + params.toString(); document.head.appendChild(scriptEl); }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', render); } else { render(); } })();