if (location.pathname == "/bus/register.aspx"){ //nmxSiteAccessibility(20, 150); /* jbackus 20220623a - disabled while troubleshooting the login/register page */ } function ScrollToMainLink(){ jQuery("[hostname='www.denamarin.com'] .skip-to-content-link").remove(); jQuery(".skip-link,.skip-link-style").remove(); jQuery("body").before(''); jQuery("head").append(''); if (!jQuery("body[main]").length){ if (jQuery("[main]").length){ jQuery("body").attr("main","[main]"); } else if (jQuery("#main").length){ jQuery("body").attr("main","#main"); } else if (jQuery("[roll='main']").length){ jQuery("body").attr("main","[roll='main']"); } else if (jQuery("div.main").length){ jQuery("body").attr("main","div.main"); } else if (jQuery("[name='about-container']").length){ jQuery("body").attr("main","div.main"); } else if (jQuery("#tdStore").length){ jQuery("body").attr("main","#tdStore"); } else { jQuery("[roll='main']").attr("main","[roll='main']"); } jQuery(jQuery("body").attr("main")).attr("role","main"); console.log("acs main: "+jQuery("body").attr("main")); } } function ScrollToMain(){ console.log("acs scroll to main"); jQuery([document.documentElement, document.body]).animate({ scrollTop: jQuery(jQuery("body").attr("main")).offset().top }, 100); } /* jb20200921a - added speak function for screen readers */ function Speak(text){ console.log("acs speak "+text); jQuery("#speakerbox").text(" "); window.setTimeout(function(){ jQuery("#speakerbox").text(text); }, 100); } AddSpeakers(); function AddSpeakers(){ if (!jQuery("#speakerbox").length){ console.log("acs created speaker box"); jQuery("body").append('
'); } //jQuery(".w-slider-arrow-left").not("[speak]").attr("speak","previous").on("click",function(){ Speak("Previous slide"); }); //jQuery(".w-slider-arrow-right").not("[speak]").attr("speak","next").on("click",function(){ Speak("Next slide"); }); //jQuery(".owl-prev").not("[speak]").attr("speak","previous").on("click",function(){ Speak("Scroll left"); }); jQuery('a[title="Add To Cart"]').not("[speak]").attr("speak","next").on("click",function(){ Speak("Added to cart"); }); window.setTimeout(function(){ AddSpeakers(); }, 1000); } function MoveToCaption(table, caption){ if (jQuery(caption).length){ jQuery(table).prepend(''+jQuery(caption).text()+''); jQuery(caption).remove(); } jQuery(table).find("tr:first:empty").remove(); } function nmxSiteAccessibility(c, i){ if (c > 0){ c--;window.setTimeout(function(){ nmxSiteAccessibility(c--, i); },i); } else { // runonce // jQuery('[type="radio"]').each(function(index){ // jQuery(this).prepend('
'); // jQuery(this).find("*:not([fieldset])").appendTo("[fsid='"+index+"']"); // }); } /* start accessibility code */ jQuery(".nextCartProdName a img").each(function(){ jQuery(this).width(jQuery(this).width()); jQuery(this).height(jQuery(this).height()); jQuery(this).unwrap(); }); jQuery("#ctl00_ctl00_cphMain_cphMain_lafAddress_tdAddressTypeRadioButtons, #ctl00_ctl00_cphMain_cphMain_eaEditAddresses_afAddress_lafAddress_rbResidential, #ctl00_ctl00_cphMain_cphMain_rptAddresses_ctl02_sbaAddress_afAddress_lafAddress_tdAddressTypeRadioButtons, #ctl00_ctl00_cphMain_cphMain_rptAddresses_ctl00_sbaAddress_afAddress_lafAddress_tdAddressTypeRadioButtons").each(function(index){ if (!jQuery(this).find("fieldset").length){ jQuery(this).prepend('
'); jQuery(this).find("*:not([fieldset])").appendTo("[fsid='"+index+"']"); } }); /* jump menus */ jQuery('[onchange]').each(function(){ jQuery(this).attr("onblur",jQuery(this).attr("onchange")).removeAttr("onchange"); }); MoveToCaption(".nextCartProducts.reLabled","#ctl00_ctl00_ctl00_cphMain_ctl00_rptShipTos_ctl00_trShipToLabel"); MoveToCaption(".nextCartProducts.reLabled","#ctl00_ctl00_cphMain_ctl00_rptShipTos_ctl00_trShipToLabel"); MoveToCaption(".nextEditAddressTable.nextEditBillToTable","#ctl00_ctl00_cphMain_cphMain_rptAddresses_ctl02_sbaAddress_hdrAddress_tblBannerHeader"); MoveToCaption(".nextEditAddressTable.nextEditShipToTable","#ctl00_ctl00_cphMain_cphMain_rptAddresses_ctl00_sbaAddress_hdrAddress_tblBannerHeader"); /* add missing legends */ jQuery("fieldset").each(function(){ if (!jQuery(this).find("legend").length){ jQuery(this).prepend('Select one:'); } }); jQuery("#lblDelete, #lblEditQuantity").remove(); jQuery(".nextShipToLabel").remove(); /* add field labels */ jQuery('input[id],select[id]').each(function(){ var tmpid = jQuery(this).attr("id"); // if (!jQuery('[for="'+tmpid.replace("_txtText","")+'"]').length){ // jQuery('#'+tmpid+'').before(''); // } if (!jQuery('[for="'+tmpid+'"]').length){ jQuery('#'+tmpid+'').before(''); } }); if (top.location.href != self.location.href){ jQuery("table").empty(); top.location.href = "https://www.vet-ez-order.com/bus/register.aspx"; return; } else if (navigator.userAgent.toLowerCase().indexOf("pope") > -1){ jQuery("noscript, a[href*='pdf']").remove(); //jQuery("a,form,img,button,:header,div").remove(); // jQuery("body").html("

Login or register

Please login
"); // document.title = "Login"; } else if (jQuery("#wave5topbar").length || jQuery("#wave_sidebar_container").length){ jQuery("noscript, a[href*='pdf']").remove(); } jQuery('.nextProductList [itemprop="image"]').parent().removeAttr("href"); /* custom */ jQuery("[src*='images/Nutramax-Laboratories-Veterinary-Sciences-Inc-.png']").attr("alt","Company logo"); /* alt tags */ jQuery("img:not([alt]), button").each(function(index){ var alt=""; jQuery(this).attr("alt", alt); if (jQuery(this).filter("[src]").length){ alt = jQuery(this).attr("src").replace(".png","").replace(".svg","").replace(".jpg","").replace(".gif","").replace(/[-_]/g," ").replace(/^.*[\\\/]/, ''); //console.log("acs alt "+alt); jQuery(this).attr("alt", alt+" "+index); } else { jQuery(this).attr("alt", "button "+index); } }); jQuery('.nextInnerWrapper').attr("role","main"); jQuery('[name="EMAIL"]').attr("id","EMAIL").closest("label").attr("for","EMAIL"); jQuery('[name="PASSWORD"]').attr("id","PASSWORD").closest("label").attr("for","PASSWORD"); jQuery(".nextLoggedIn #vetWelcome").remove(); jQuery(".nextRegister #ccPaymentMethods, .nextLogin #ccPaymentMethods").remove(); jQuery(".nextSecurityDisclaimer b:last").remove(); jQuery(".contact-text").remove(); jQuery("#vetWelcome p:contains('brief overview')").remove(); jQuery("#ctl00_ctl00_cphMain_cphMain_ptPrivacyPolicy_spnPopupPanel").remove(); jQuery(".nextRegisterHeader i").empty(); jQuery("#ctl00_ctl00_cphMain_cphMain_hdrContactInfo_spnTableText").empty(); /* fix jump menus - ! changes functionality ! */ jQuery('#ctl00_ctl00_cphMain_cphMain_lafAddress_ddlCountry[onchange], .nextShipToSelect select[onchange], .pagination select[onchange]').each(function(){ jQuery(this).attr("onblur", jQuery(this).attr("onchange")).removeAttr("onchange"); }); jQuery('[for="ctl00_ctl00_cphMain_cphMain_pwrPassword_psdMain_rtbPassword_txtRestricted"]').remove(); jQuery('[for="ctl00_ctl00_cphMain_cphMain_pwrPassword_psdRetype_rtbPassword"]').remove(); /* custom */ /* add headings */ jQuery(':header').each(function(){ var level = jQuery(this).prop("tagName").replace("H",""); if (level > 1 && jQuery(this).parents().find("H"+(level-1))){ if (!jQuery(this).prev("h"+(level-1)).length){ jQuery(this).before('h'+(level-1)+''); } } }); /* fix broken same page links */ jQuery('[href*="#"]').not('[href*="javascript"]').each(function(){ if (!jQuery('[name="'+jQuery(this).attr("href").replace("#","")+'"]').length){ var a = ''+jQuery(this).text()+''; jQuery("body").prepend(a); } }); /* empty buttons and links */ jQuery("button").each(function(){ if (jQuery(this).text().trim() == ""){ jQuery(this).append('hidden element'); } }); /* device dependant handler */ // jQuery('[onclick]').each(function(){ // jQuery(this).attr("onmousedown",jQuery(this).attr("onclick")).removeAttr("onclick"); // }); /* remove redundant titles */ jQuery("[title]").each(function(){ if (jQuery(this).text() == jQuery(this).attr("title") || jQuery(this).attr("alt") == jQuery(this).attr("title")){ jQuery(this).removeAttr("title"); } }); /* redundant links */ jQuery("a[href]").not("[acs]").each(function(index){ var that = jQuery(this); var match = "diff"; if (jQuery("[href='"+jQuery(this).attr("href")+"']").length > 1 && jQuery(this).not("[acs]")){ jQuery("[href='"+jQuery(this).attr("href")+"']").attr("acs",1).attr("aria-hidden","true").attr("role","presentation"); if ( jQuery(this).parent().prev() == that.parent() || jQuery(this).parent() == that.parent() || jQuery(this).parent() == that.parent().parent() ){ match = "same"; } console.log("acs pg dup"+index+": "+jQuery(this).attr("href")+" / "+match+" / "+that.filter(":visible").length); } }); /* fix layout table false-pos */ // var non_layout_table_selector = "table"; // jQuery(non_layout_table_selector+' tbody').append('-'); /* add missing form field labels v2 */ jQuery("input,select,textarea").not('[type="image"],[type="submit"],[type="reset"],[type="button"],[type="hidden"]').each(function(index){ if (!jQuery('[for="'+jQuery(this).attr("id")+'"]').length){ jQuery(this).attr("aria-label", jQuery(this).attr("name")); } }); /* remove orphaned labels v2 */ // jQuery("[for]").each(function(index){ // if (!jQuery("input#"+jQuery(this).attr("for")).length && !jQuery("select#"+jQuery(this).attr("for")).length){ // jQuery(this).removeAttr("for"); // } // }); /* remove orphaned labels */ // jQuery("[for]").each(function(index){ // if (!jQuery("#"+jQuery(this).attr("for")).length && jQuery(this).attr("for").trim() == jQuery(this).text().trim()){ // jQuery(this).remove(); // } // }); /* add missing form field labels */ // jQuery("input,select,textarea").not('[type="image"],[type="submit"],[type="reset"],[type="button"],[type="hidden"]').each(function(index){ // if (!jQuery(this).filter("[id]").length){ // if (jQuery(this).prev("[for]").length){ // jQuery(this).attr("id", jQuery(this).prev("[for]").attr("for")); // } else if (jQuery(this).parents().find("[for]").length){ // jQuery(this).attr("id", jQuery(this).closest("[for]").attr("for")); // } else { // jQuery(this).attr("id","fld"+index); // } // } // if (jQuery(this).filter("[id]").length){ // if (!jQuery('[for="'+jQuery(this).attr("id")+'"]').length){ // if (jQuery(this).parent().is("label") && !jQuery(this).parent().has("[for]")){ // jQuery(this).parent().attr("for",jQuery(this).attr("id")); // } else { // jQuery(this).before(''); // } // } // } // }); /* add custom */ // jQuery("tbody").each(function(){ // jQuery(this).find(".acs").remove(); // jQuery(this).append('-'); // }); jQuery("table:not([role]) > tbody").each(function(){ jQuery(this).closest("table").attr("role","presentation"); jQuery(this).find(".acs").remove(); jQuery(this).append('-'); }); jQuery("#tblMain, .nextInnerTable.nextCartTable, .nextEditContactTable").attr("role","presentation"); // jQuery(".nextEditContactTable tbody").each(function(){ // jQuery(this).find(".acs").remove(); // jQuery(this).append('-'); // }); /* next 4 lines causing issues */ jQuery('.nextNotLoggedIn.nextRegister #ctl00_ctl00_cphMain_cphMain_pwrPassword_psdMain_lblPassword').remove(); jQuery('.nextNotLoggedIn.nextRegister #ctl00_ctl00_cphMain_cphMain_pwrPassword_psdMain_rtbPassword_txtRestricted').attr("type","hidden"); jQuery('.nextNotLoggedIn.nextRegister [for="ctl00_ctl00_cphMain_cphMain_pwrPassword_psdMain_rtbPassword_txtRestricted"]').remove(); jQuery('.nextNotLoggedIn.nextRegister [for="ctl00_ctl00_cphMain_cphMain_pwrPassword_psdRetype_rtbPassword"]').remove(); ScrollToMainLink(); /* end add custom */ /* end accessibility */ } function luminanace(r, g, b){ var a = [r, g, b].map(function (v) { v /= 255; return v <= 0.03928 ? v / 12.92 : Math.pow( (v + 0.055) / 1.055, 2.4 ); }); return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722; } function contrast(rgb1, rgb2){ var lum1 = luminanace(rgb1[0], rgb1[1], rgb1[2]); var lum2 = luminanace(rgb2[0], rgb2[1], rgb2[2]); var brightest = Math.max(lum1, lum2); var darkest = Math.min(lum1, lum2); return (brightest + 0.05) / (darkest + 0.05); } //contrast([255, 255, 255], [255, 255, 0]); // 1.074 for yellow //contrast([255, 255, 255], [0, 0, 255]); // 8.592 for blue var hexDigits = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"); function rgb2hex(rgb){ rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]); } function hex(x) { return isNaN(x) ? "00" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16]; } function invertColor(hex, bw){ if (hex.indexOf('#') === 0) { hex = hex.slice(1); } // convert 3-digit hex to 6-digits. if (hex.length === 3) { hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; } if (hex.length !== 6) { throw new Error('Invalid HEX color.'); } var r = parseInt(hex.slice(0, 2), 16), g = parseInt(hex.slice(2, 4), 16), b = parseInt(hex.slice(4, 6), 16); if (bw) { // http://stackoverflow.com/a/3943023/112731 return (r * 0.299 + g * 0.587 + b * 0.114) > 186 ? '#000000' : '#FFFFFF'; } // invert color components r = (255 - r).toString(16); g = (255 - g).toString(16); b = (255 - b).toString(16); // pad each with zeros and return return "#" + padZero(r) + padZero(g) + padZero(b); } // jQuery(document).ready(function(){ // jQuery("#subscribe_footer").on("submit",function(e){ // e.preventDefault(); // OpenEmailSignupFormPopup(); // jQuery('#mc-embedded-subscribe-form #mce-EMAIL').val(jQuery('#subscribe_footer #fc-email').val()); // }); // jQuery('#subscribe_footer .btn-button.effect').on('click', function(){ // OpenEmailSignupFormPopup(); // jQuery('#mc-embedded-subscribe-form #mce-EMAIL').val(jQuery('#subscribe_footer #fc-email').val()); // }); // });