var handler = function (api) { const prev = (el, selector) => { if (document.querySelector(selector) == null) { return null } let selectorType = document.querySelector(selector).tagName let ret = el.previousElementSibling while (ret.tagName !== selectorType) { ret = ret.previousElementSibling } return (ret) } api.executeScript(".table.table-striped.table-bordered.table-sm", (table => { let tableContainer = table.closest(".table-responsive").parentElement let desc = "table description: " + prev(tableContainer, "h3").textContent table.setAttribute("aria-label", desc) })) api.executeScript("#bamTable table", (table) => { let desc = api.getLocalization("assetAllocation") table.setAttribute("aria-label", desc) }) api.executeScript("#post-81211", (retainageAndFranchise ) => { let table = retainageAndFranchise.querySelector("table") table.setAttribute("aria-label", "Retainage and Franchise table") }) let tables = document.querySelectorAll(".table.table-striped.table-bordered") if (tables.length > 0) { tables.forEach((table) => { if (table.getAttribute("aria-label") == null) { // console.log("this table dont have label") // console.log(table) // table.style.setProperty("border", "3px solid red") let tableContainer = table.closest(".table-responsive") // let myPrev = table.closest(".table-responsive").previousElementSibling let myPrev for (let i = 4; i > 0; i--) { let headingLookUp = `h${i}` let curPrev = prev(tableContainer,headingLookUp) if(curPrev){ myPrev = curPrev break } } // console.log(myPrev) if (!myPrev.classList.contains('.table-responsive')) { //heading let myHeadingStr = myPrev.textContent.trim() let myNewStr = `Table description: ${myHeadingStr}` table.setAttribute("aria-label", myNewStr) } } }) } // api.executeScript(".table.table-striped.table-bordered.table-sm", (table => { // if (table.getAttribute("aria-label") == null) { // console.log("this table dont have label") // console.log(table) // table.style.setProperty("border", "3px solid red") // } // })) } handler(window.u1st.evaluate('body')) try{ (api => { })(window.u1st.autocorrect) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.description.expression('div.newsDate input', (container) => { const label = document.querySelector(".newsDate > label") return label.innerText }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { api.carousel({ autoMoving: true, selectors: { absoluteSliderContainer: '#carouselFeatured', sliderItem: '.carousel-item', slidePickerButtonsContainer: '.carousel-indicators', slidePickerButtons: '.carousel-indicators button' } }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ // const tables = document.querySelectorAll("table.table.table-striped.table-bordered.table-sm") // console.log("next") // console.log(tables[2]) // console.log(tables) //for monday - add description - set attribute // api.description.manual("table", "d.o.b table1") } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { // let currentIndex, subIndex; // const NAV_KEYS = { // up: 38, // down: 40, // left: 37, // right: 39, // esc: 27, // tab: 9, // space: 32, // ent: 13, // end: 35, // home: 36, // }; // let _filterCondition = (el) => { // if (el.closest(".breadcrumbs") != null) { // return ( // el.closest("#navbarContent") == null && // (parseInt(el.getAttribute("tabindex")) > -1 || // el.getAttribute("tabindex") == null) && // getComputedStyle(el.closest(".breadcrumbs")).display != "none" // ); // } // return ( // el.closest("#navbarContent") == null && // (parseInt(el.getAttribute("tabindex")) > -1 || // el.getAttribute("tabindex") == null) // ); // }; // let _filterConditionAll = (el, elem) => { // // use it inside goToSubIndex // if (el.closest("ul.row.list-unstyled") != null) { // return ( // el.closest("ul.row.list-unstyled") == // elem.closest("ul.row.list-unstyled") // ); // } else if (el.closest(".dropdown-menu") != null) { // return ( // el.closest(".dropdown-menu") == elem.closest(".dropdown-menu") // ); // } // }; // let _filterConditionAll2 = (el, elem) => { // // use it inside goToSubIndex // if (el.closest(".row") != null) { // return el.closest(".row") == elem.closest(".row"); // } else // return ( // el.closest("ul.list-unstyled") == // elem.closest("ul.list-unstyled") // ); // }; // const findPrevOrNextTab = (elem, prevOrnext, filterCondition) => { // let _tabbable = [...document.querySelectorAll("*")].filter((el) => { // return ( // (window.getComputedStyle(el).display !== "none" && // (el.nodeName == "TEXTAREA" || // el.nodeName == "BUTTON" || // el.nodeName == "AREA" || // el.nodeName == "OBJECT" || // (el.nodeName == "A" && // el.getAttribute("href") && // el.getAttribute("href") !== undefined) || // (el.nodeName == "INPUT" && // el.getAttribute("type") && // el.getAttribute("type") !== "hidden"))) || // parseInt(el.getAttribute("tabindex")) > -1 // ); // }); // let _tabbableArr = [..._tabbable]; // let _myIndex = _tabbableArr.indexOf(elem); // if (prevOrnext == "next") { // let nextOptions = _tabbableArr // .slice(_myIndex + 1) // .filter(filterCondition); // let nextTab = nextOptions[0]; // // console.log("nextTab: "); // // console.log(nextTab); // return nextTab; // } // if (prevOrnext == "prev") { // let prevOptions = _tabbableArr // .slice(0, _myIndex) // .filter(filterCondition); // let prevTab = prevOptions[prevOptions.length - 1]; // // console.log("prevTab: "); // // console.log(prevTab); // return prevTab; // } else { // //all // let allOptions = _tabbableArr.filter( // filterCondition.bind(this, elem) // ); // // console.log("allOptions: "); // // console.log(allOptions); // return allOptions; // } // }; // const goToIndex = (idx, topLevelLinks) => { // if (idx == topLevelLinks.length) { // idx = 0; // } else if (idx < 0) { // // end of list // idx = topLevelLinks.length - 1; // } // topLevelLinks[idx].focus(); // currentIndex = idx; // }; // const goToSubIndex = (idx, menu) => { // let items = findPrevOrNextTab( // menu.querySelector("a"), // "all", // _filterConditionAll // ); // // console.log("items: "); // // console.log(items); // if (idx == items.length) { // idx = 0; // } else if (idx < 0) idx = items.length - 1; // let firstSubmenuLink = items[idx]; // firstSubmenuLink.addEventListener("focusin", (e) => { // firstSubmenuLink.style.setProperty( // "outline", // "black solid 3px ", // "important" // ); // }), // addEventListener("focusout", (e) => { // firstSubmenuLink.style.setProperty("outline", " ", "important"); // }); // items[idx].focus(); // subIndex = idx; // }; // const clickButNotOpen = (link) => { // // console.log("inside clickButNotOpen"); // if ( // link.getAttribute("aria-expanded") == "false" || // link.getAttribute("aria-expanded") == null // ) { // link.setAttribute("aria-expanded", "true"); // } else { // link.setAttribute("aria-expanded", "false"); // } // return true; // }; // const hideOrShowSubMenu = (hide = true, subMenuElement) => { // // let tooltipElem = subMenuElement.parentElement.querySelector( // // 'div.dropdown-menu[data-toggle="tooltip"]' // // ); // // // // let toolTipHandle = new bootstrap.Tooltip(tooltipElem); // let isSearch = subMenuElement.tagName == "FORM" ? true : false; // let myTrigger = subMenuElement.previousElementSibling; // if (isSearch) { // let searchOpenBtn = document.querySelector(".searchbox-icon"); // searchOpenBtn.click(); // } // if (hide) { // // // if (toolTipHandle) toolTipHandle.hide(); // subMenuElement.style.display = "none"; // myTrigger.classList.remove("show"); //bootstrap problem // subMenuElement.classList.remove("show"); //bootstrap problem // myTrigger.parentElement.classList.remove("open"); // } // if (!hide) { // // // if (toolTipHandle) toolTipHandle.show(); // subMenuElement.style.display = "block"; // myTrigger.classList.add("show"); //bootstrap problem // subMenuElement.classList.add("show"); //bootstrap problem // myTrigger.parentElement.classList.add("open"); //bootstrap problem // } // }; // const addFirstLevelLink2SubMenu = (firstLevelLinkElem) => { // let items = findPrevOrNextTab( // firstLevelLinkElem.nextElementSibling.querySelector("a"), // "all", // _filterConditionAll // ); // let firstLink = items[0]; // // let firstLi = firstLink.closest("li"); // let firstLinkParent = firstLink.parentElement; // let firstLinkParentContainer = firstLinkParent.parentElement; // let nextDiv = firstLevelLinkElem.nextElementSibling; // // let firstLiClassList = firstLi.classList; // let firstLinkParentClassList = firstLinkParent.classList; // let firstLinkClassList = firstLink.classList; // // let newLi = document.createElement("li"); // let newLinkParent = document.createElement(firstLinkParent.tagName); // let newLink = document.createElement("a"); // let newLinkText = `${firstLevelLinkElem.textContent} page`; // // firstLiClassList.forEach((className) => { // // newLi.classList.add(className); // // }); // firstLinkParentClassList.forEach((className) => { // newLinkParent.classList.add(className); // }); // firstLinkClassList.forEach((className) => { // if (className != "active") newLink.classList.add(className); // }); // let idText = camelize(`${firstLevelLinkElem.textContent}LiId`); // newLink.href = firstLevelLinkElem.href; // newLink.text = newLinkText; // firstLevelLinkElem.parentElement.id = idText; // firstLevelLinkElem.removeAttribute("href"); // newLinkParent.appendChild(newLink); // firstLinkParentContainer.prepend(newLinkParent); // }; // const camelize = (str) => { // return str // .replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) { // return index === 0 ? word.toLowerCase() : word.toUpperCase(); // }) // .replace(/\s+/g, ""); // }; // api.executeScript("#navWrapper ", (navWarp) => { // const theMenuDriver = () => { // let domElement = document.querySelector("#navbarContent"); // let theSubMenuUl = domElement.querySelectorAll(".dropdown-menu>ul"); //about and reports // let theMainUl = domElement.firstElementChild; // let firstLevelLinksWithoutSearch = document.querySelectorAll( // "ul.navbar-nav>li.nav-item:not([class *='border-bottom'])>a" // ); // let firstLevelLinksHasSubMenuWithoutSearch = [ // ...firstLevelLinksWithoutSearch, // ].slice(0, -1); // let firstLevelLinks = domElement.querySelectorAll( // "ul.navbar-nav>li.nav-item:not([class *='border-bottom'])>a, .searchbox-icon" // ); // let listLikeSubMenuesTriggers = [ // ...firstLevelLinksHasSubMenuWithoutSearch, // ]; // listLikeSubMenuesTriggers.splice(2, 1); // firstLevelLinksHasSubMenuWithoutSearch.forEach((link, idx) => { // addFirstLevelLink2SubMenu(link); // link.setAttribute("data-bs-toggle", "dropdown"); //bootstrap problem // }); // let listLikeSecondLevelLinks = [ // ...domElement.querySelectorAll(".text-decoration-none"), // ].filter((e) => { // return e.closest("#reportsLiId") == null; // }); // //aria stuff // theMainUl.setAttribute("role", "menubar"); // domElement.querySelectorAll("ul>li").forEach((li, idx) => { // if (li.getAttribute("role") != "presentation") // li.setAttribute("role", "presentation"); // }); // listLikeSubMenuesTriggers.forEach((trigger) => { // trigger.nextElementSibling // .querySelectorAll("ul") // .forEach((ul) => { // if (ul.getAttribute("role") != "menu") // ul.setAttribute("role", "menu"); // }); // }); // firstLevelLinks.forEach((link, idx) => { // let nextDiv = link.nextElementSibling; // link.setAttribute("role", "menuitem"); // if (idx == 0) { // link.setAttribute("tabindex", "0"); // link.addEventListener("focus", () => { // currentIndex = 0; // }); // } else { // link.setAttribute("tabindex", "-1"); // } // if ( // idx !== firstLevelLinks.length - 1 || // idx !== firstLevelLinks.length - 2 // ) { // link.setAttribute("aria-haspopup", "menu"); // } // //tooltip part // // if (!nextDiv.getAttribute("data-toggle")) { // // nextDiv.setAttribute("tabindex", 0); // // nextDiv.setAttribute("data-toggle", "tooltip"); // // let toolTipStr = api.getLocalization("submenuNavigation"); // // nextDiv.setAttribute("title", toolTipStr); // // nextDiv.setAttribute("aria-label", toolTipStr); // // nextDiv.setAttribute("data-placement", "top"); // // } // // let tooltipElem = link.parentElement.querySelector( // // 'div.dropdown-menu[data-toggle="tooltip"]' // // ); // // let toolTipHandle = new bootstrap.Tooltip(tooltipElem); // link.addEventListener("keydown", (e) => { // // console.log("Bigidiboom"); // let key = e.keyCode || e.which; // let _preventDefault = false; // let mySubMenu = // nextDiv != null ? nextDiv.querySelector("ul") : null; // switch (key) { // case NAV_KEYS.space: // case NAV_KEYS.down: // case NAV_KEYS.ent: // // console.log( // // "DEBUG (SD):inside main menu keydown-> down || space presses" // // ); // subIndex = 0; // if (currentIndex !== firstLevelLinks.length - 2) { // // link have submenu // clickButNotOpen(e.target); // hideOrShowSubMenu(false, nextDiv); // if (currentIndex !== firstLevelLinks.length - 1) // goToSubIndex(0, mySubMenu); // _preventDefault = true; // // goToSubIndex(0,) // need to work on submenu // } else { // // $(this).clone()[0].click(); // // this.click(); // // _preventDefault = true; // } // break; // case NAV_KEYS.up: // if ( // currentIndex !== firstLevelLinks.length - 1 || // currentIndex !== firstLevelLinks.length - 2 // ) { // // link have submenu // //open submenu and go to last item // clickButNotOpen(e.target); // hideOrShowSubMenu(false, nextDiv); // //in report maybe problem // let subindex = // findPrevOrNextTab( // mySubMenu, // "all", // _filterConditionAll // ).length - 1; // goToSubIndex(subindex, mySubMenu); // // goToSubIndex(0,) // need to work on submenu // } // _preventDefault = true; // break; // case NAV_KEYS.right: // goToIndex(currentIndex + 1, firstLevelLinks); // _preventDefault = true; // break; // case NAV_KEYS.left: // goToIndex(currentIndex - 1, firstLevelLinks); // _preventDefault = true; // break; // case NAV_KEYS.tab: // let prevOrNextTab = e.shiftKey // ? findPrevOrNextTab( // e.target, // "prev", // _filterCondition // ) // : findPrevOrNextTab( // e.target, // "next", // _filterCondition // ); // prevOrNextTab.focus(); // _preventDefault = true; // break; // default: // break; // } // if (_preventDefault) { // e.preventDefault(); // e.stopPropagation(); // e.stopImmediatePropagation(); // } // }); // link.addEventListener("focus", () => { // subIndex = 0; // link.setAttribute("aria-expanded", "false"); // if (window.getComputedStyle(nextDiv).display == "block") { // hideOrShowSubMenu(true, nextDiv); // } // }); // link.addEventListener("focusin", () => { // link.style.setProperty( // "outline", // "Aqua solid 3px ", // "important" // ); // }); // link.addEventListener("focusout", () => { // link.style.setProperty("outline", "", "important"); // }); // }); // listLikeSecondLevelLinks.forEach((secondLevelLink, idx) => { // secondLevelLink.addEventListener("keydown", (e) => { // let key = e.keyCode; // let _preventDefault = false; // let _stopImmediatePropagation = false; // // console.log( // // "%c[DEBUG 🐞 (SD)]: %cinside main menu Second Level Link keydown", // // "color:red;", // // "color:black;" // // ); // let firstLevelLi = secondLevelLink.closest('li[id*="Id"]'); // let myFirstLevelLink = firstLevelLi.firstElementChild; // let myDiv = myFirstLevelLink.nextElementSibling; // switch (key) { // // case NAV_KEYS.tab: // // // console.log("In submenu keydown tab"); // // let prevOrNextTab = e.shiftKey // // ? findPrevOrNextTab( // // e.target, // // "prev", // // _filterCondition // // ) // // : findPrevOrNextTab( // // e.target, // // "next", // // _filterCondition // // ); // // if ( // // myFirstLevelLink.getAttribute( // // "aria-expanded" // // ) == "true" // // ) // // myFirstLevelLink.setAttribute( // // "aria-expanded", // // "false" // // ); // // hideOrShowSubMenu(true, myDiv); // // // options.api.focus($(prevOrNextTab)); // // prevOrNextTab.focus(); // // _preventDefault = true; // // _stopImmediatePropagation = true; // // break; // case NAV_KEYS.right: // // Closes submenu. Moves focus to next item in the menubar. // goToIndex(currentIndex + 1, firstLevelLinks); // hideOrShowSubMenu(true, myDiv); // _preventDefault = true; // break; // case NAV_KEYS.left: // // Closes submenu and moves focus to parent menu item. moves focus to previous item in the menubar. // goToIndex(currentIndex - 1, firstLevelLinks); // hideOrShowSubMenu(true, myDiv); // _preventDefault = true; // break; // case NAV_KEYS.esc: // // Closes submenu.Moves focus to parent menubar item. // goToIndex(currentIndex, firstLevelLinks); // hideOrShowSubMenu(true, myDiv); // _preventDefault = true; // break; // case NAV_KEYS.tab: // case NAV_KEYS.up: // case NAV_KEYS.down: // if (key == NAV_KEYS.up || e.shiftKey) { // //left or shiftTab // // Moves focus to the previous item in the submenu If focus is on the first item, moves focus to the last item. // //check if good // goToSubIndex(subIndex - 1, myDiv); // } else { // //right or tab // // Moves focus to the next item in the submenu If focus is on the last item, moves focus to the first item. // goToSubIndex(subIndex + 1, myDiv); // } // _preventDefault = true; // break; // case NAV_KEYS.ent: // secondLevelLink.click(); // break; // case NAV_KEYS.space: // // Activates menu item, causing the link to be activated // // $(this).click(0 //???) // _preventDefault = true; // break; // } // if (_preventDefault) { // e.preventDefault(); // e.stopPropagation(); // e.stopImmediatePropagation(); // } // }); // secondLevelLink.addEventListener("focusout", (e) => { // let myDiv = secondLevelLink.closest(".dropdown-menu"); // let myTrigger = myDiv.previousElementSibling; // setTimeout(() => { // let isVisibile = // window.getComputedStyle(myDiv).display == "block" // ? true // : false; // let isExpanded = // myTrigger.getAttribute("aria-expanded") == "true" // ? true // : false; // if (!isVisibile && isExpanded) { // // console.log("need to change"); // myTrigger.setAttribute("aria-expanded", "false"); // let isChanged = // myTrigger.getAttribute("aria-expanded") == // "false" // ? true // : false; // // console.log("changed? " + isChanged); // } // }, 500); // }); // if (secondLevelLink.getAttribute("role") != "menuitem") // secondLevelLink.setAttribute("role", "menuitem"); // }); // }; // theMenuDriver(); // }); }; handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { let testSelector = '[aria-label="A tabular representation of the data in the chart."] table' // // URL = https://comptroller.nyc.gov/newsroom/new-york-by-the-numbers-monthly-economic-and-fiscal-outlook-no-60-december-6th-2021/ api.executeScript(testSelector, (table) => { // console.log("inside executeScript") // console.log(table) }) let chartTablesList = document.querySelectorAll(testSelector) if (chartTablesList.length > 0) { // console.log("after document.querySelectorAll") // console.log(chartTablesList) chartTablesList.forEach((chartTable) => { let myBigDady = chartTable.closest(".card:not(.card-body)") let myHeading = myBigDady.querySelector("h4") || myBigDady.previousElementSibling let myNewStr = `Table description: ${myHeading.textContent}` chartTable.setAttribute("aria-label", myNewStr) }) } } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.description.manual( 'div.border-bottom.py-4 > p > a', 'RB-readTheRestOfThisResult' ) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ () => { //place your language detection script here // console.log("Loaded! For ravid: Scanner scanner = new Scanner()") return document.getElementsByTagName("html")[0].getAttribute("lang") } } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ //adding decription to page buttons api.description.expression( 'div.facetwp-pager a', page => { let str = page.innerText; if(isNaN(str)){ if(str === '>>') return 'next page' else if(str === '<<') return 'previous page' else if(str === '…') return 'show more pages' } return `page number ${str}` } ) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.executeScript( 'div.border-bottom.py-4', el => { let imgLink = el.querySelector('img'); // if ( imgLink ) { // imgLink.parentElement.setAttribute('aria-hidden', 'true'); // }; let h3Title = el.querySelector('h3'); h3Title.querySelector('a')['title'] = ""; // h3Title.querySelector('a').setAttribute('aria-hidden', 'false'); }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.executeScript('div.sidebarPanel:has(img[title^="Shareowner"])', (el)=>{ const spanEl = el.querySelector("span"); if ( spanEl ) { //move image up in heirarchy to avoid being clickable const img = el.querySelector("img") el.insertBefore(img, el.children[1]) //make span clickable spanEl.removeAttribute('class') img.setAttribute('alt', spanEl.innerText) } }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { api.datepicker({ container: '.fdate-wrap.opened', trigger: 'input.facetwp-date-min', month: { prevButton: '.fdate-nav-prev', nextButton: '.fdate-nav-next', text: { selector: '.fdate-nav-label', isClickable: true } }, year: { text: { selector: '.fdate-nav-label', isClickable: true } }, calendar: { table: '.fdate-grid.grid-day', selectedDay: '.fdate-day.inner.selected', activeDays: '.fdate-day.inner', }, }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { // api.setVisibility.manual('.facetwp-alpha.available,.facetwp-facet.facetwp-facet-lgbtqalpha.facetwp-type-alpha', true) // // console.log("try") // api.executeScript('.facetwp-facet.facetwp-facet-lgbtqalpha.facetwp-type-alpha', alphaParent => { // // console.log("try") // alphaParent.setAttribute("role", 'menu') // alphaParent.setAttribute("aria-label", "Filter results by Letter, navigate with Tab to available letters") // let newDiv = document.createElement("a"); // newDiv.setAttribute("aria-hidden", "false") // newDiv.setAttribute("tabindex", "0") // newDiv.setAttribute("role", "presentation") // newDiv.setAttribute("aria-label", "Filter results by Letter, navigate with Tab to available letters") // alphaParent.before(newDiv) // }) // api.executeScript('.facetwp-alpha.available', (alpha) => { // let lableStr = `Available alphabetical Filter letter ${alpha.getAttribute('data-id')} link` // alpha.setAttribute("tabindex", "0") // alpha.setAttribute("role", "menuitem") // alpha.setAttribute("aria-label", lableStr) // // alpha.setAttribute("role", 'listitem') // // alpha.setAttribute("aria-hidden", 'false') // // alpha.addEventListener('click', (e) => { // // // alpha.parentElement.click() // // }) // alpha.addEventListener('keydown', (e) => { // let key = e.key || e.keyCode // // console.log(`[DEBUG (sd)]: in alphabetical Filter keydown. \nkey = ${key} `) // if (key == 'Enter') // alpha.click() // if (key == 'ArrowDown') { // e.preventDefault() // // console.log("[DEBUG (sd)]: what?!?!1") // } // }) // /**Currently not working for screen reader */ // }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { // api.tabs({ // tabListSelector: "ul#myTab.nav.nav-tabs.justify-content-center.h5", // tabSelectors: ["#Recent-tab", "#Annual-tab"], // tabPanelSelectors: ["#Recent", "#Annual-tab"], // }); // const NAV_KEYS = { // up: 38, // down: 40, // left: 37, // right: 39, // esc: 27, // tab: 9, // space: 32, // ent: 13, // end: 35, // home: 36, // }; // const findPrevOrNextTab = (elem, prevOrnext, filterCondition) => { // let _tabbable = [...document.querySelectorAll("*")].filter((el) => { // return ( // (window.getComputedStyle(el).display !== "none" && // (el.nodeName == "TEXTAREA" || // el.nodeName == "BUTTON" || // el.nodeName == "AREA" || // el.nodeName == "OBJECT" || // (el.nodeName == "A" && // el.getAttribute("href") && // el.getAttribute("href") !== undefined) || // (el.nodeName == "INPUT" && // el.getAttribute("type") && // el.getAttribute("type") !== "hidden"))) || // parseInt(el.getAttribute("tabindex")) > -1 // ); // }); // let _tabbableArr = [..._tabbable]; // let _myIndex = _tabbableArr.indexOf(elem); // if (prevOrnext == "next") { // let nextOptions = _tabbableArr // .slice(_myIndex + 1) // .filter(filterCondition); // let nextTab = nextOptions[0]; // // console.log("nextTab: "); // // console.log(nextTab); // return nextTab; // } // if (prevOrnext == "prev") { // let prevOptions = _tabbableArr // .slice(0, _myIndex) // .filter(filterCondition); // let prevTab = prevOptions[prevOptions.length - 1]; // // console.log("prevTab: "); // // console.log(prevTab); // return prevTab; // } else { // //all // let allOptions = _tabbableArr.filter( // filterCondition.bind(this, elem) // ); // // console.log("allOptions: "); // // console.log(allOptions); // return allOptions; // } // }; // let _filterConditionAll = (el, elem) => { // // use it inside goToSubIndex // if (el.closest("#reportsLiId") != null) { // return el.closest("#reportsLiId") == elem.closest("#reportsLiId"); // } // }; // const hideOrShowSubMenu = ( // hide = true, // subMenuElement, // toolTipHandle = null // ) => { // let myTrigger = subMenuElement.previousElementSibling; // if (hide) { // if (toolTipHandle) toolTipHandle.hide(); // subMenuElement.style.display = "none"; // myTrigger.classList.remove("show"); //boostrap problem // subMenuElement.classList.remove("show"); //boostrap problem // myTrigger.parentElement.classList.remove("open"); // } // if (!hide) { // if (toolTipHandle) toolTipHandle.show(); // subMenuElement.style.display = "block"; // myTrigger.classList.add("show"); //boostrap problem // subMenuElement.classList.add("show"); //boostrap problem // myTrigger.parentElement.classList.add("open"); //boostrap problem // } // }; // api.executeScript("#reportsLiId", (reportsLi) => { // let reportsDiv = reportsLi.querySelector(".dropdown-menu"); // let myTrigger = reportsLi.querySelector("#reportsDropdown"); // let tabsUl = reportsDiv.querySelector( // "ul#myTab.nav.nav-tabs.justify-content-center.h5" // ); // let allTabbableInReports = findPrevOrNextTab( // reportsDiv.querySelector("a"), // "all", // _filterConditionAll // ); // //handle tooltip // reportsDiv.setAttribute("tabindex", 0); // reportsDiv.setAttribute("data-toggle", "tooltip"); // let toolTipStr = api.getLocalization("tabPanelGuide"); // reportsDiv.setAttribute("title", toolTipStr); // reportsDiv.setAttribute("aria-label", toolTipStr); // tabsUl.setAttribute("aria-label", toolTipStr); // let reportsDivTooltipElem = reportsLi.querySelector( // 'div.dropdown-menu[data-toggle="tooltip"]' // ); // reportsDiv.setAttribute("data-placement", "top"); // // console.log("here comes the bootstrap"); // let toolTipHandle = new bootstrap.Tooltip(reportsDivTooltipElem); // allTabbableInReports.forEach((el, idx) => { // el.addEventListener("keydown", (e) => { // let key = e.keyCode || e.which; // let _preventDefault = false; // switch (key) { // case NAV_KEYS.esc: // hideOrShowSubMenu(true, reportsDiv, toolTipHandle); // myTrigger.focus(); // break; // case NAV_KEYS.tab: // case NAV_KEYS.down: // if ( // el.parentElement.tagName == "LI" && // el.closest("ul").id != "myTab" && // el.parentElement.nextElementSibling == null // ) { // // console.log( // // "%c[DEBUG 🐞 (SD)]: %cinside reports menu %c> last link in tabContent %c>tab pressed: ", // // "color:red;", // // "color:black;", // // "color:blue;", // // "color:green;" // // ); // let myTabBtn = el // .closest(".tab-content") // .previousElementSibling.querySelector( // ".active" // ); // // console.log("\t my Button is: " + myTabBtn.id); // myTabBtn.focus(); // e.preventDefault(); // } else if (key !== NAV_KEYS.down) { // //currently empty // } // break; // default: // break; // } // }); // el.addEventListener("focusout", (e) => { // setTimeout(() => { // let isVisibile = // window.getComputedStyle(reportsDiv).display == "block" // ? true // : false; // let isExpanded = // myTrigger.getAttribute("aria-expanded") == "true" // ? true // : false; // if (!isVisibile && isExpanded) { // // console.log("need to change"); // myTrigger.setAttribute("aria-expanded", "false"); // let isChanged = // myTrigger.getAttribute("aria-expanded") == "false" // ? true // : false; // // console.log("changed? " + isChanged); // } // }, 500); // e.stopPropagation(); // }); // // el.addEventListener("focus", (e) => { // // reportsDiv.style.setProperty( // // "outline", // // " ", // // "important" // // ); // // e.stopPropagation() // // }) // }); // }); }; handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ // let pages = document.querySelectorAll('ul.pagination > li'); // pages.forEach(page => { // let text = page.innerText; // page. // }) api.description.expression( 'ul.pagination > li', page => { let txt = page.innerText; if ( isNaN(txt) ) { return txt + ' page'; } else { if ( page.classList.contains['disabled'] ) { page.querySelector('a)').setAttribute('aria-disabled', 'true'); } return 'page number ' + txt; } } ) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { const NAV_KEYS = { up: 38, down: 40, left: 37, right: 39, esc: 27, tab: 9, space: 32, ent: 13, end: 35, home: 36, }; const toggleAriaAttribute = (element, name) => { if (element.hasAttribute(name)) { element.removeAttribute(name); return false; } element.setAttribute(name, "true"); return true; }; //#region aria and roles api.executeScript('div.flag-dropdown', (dropdownWrapper) => { let divAsButton = dropdownWrapper.querySelector('div.selected-flag') let ulAsListbox = dropdownWrapper.querySelector('ul.country-list') let liAsOption = ulAsListbox.querySelectorAll('li.country') // let highleted //#region aria and roles divAsButton.setAttribute("aria-hasapopup", "listbox") divAsButton.setAttribute("aria-label", "Choose country prefix") divAsButton.setAttribute("tabindex", "0") divAsButton.setAttribute("role", "button") ulAsListbox.setAttribute("aria-label", "Choose country prefix") ulAsListbox.setAttribute("tabindex", "-1") ulAsListbox.setAttribute("role", "listbox") liAsOption.forEach((li, idx) => { li.setAttribute("role", "option") li.setAttribute("tabindex", "0") let idStr = li.querySelector(" .country-name") .textContent .split('(')[0] .trim() .split(' ') idStr[0] = idStr[0].toLowerCase() if (li.getAttribute("id") == null) li.setAttribute("id", idStr.join('') + "OptId") li.addEventListener("keydown", (e) => { let key = e.keyCode; switch (key) { case NAV_KEYS.down: case NAV_KEYS.up: setTimeout(() => { let highlightedLi = ulAsListbox.querySelector('li.country.highlight') highlightedLi.focus() }, 100) break case NAV_KEYS.ent: if (!document.querySelector('li.country[aria-selected]')) { // console.log("nothing selected") } else { toggleAriaAttribute(ulAsListbox.querySelector('li.country[aria-selected]'), 'aria-selected') // console.log("selected") } // toggleAriaAttribute(ulAsListbox.querySelector('li.country.active'), 'aria-selected') toggleAriaAttribute(li, 'aria-selected') // toggleAriaAttribute(divAsButton,'aria-expanded') setTimeout(() => { if (window.getComputedStyle(ulAsListbox).display !== 'block') { divAsButton.removeAttribute('aria-expanded') } }, 200) break case NAV_KEYS.esc: setTimeout(() => { if (window.getComputedStyle(ulAsListbox).display !== 'block') { divAsButton.removeAttribute('aria-expanded') } }, 200) break default: break } }) }) // ulAsListbox.setAttribute() //#endregion //#region Functionality divAsButton.addEventListener('click', (e) => { let _activedescendantLi = ulAsListbox.querySelector('li.country.active') ulAsListbox.setAttribute("aria-activedescendant", _activedescendantLi.id) if (window.getComputedStyle(ulAsListbox).display == 'block') { setTimeout(() => { _activedescendantLi.focus() }, 500) } else { divAsButton.removeAttribute('aria-expanded') } }) divAsButton.addEventListener('keydown', (e) => { // e.preventDefault() let key = e.keyCode; if (key == NAV_KEYS.ent || key == NAV_KEYS.space) { divAsButton.click() if (window.getComputedStyle(ulAsListbox).display == 'block') { divAsButton.setAttribute('aria-expanded', 'true') } } e.stopPropagation() }) divAsButton.addEventListener('focusout', (e) => { setTimeout(() => { if (window.getComputedStyle(ulAsListbox).display !== 'block') { divAsButton.removeAttribute('aria-expanded') } }, 500) }) //#endregion }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { // const temp = document.getElementById("dateFilter") // const input = temp.getElementsByClassName("facetwp-date facetwp-date-min ready fdate-input") // console.log("date") // api.datepicker({ // container: ".fdate-wrap", // trigger: "#dateFilter input.facetwp-date.facetwp-date-min.ready.fdate-input", // month: { // prevButton: '.fdate-nav-prev', // nextButton: '.fdate-nav-next', // text: { // selector: '.fdate-nav-label', // isClickable: true // } // }, // year: { // text: { // selector: '.fdate-nav-label', // isClickable: true // } // }, // calendar: { // table: '.fdate-grid.grid-day', // selectedDay: '.fdate-day.inner.selected', // activeDays: '.fdate-day.inner', // disabledDays: '.fdate-day' // }, // }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.description.expression( 'div.pagination.mt-4 > a.page-numbers', pageNumber => { let description = pageNumber.innerText; if ( !isNaN(description) ) { description = `page number ${description}` } return description; } ) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ //add description to classes table (couldn't use described by) api.executeScript("table#classes", (element)=>{ element.setAttribute('aria-label', 'Past Classes Materials') }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { const NAV_KEYS = { up: 38, down: 40, left: 37, right: 39, esc: 27, tab: 9, space: 32, ent: 13, end: 35, home: 36, }; let _filterCondition = (el) => { if (el.closest(".breadcrumbs") != null) { return ( el.closest("#navbarContent") == null && (parseInt(el.getAttribute("tabindex")) > -1 || el.getAttribute("tabindex") == null) && getComputedStyle(el.closest(".breadcrumbs")).display != "none" ); } return ( el.closest("#navbarContent") == null && (parseInt(el.getAttribute("tabindex")) > -1 || el.getAttribute("tabindex") == null) ); }; const findPrevOrNextTab = (elem, prevOrnext, filterCondition) => { let _tabbable = [...document.querySelectorAll("*")].filter((el) => { return ( (window.getComputedStyle(el).display !== "none" && (el.nodeName == "TEXTAREA" || el.nodeName == "BUTTON" || el.nodeName == "AREA" || el.nodeName == "OBJECT" || (el.nodeName == "A" && el.getAttribute("href") && el.getAttribute("href") !== undefined) || (el.nodeName == "INPUT" && el.getAttribute("type") && el.getAttribute("type") !== "hidden"))) || parseInt(el.getAttribute("tabindex")) > -1 ); }); let _tabbableArr = [..._tabbable]; let _myIndex = _tabbableArr.indexOf(elem); if (prevOrnext == "next") { let nextOptions = _tabbableArr .slice(_myIndex + 1) .filter(filterCondition); let nextTab = nextOptions[0]; // console.log("nextTab: "); // console.log(nextTab); return nextTab; } if (prevOrnext == "prev") { let prevOptions = _tabbableArr .slice(0, _myIndex) .filter(filterCondition); let prevTab = prevOptions[prevOptions.length - 1]; // console.log("prevTab: "); // console.log(prevTab); return prevTab; } else { //all let allOptions = _tabbableArr.filter( filterCondition.bind(this, elem) ); // console.log("allOptions: "); // console.log(allOptions); return allOptions; } }; const clickButNotOpen = (link) => { // console.log("inside clickButNotOpen"); if ( link.getAttribute("aria-expanded") == "false" || link.getAttribute("aria-expanded") == null ) { link.setAttribute("aria-expanded", "true"); } else { link.setAttribute("aria-expanded", "false"); } return true; }; const hideOrShowSubMenu = (hide = true, searchFormDiv) => { let myTrigger = searchFormDiv.previousElementSibling; let searchOpenBtn = document.querySelector(".searchbox-icon"); searchOpenBtn.click(); if (hide) { // // if (toolTipHandle) toolTipHandle.hide(); searchFormDiv.style.display = "none"; myTrigger.classList.remove("show"); //bootstrap problem searchFormDiv.classList.remove("show"); //bootstrap problem myTrigger.parentElement.classList.remove("open"); } if (!hide) { // // if (toolTipHandle) toolTipHandle.show(); searchFormDiv.style.display = "block"; myTrigger.classList.add("show"); //bootstrap problem searchFormDiv.classList.add("show"); //bootstrap problem myTrigger.parentElement.classList.add("open"); //bootstrap problem } }; api.executeScript(".searchbox-icon", (searchFirstLevelLink) => { let nextDiv = searchFirstLevelLink.nextElementSibling; searchFirstLevelLink.setAttribute("role", "menuitem"); searchFirstLevelLink.setAttribute("tabindex", "0"); searchFirstLevelLink.addEventListener("keydown", (e) => { // console.log("Bigidiboom"); let key = e.keyCode || e.which; let _preventDefault = false; switch (key) { case NAV_KEYS.space: case NAV_KEYS.down: case NAV_KEYS.ent: // console.log( // "DEBUG (SD):inside main menu keydown-> down || space presses" // ); clickButNotOpen(e.target); hideOrShowSubMenu(false, nextDiv); _preventDefault = true; break; case NAV_KEYS.tab: let prevOrNextTab = e.shiftKey ? searchFirstLevelLink.parentElement .previousElementSibling.firstElementChild : findPrevOrNextTab(e.target, "next", _filterCondition); prevOrNextTab.focus(); _preventDefault = true; break; default: break; } if (_preventDefault) { e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); } }); searchFirstLevelLink.addEventListener("focus", () => { searchFirstLevelLink.setAttribute("aria-expanded", "false"); if (window.getComputedStyle(nextDiv).display == "block") { hideOrShowSubMenu(true, nextDiv); } }); searchFirstLevelLink.addEventListener("focusin", () => { searchFirstLevelLink.style.setProperty( "outline", "Aqua solid 3px ", "important" ); }); searchFirstLevelLink.addEventListener("focusout", () => { searchFirstLevelLink.style.setProperty("outline", "", "important"); }); }); //fix the focus from out of search document.getElementById("search").addEventListener("focus", (e) => { let fromFocus = e.relatedTarget; let searchBtn = document.querySelector(".searchbox-icon"); if (!fromFocus.closest("#searchLi")) { // console.log("moving focus"); searchBtn.focus(); } }); }; handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { api.executeScript('li *:not(ul)', (clickable) => { // clickable.style.border = ("3px solid Aqua") clickable.addEventListener("focusin", (e) => { // console.log("in focus") // console.log(clickable.parentElement) clickable.style.setProperty("outline","3px solid Aqua","important") }) clickable.addEventListener("focusout", (e) => { // console.log("in focusout") // console.log(clickable) clickable.style.setProperty("outline","","important") }) }) } handler(window.u1st.evaluate('#miniNav ')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { //adding role to links in order to make them clickable api.button({ selectors: { element: "div.facetwp-pager a:not(div.facetwp-pager a.active)", } }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ let identifier = document.getElementById('post-81080'); if ( identifier ) { // console.log('This script (RB-emptyCells.js) may cause \n bugs in tables') api.executeScript( 'table > tbody > tr > td:nth-child(1)', dateCell => { if ( dateCell && dateCell.innerText === "" && dateCell.innerHTML.trim() === "" ) { dateCell.setAttribute('aria-label', 'Empty cell'); } } ) } } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ let aux = document.querySelectorAll('h2'); let chosen; aux.forEach(header => { if ( header.innerText === "Municipal Advisor Disclosures") { chosen = header; } }) if ( chosen ) { let ancestor = chosen.parentElement if ( ancestor ) { let uncle = ancestor.nextElementSibling; uncle.setAttribute('role', 'list'); let cards = uncle.querySelectorAll('div.col.col-md-4'); cards.forEach(card => { card.setAttribute('role', 'listitem') }) } } } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.description.expression( 'a[href^="tel:"]', phoneLink => { return "telephone number " + phoneLink.innerText; } ); api.description.expression( 'a[href^="mailto:"]', emailLink => { return "email address " + emailLink.innerText; } ); api.description.expression( 'a[class="externalLink"]', externalLink => { return externalLink.innerText + ' external link'; } ); api.description.expression ( 'a[href^="#"]:not([href="#"])', insidePageLink => { return insidePageLink.innerText + ': inside-page link'; } ) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ let labels = document.querySelectorAll('div.topTableSort > div > label'); if (labels && labels.length > 0 && labels[0].parentElement.id === 'fiduciaryFunds_length' ) { labels[0].firstElementChild['id'] = 'number_of_results'; labels[0].setAttribute('for', labels[0].firstElementChild['id']); labels[1].setAttribute('for', labels[1].firstElementChild['id']); labels[2].firstElementChild['id'] = 'search_key_word'; labels[2].setAttribute('for', labels[2].firstElementChild['id']); } } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.dialog({ type: 'modal', selectors: { dialog: 'div.modal-content', trigger: 'a[class="externalLink"][rel="noopener"]', closeBtn: 'button[type="button"]', // heading: '.modal-title', textContent: '.modal-body' } }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { api.executeScript('.interactiveChart svg', (visibleChart) => { // console.log(visibleChart) // let hiddenTD = document.querySelectorAll(".entry_content td[aria-hidden]") // hiddenTD.forEach((td) => { // // td.setAttribute('aria-hidden', "false") // td.setAttribute('u1st-avoid-auto--hidden', 'true') // }) visibleChart.setAttribute('aria-hidden', "true") // visibleChart.style.visibility = "hidden" let myNextTable = visibleChart.nextElementSibling if (myNextTable != null) { // console.log(myNextTable) myNextTable.setAttribute('aria-hidden', "false") } }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ // MODAL FOR 'SIGN-UP' BTNS ON BONDS\NEWS PAGE api.dialog({ type: 'modal', selectors: { dialog: 'div.modal-content', trigger: 'div.newsCards > div.newsCards > button, div.directiveTitle > p > a[href="#"]', closeBtn: 'div.card-header > nul.nav + button, button[type="button"].btn-close', heading: 'h2, .modal-title', textContent: 'h2 *, div.modal-body' } }); } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.executeScript(".sidebarPanel a:contains('Learn More ')",(readMoreLink)=>{ // console.log(readMoreLink) // console.log(readMoreLink) let myHeading = readMoreLink.closest(".sidebarPanel").firstElementChild.textContent // console.log(myHeading) let myNewStr = `${readMoreLink.textContent} about ${myHeading} ` readMoreLink.setAttribute("aria-label",myNewStr) }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.executeScript('li>button,li>a, li>select', (clickable) => { // clickable.style.border = ("3px solid Aqua") clickable.addEventListener("focusin", (e) => { // console.log("in focus") // console.log(clickable.parentElement) clickable.style.border = ("3px solid Aqua") }) clickable.addEventListener("focusout", (e) => { // console.log("in focusout") // console.log(clickable) clickable.style.border = ("") }) }) } handler(window.u1st.evaluate('#legalLine')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.executeScript("#list_ppl a,#list_info a.btn.btn-outline-secondary.my-2",(btn)=>{ btn.setAttribute("tabindex","0") btn.querySelector("img").setAttribute("role","presentation") }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.executeScript( 'a', anchor => { if ( anchor.href.endsWith('.pdf') ) { if ( anchor.innerText ) { if ( anchor.innerHTML.includes(' { // linksWrapper.querySelector('li.nav-item.active a').setAttribute('aria-current', 'page') // }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { api.form({ selectors: { form: '.vfbp-form', invalidField: '.vfbp-form .vfb-has-error input, .vfbp-form .vfb-has-error select', errorMessageAbsolute: '.vfbp-form .vfb-has-error > div > label', formLabelAbsolute: 'h1.bottom_divider.mb-5', requiredField: '.vfbp-form input[required = "required"]' } }) // RB: A VALIDATION ADDITION FOR reCAPTCHA FIELD api.executeScript( 'div#vfb-recaptcha-error > span', reCAPTCHA => { reCAPTCHA.setAttribute('role', 'alert'); } ) // RB: ADDING "required" TO FIELDS' LABELS api.executeScript( 'label:has(.vfb-required-asterisk)', label => { let labelTXT = label.innerText; label.innerHTML = labelTXT + ' (required)'; } ) api.executeScript('.vfbp-form', (form) => { let greenCircle = String.fromCodePoint(0x1F7E2) // console.log(greenCircle + "%cNOTE (SD): %cIf you see that message, that's mean you have form with class '.vfbp-form'. \n" + // "This form is already mapped by me\n**Seen it, thanks!** IO \n", "color:green;", "color:white;") }) //Itai edit - fixing address field is not announced in screen reader api.executeScript('.vfbp-form .vfb-fieldType-address', (field) => { const inputField = field.querySelector("input") inputField.setAttribute('id', 'vfb-field-2393') field.firstChild.insertBefore(inputField, field.firstElementChild.children[1]) }) api.executeScript('.vfb-fieldType-file-upload',(fileUploadDiv)=>{ //SD : Adding highlighter to browse file button let browseFilesBtns = fileUploadDiv.querySelectorAll(' .vfb-file-input') if (browseFilesBtns.length > 0) { // console.log("%c[DEBUG (SD)]: %c inside browse buttons", "color:red;", "color:black;") browseFilesBtns.forEach((btn) => { // console.log("%c[DEBUG (SD)]: %c inside browseFilesBtns.forEach. btn: ", "color:red;", "color:black;") // console.log(btn) btn.addEventListener('focus', (el) => { btn.parentElement.style.outline = "black solid 3px" }) btn.addEventListener('blur', (el) => { btn.parentElement.style.outline = "" }) }) } }) /**Problems: * * screen reader reads the 'This value is required' line for all of the invalid fields at once * * RB: SHOULD BE SOLVED. NEEDS TO BE CHECKED WITH OTHER FORMS * **/ } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.heading( 'div.bondsDisclaimer > p:first', 4 ) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { (function () { var jQueryVersion = "1"; var a = document.createElement("script"); a.src = "//ajax.googleapis.com/ajax/libs/jquery/" + jQueryVersion + "/jquery.js"; a.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(a); })() api.link({ selectors: { element: '#menu-quick-access a' } }) // console.log("after api.link") api.executeScript('#menu-quick-access>li', linkParent => { linkParent.firstElementChild.addEventListener("focusin", (e) => { // console.log("in focus") // console.log(linkParent) linkParent.style.border = ("3px solid black") }) linkParent.firstElementChild.addEventListener("focusout", (e) => { // console.log("in focusout") // console.log(linkParent) linkParent.style.border = ("") }) }) // api.executeScript('#menu-quick-access a', (link) => { // console.log("inside executeScript") // console.log(link) // link.addEventListener("focusin", (e) => { // // console.log("in focus") // console.log(link.parentElement) // link.parentElement.style.border = ("2px solid black") // }) // link.addEventListener("focusout", (e) => { // // console.log("in focusout") // console.log(link.parentElement) // link.parentElement.style.border = ("") // }) // }) } handler(window.u1st.evaluate('#homeQuickLinks')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { api.checkbox ( { selectors: { element: "div.facetwp-checkbox", checkedState: "true" } }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.tabs({ tabSelectors: [".navbar .nav-item button.nav-link:eq(0)", ".navbar .nav-item button.nav-link:eq(1)"], tabPanelSelectors: [".navbar .tab-content .tab-pane:eq(0)", ".navbar .tab-content .tab-pane:eq(1)"], tabListSelector: ".navbar .nav-tabs" }) api.menu({ selectors: { menu: '#navbarContent .navbar-nav', items: '.nav-item.dropdown > a, .navbar .nav-item.dropdown .menu-item > a, .navbar .nav-item.dropdown p > a, .navbar .nav-item.dropdown div.border-end > a, .navbar .nav-item.dropdown ul#menu-newsroom-menu a, .navbar .nav-item.dropdown div.row.g-0 > ul > li > a.text-decoration-none, .navbar .nav-item.dropdown ul.icon_list a', submenus: '.dropdown-menu', triggers: '.nav-item.dropdown > a', horizontalMenu: '#navbarContent .navbar-nav', openByFunc: (item) => { const dropdown = item.parentElement.querySelector('.dropdown-menu'); dropdown.style.display = 'block'; if(item.id === 'reportsDropdown') { setTimeout(() => { const elToFocus = dropdown.querySelector('button.nav-link'); elToFocus.setAttribute('tabindex', '0'); elToFocus.focus(); const clickables = dropdown.querySelectorAll('button, a'); clickables.forEach((el) => { el.addEventListener('keyup', (e) => { if(e.code == 'Escape') { dropdown.style.display = 'none'; item.removeAttribute('u1st-active-trigger'); setTimeout(() => item.focus(), 500); } }) }) }, 800); } }, closeByFunc: (item) => { const dropdown = item.parentElement.querySelector('.dropdown-menu'); dropdown.style.display = 'none'; }, customEvent: "keyup" } }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.dialog({ type:"modal", selectors:{ dialog: "#employmentForm .modal", closeBtn: "#employmentForm .btn-close", heading: "#employmentForm .modal-title", trigger:"table button[data-bs-toggle = 'modal']", } }) api.executeScript("#employmentForm",modal=>{ modal.addEventListener("focus",e=>{ let btn = modal.querySelector(".btn-close") btn.focus() }) }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ api.executeScript( 'div.card:has(div.card-body div[aria-label="A chart."])', divCard => { divCard.querySelector('svg').setAttribute('aria-hidden', 'true'); let dataTableBtn = divCard.querySelector('.card-footer > button.btn-primary[href]'); if ( dataTableBtn ) { let hiddenTable = divCard.querySelector('.card-body div[aria-label="A chart."] table'); hiddenTable.setAttribute('aria-hidden', 'true') } } ); // console.log('plan B') api.executeScript( 'div.card:has(svg[aria-label="A chart."])', div => { // console.log(div) let dataBTN = div.querySelector('.card-footer > button.btn-primary'); if ( dataBTN ) { dataBTN.setAttribute('disabled', 'true') div.querySelector('.card-footer > div.collapse').classList.add('show') } } ) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { const NAV_KEYS = { up: 38, down: 40, left: 37, right: 39, esc: 27, tab: 9, space: 32, ent: 13, end: 35, home: 36, }; const slideUp = (target, duration = 500) => { target.style.transitionProperty = 'height, margin, padding'; target.style.transitionDuration = duration + 'ms'; target.style.boxSizing = 'border-box'; target.style.height = target.offsetHeight + 'px'; target.offsetHeight; target.style.overflow = 'hidden'; target.style.height = 0; target.style.paddingTop = 0; target.style.paddingBottom = 0; target.style.marginTop = 0; target.style.marginBottom = 0; window.setTimeout(() => { target.style.display = 'none'; target.style.removeProperty('height'); target.style.removeProperty('padding-top'); target.style.removeProperty('padding-bottom'); target.style.removeProperty('margin-top'); target.style.removeProperty('margin-bottom'); target.style.removeProperty('overflow'); target.style.removeProperty('transition-duration'); target.style.removeProperty('transition-property'); //alert("!"); }, duration); } const slideDown = (target, duration = 500) => { target.style.removeProperty('display'); let display = window.getComputedStyle(target).display; if (display === 'none') display = 'block'; target.style.display = display; let height = target.offsetHeight; target.style.overflow = 'hidden'; target.style.height = 0; target.style.paddingTop = 0; target.style.paddingBottom = 0; target.style.marginTop = 0; target.style.marginBottom = 0; target.offsetHeight; target.style.boxSizing = 'border-box'; target.style.transitionProperty = "height, margin, padding"; target.style.transitionDuration = duration + 'ms'; target.style.height = height + 'px'; target.style.removeProperty('padding-top'); target.style.removeProperty('padding-bottom'); target.style.removeProperty('margin-top'); target.style.removeProperty('margin-bottom'); window.setTimeout(() => { target.style.removeProperty('height'); target.style.removeProperty('overflow'); target.style.removeProperty('transition-duration'); target.style.removeProperty('transition-property'); }, duration); } const slideToggle = (target, duration = 500) => { if (window.getComputedStyle(target).display === 'none') { return slideDown(target, duration); } else { return slideUp(target, duration); } } api.executeScript('#reportAccordion .card-header', (card) => { let greenCircle = String.fromCodePoint(0x1F7E2) // console.log( greenCircle+"%cNOTE (SD): %cIf you see that message, that's mean you have accordion . \n"+ // "This form is already mapped by me","color:green;","color:black;" ) let clone = card.firstElementChild.cloneNode(true) let myLink = card.firstElementChild clone.addEventListener('click', e => { slideToggle(card.nextElementSibling, 250) card.classList.toggle('collapsed') }) card.appendChild(myLink.firstElementChild) card.firstElementChild.remove() card.addEventListener('keydown', (e) => { // let _this = e.target let key = e.keyCode; if (key == NAV_KEYS.ent || key == NAV_KEYS.space) // card.firstElementChild.click() clone.click() }) card.addEventListener('focus', (e) => { // let _this = e.target // console.log("[DEBUG (SD): inside card focus]") // card.firstElementChild.setAttribute("tabindex", "-1") }) }) // api.setVisibility.manual('#reportAccordion .card-header a',false) api.executeScript('#reportAccordion .card-header a', (btn) => { // btn.setAttribute("role", "button") btn.addEventListener('focusin', (e) => { // let _this = e.target e.preventDefault() btn.setAttribute("tabindex", "-1") btn.parentElement.style.border = ("3px solid black") btn.parentElement.focus() e.stopPropagation() }) btn.addEventListener('focusout', (e) => { // let _this = e.target btn.setAttribute("tabindex", "-1") btn.parentElement.style.border = ("") }) // $('#reportAccordion .card-header a').focus(e => { // _this = e.target // $(_this).parents('.card-header').css("border", "3px solid black") // }) // $('#reportAccordion .card-header a').blur(e => { // _this = e.target // $(_this).parents('.card-header').css("border", "") // }) }) api.accordion({ selectors: { contentSelector: '#reportAccordion .card-body.panelbodyChapter', headerSelector: '#reportAccordion .card-header' }, headingLevel: 3, collapsesOthers: false }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { api.dialog({ type: 'modal', selectors: { dialog: '#newsletters', closeBtn: '#newsletters button.btn-close', trigger: '.footer button:contains("Sign Up")' }, blockNavigation: true, // onOpen: ()=>{ // let closeBtn = document.querySelector('#newsletters button.btn-close') // console.log( "%c[DEBUG 🐞 (SD)]: %cFooter signup dialog: onOpen()","color:blue;","color:black;" ) // closeBtn.focus() // } }) api.tabs({ tabListSelector: '.modal-content ul#myTab ', tabSelectors: ['.modal-content ul#myTab li>button#home-tab', '.modal-content ul#myTab li>button#profile-tab'], tabPanelSelectors: ['#comptroller_newsletter', '#investor_relations'], isVertical: false }) api.form({ selectors: { form: '#mc-embedded-subscribe-form', invalidField: '#mc-embedded-subscribe-form input[aria-required][aria-invalid ="true"]', errorMessageAbsolute: 'div.mce_inline_error', formLabelAbsolute: '#comptroller_newsletter h2', requiredField: '#mc-embedded-subscribe-form input[aria-required]' } }) api.executeScript("#home-tab",(firstTab)=>{ firstTab.addEventListener("focus",(e)=>{ // console.log("In first Tab focus") let closeBtn = document.querySelector('#newsletters button.btn-close') closeBtn.focus() // console.log("document.activeElement == closeBtn ?: ") // console.log(document.activeElement == closeBtn) },{ once:true }) }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { let _filterConditionAll = (el, elem) => { // use it inside goToSubIndex if (el.closest("#searchSuggestions") != null) { return ( el.closest("#searchSuggestions") == elem.closest("#searchSuggestions") ); } }; const findPrevOrNextTab = (elem, prevOrnext, filterCondition) => { let _tabbable = [...document.querySelectorAll("*")].filter((el) => { return ( (window.getComputedStyle(el).display !== "none" && (el.nodeName == "TEXTAREA" || el.nodeName == "BUTTON" || el.nodeName == "AREA" || el.nodeName == "OBJECT" || (el.nodeName == "A" && el.getAttribute("href") && el.getAttribute("href") !== undefined) || (el.nodeName == "INPUT" && el.getAttribute("type") && el.getAttribute("type") !== "hidden"))) || parseInt(el.getAttribute("tabindex")) > -1 ); }); let _tabbableArr = [..._tabbable]; let _myIndex = _tabbableArr.indexOf(elem); if (prevOrnext == "next") { let nextOptions = _tabbableArr .slice(_myIndex + 1) .filter(filterCondition); let nextTab = nextOptions[0]; // console.log("nextTab: "); // console.log(nextTab); return nextTab; } if (prevOrnext == "prev") { let prevOptions = _tabbableArr .slice(0, _myIndex) .filter(filterCondition); let prevTab = prevOptions[prevOptions.length - 1]; // console.log("prevTab: "); // console.log(prevTab); return prevTab; } else { //all let allOptions = _tabbableArr.filter( filterCondition.bind(this, elem) ); // console.log("allOptions: "); // console.log(allOptions); return allOptions; } }; api.executeScript("#searchLi", (searchLi) => { let spanAsButton = searchLi.querySelector(".searchbox-icon"); spanAsButton.setAttribute("role", "button"); spanAsButton.addEventListener("focus", (e) => { searchLi.style.border = "3px solid black"; }); spanAsButton.addEventListener("blur", (e) => { searchLi.style.border = ""; }); searchLi.prepend(spanAsButton); // spanAsButton.addEventListener("click") let suggestions = document.querySelector("#searchSuggestions"); let allTabbableInSearch = findPrevOrNextTab( suggestions.querySelector("a"), "all", _filterConditionAll ); let input = searchLi.querySelector("input"); allTabbableInSearch.push(input); allTabbableInSearch.forEach((el, idx) => { // if (idx === 0 || el.text === "A-M") { // el.addEventListener( // "focus", // (e) => { // input.focus(); // }, // { // once: true, // } // ); // } if ( el.closest(".sub-menu") && el.closest("ul.sub-menu").previousElementSibling.text == "N-Z" && el.parentElement.nextElementSibling == null ) { //last object el.addEventListener("keydown", (e) => { //TODO: finish keydown here if (e.keyCode == 9) { allTabbableInSearch[0].addEventListener( "focus", (e) => { input.focus(); }, { once: true, } ); input.focus(); } }); el.addEventListener("focus", (e) => { let focusSrc = e.relatedTarget; if (allTabbableInSearch.indexOf(focusSrc) == -1) { // console.log("focus from outter space!"); spanAsButton.focus(); } }); } el.addEventListener("keydown", (e) => { if (e.keyCode == 27) { spanAsButton.click(); spanAsButton.focus(); } }); }); }); }; handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { // (function () { // let firstScript = document.createElement("script"); // firstScript.src = "https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" // firstScript.integrity = "sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" // firstScript.crossOrigin = "anonymous" // let secondScript = document.createElement("script"); // secondScript.src = "https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js" // secondScript.integrity = "sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/" // secondScript.crossOrigin = "anonymous" // // console.log("Bootstrap loaded for tooltip") // let body = document.querySelector("body") // body.append(firstScript) // body.append(secondScript) // })(); } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ let indicator = document.getElementById('taxpayer-and-agency-support'); // if ( indicator ) { // api.executeScript( // 'table', // tableContainer => { // tableContainer.setAttribute('role', 'table'); // } // ); // api.executeScript( // 'table > tbody > tr', // tableRow => { // tableRow.setAttribute('role', 'row') // } // ); // api.executeScript( // 'table > thead > tr > th', // tableCellsHead => { // tableCellsHead.setAttribute('role', 'columnheader') // } // ); // api.executeScript ( // 'table > tbody > tr > td', // tableCell => { // tableCell.setAttribute('role', 'cell') // } // ); // } if ( indicator ) { api.executeScript( 'table:has(td:has(img[alt="office-seal"]))', noneTable => { noneTable.setAttribute('role', 'presentation') } ) if (indicator) { api.executeScript( 'div.table-responsive > table', table => { table.setAttribute('summary', 'contacts'); } ) } } } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { api.executeScript(".monwrapup", (container) => { let readMoreLinkS = container.querySelectorAll("p~a") readMoreLinkS.forEach((readMoreLink) => { // console.log(readMoreLink) if (readMoreLink.getAttribute("aria-label") == null) { // console.log(`readMoreLink: ${readMoreLink} is missing label`) let myHeading = readMoreLink.closest("div").previousElementSibling.textContent.trim() let myNewStr = `${readMoreLink.textContent} about ${myHeading} ` // console.log(myNewStr) readMoreLink.setAttribute("aria-label",myNewStr) } }) }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ window.u1st.landmarks({ banner: 'header', main: 'main', complementary: 'section > div > div.col-lg-3.pe-lg-5.mb-4, sidebar.col-md-2', contentinfo: '.footer', search: '.searchbox.searchbox-open, input#searchFormInput', navigation: '.collapse.navbar-collapse', region: '' }); } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { api.executeScript("div.google-visualization-table-page-numbers", () => { api.description.expression("div.google-visualization-table-page-numbers a", (num) => { return `page number ${num.innerText}` }) api.description.manual("div.goog-inline-block.goog-custom-button.goog-custom-button-collapse-left", "next", "true") api.description.manual("div.goog-inline-block.goog-custom-button.goog-custom-button-collapse-right", "prev", "true") }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function (api) { // console.log("[DEBUG SD]: hi") // let links = document.querySelectorAll('.content-block .col-lg-4>a:has(div.card)') // console.log(links) // api.executeScript('.content-block .col-lg-4>a div.card', card => { // console.log("[DEBUG SD]: hi") // card.parentElement.style.setProperty('display', 'block', 'important') // }) // api.executeScript('.content-block a~p>a', doubledLink => { // doubledLink.classList.add('second-link') // doubledLink.remove() // }) } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); } try{ var handler = function(api){ // console.log("test") } handler(window.u1st.evaluate('body')) } catch(error){ window.u1st.logger && window.u1st.logger.error(error); }