console.log("acs added"); nmxSiteAccessibility(20, 100); function ScrollToMainLink(){ jQuery(".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 if (jQuery(".our-services-section").length){ jQuery("body").attr("main",".our-services-section"); } 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); } function nmxSiteAccessibility(c, i){ //console.log("acs fixing "+c); ScrollToMainLink(); /* obfuscate pdf links */ // jQuery("a[href*='pdf']").each(function(index){ // if (jQuery(this).attr("href").indexOf("javascript")==-1){ // jQuery(this).attr("href",'javascript:(function(){ var i='+index+'; document.location="'+jQuery(this).attr("href")+'"; })();').attr("aria-hidden","true").attr("role","presentation"); // } // }); if (c > 0){ c--; //console.log("acs "+c); window.setTimeout(function(){ nmxSiteAccessibility(c--, i); },i); } } // Add Skip to content link // if(!jQuery('.skip-to-content-link').length){ // jQuery( "body" ).prepend( 'Skip to content' ); // jQuery('header') ? jQuery( "header" ).after( '
' ) : jQuery("body").children().eq(2).attr("id", "maincontent"); // } 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); }