/*! ITC ADA Accessibility Shim | (c) Insurance Technologies Corp. | getitc.com */ const adaEnums = Object.freeze({ "undefined": 0, "Alt": 1, "Long": 2, "Title": 3, "Meta": 4, "Header": 5, "Input": 6, "Anchor": 7, "Label": 8, "Area": 9, "Language": 10, "Aria": 11, "Visual": 12, "Menu": 13, "Animation": 14, "Table": 15 }); var adaRemediationResults = []; function adaRemediationResult(level, type, title, docElement, remediated, message) { this.level = level; this.type = type; this.title = title; this.docElement = docElement; if (message) { this.message = message; } else { this.message = "" }; this.remediated = remediated; } document.addEventListener("DOMContentLoaded", function () { adaShim_reviewITC(); adaShim_reviewSmartHarbor(); adaShim_reviewFontAwesome(); adaShim_ADAFullReview(); const label = "ADA Remediation Results"; console.groupCollapsed(label); console.log("Found Issues", adaRemediationResults); console.groupEnd(label); }, false); // rerun the images test for dynamically loaded images window.addEventListener('load', function () { [].slice.apply(document.querySelectorAll("img"), null).forEach(function (node) { adaShim_testImage(node); }); }); function adaShim_reviewITC () { // ITC specific labels [].slice.apply(document.querySelectorAll(".searchquery, input, select, button, textarea"), null).forEach(function (node) { switch (node.id) { case "txtCompanyName": node.setAttribute("aria-label", "Company name field."); node.alt = "Company Name"; adaShim_log(node, "Company name input shimmed", adaEnums.Input, true); break; case "txtFirstName": case "txtPrimaryFirst": case "home-quote_first-name": node.setAttribute("aria-label", "First name field."); node.alt = "First Name"; adaShim_log(node, "First name input shimmed", adaEnums.Input, true); break; case "txtLastName": case "txtPrimaryLast": case "home-quote_last-name": node.setAttribute("aria-label", "Last name field."); node.alt = "Last Name"; adaShim_log(node, "Last name input shimmed", adaEnums.Input, true); break; case "txtEmailAddress": case "txtEmail": case "home-quote_email": node.setAttribute("aria-label", "EMail field."); node.alt = "Email"; adaShim_log(node, "Email input shimmed", adaEnums.Input, true); break; case "txtPrimaryNumber": case "txtPhoneNumber": case "home-quote_phone": node.setAttribute("aria-label", "Phone number field."); node.alt = "Phone Number"; adaShim_log(node, "Phone number input shimmed", adaEnums.Input, true); break; case "txtInsurance": case "quoteForms": case "redAvailForms": case "home-quote_product": node.setAttribute("aria-label", "What type of insurance are you looking for?"); node.alt = "What insurance are you looking for?"; adaShim_log(node, "Lines of business input shimmed", adaEnums.Input, true); break; case "txtZIP": case "redZIP": node.setAttribute("aria-label", "Zip code field."); node.alt = "Postal Code"; adaShim_log(node, "Postal code input shimmed", adaEnums.Input, true); break; case "txtComments": node.setAttribute("aria-label", "Comments field."); node.alt = "Comments"; adaShim_log(node, "Comments input shimmed", adaEnums.Input, true); break; case "redSubmit": case "qcfSubmit": node.setAttribute("aria-label", "Submit the quick form."); node.alt = "Submit"; adaShim_log(node, "Submit input shimmed", adaEnums.Input, true); break; case "GaragingState": node.setAttribute("aria-label", "Garaging state entry."); node.alt = "Garaging state"; adaShim_log(node, "TRfW garging input shimmed", adaEnums.Input, true); break; case "ComparisonSortList": node.setAttribute("aria-label", "Sort results by"); node.alt = "Sort results"; adaShim_log(node, "TRfW results sort input shimmed", adaEnums.Input, true); break; case "time": node.setAttribute("aria-label", "Time of day to contact"); node.alt = "Time of Day"; adaShim_log(node, "TRfW time input shimmed", adaEnums.Input, true); break; case "RefreshScripts": case "engine": case "stateAbbrevs": case "NoRatesCustom": case "CustomQuoteMsgHid": case "top3hid": case "addlHid": case "top3hidAU": case "addlHidAU": case "CustomIWantItText": node.setAttribute("aria-hidden", "true"); node.setAttribute("aria-label", "Hidden process fields. Not used."); node.alt = "Hidden " + node.id; adaShim_log(node, "TRfW hidden inputs shimmed", adaEnums.Input, true); break; default: if (!node.hasAttribute("aria-label") && node.hasAttribute("placeholder")) { node.setAttribute("aria-label", node.getAttribute("placeholder")); adaShim_log(node, "Shimmed input node with placeholder", adaEnums.Input, true); } } if (node.classList.contains("searchquery")) { node.setAttribute("aria-label", "Search the entire site using this field."); node.alt = "Search this site"; adaShim_log(node, "Input shimmed", adaEnums.Input, true); } }); // TRfW specific [].slice.apply(document.querySelectorAll(".innerPage > .inputPanel"), null).forEach(function (node) { var labelID; var panelInput = node.querySelectorAll("input, select, button")[0]; if (!panelInput || panelInput.id && document.querySelectorAll("label[for=" + panelInput.id + "]").length != 0) { return; }; // redo label var divToReplaceWithLabel = node.getElementsByClassName("panelTitle")[0]; if (divToReplaceWithLabel.id) { labelID = divToReplaceWithLabel.id; } else { labelID = divToReplaceWithLabel.id = "ada_shim_label_for_" + panelInput.id.toLowerCase(); } if (divToReplaceWithLabel.tagName.toLowerCase() == "div") { var replaceLabel = document.createElement("label"); replaceLabel.id = labelID; replaceLabel.setAttribute("for", panelInput.id); replaceLabel.textContent = divToReplaceWithLabel.textContent; if (divToReplaceWithLabel.classList) { replaceLabel.classList = divToReplaceWithLabel.classList; }; adaShim_log(node, "Replaced <" + divToReplaceWithLabel.tagName.toLowerCase() + "." + divToReplaceWithLabel.style + "> with