1var findEmptys; 2 3//Globals: 4var uri = document.location.href; 5var diDir = DIDIR; 6var fiDocs = FIDOCS; 7var fiImages = FIIMAGES; 8var themeImages = THEMEIMAGES; 9var contextPath = CONTEXTPATH; 10var region = REGION; 11var fiName = FINAME; 12var cfg_enable_logging = CFG_ENABLE_LOGGING; 13var ncr_blog_landing = NCR_BLOG_LANDING; 14var layout = LAYOUT; 15var cfg_site_live = CFG_SITE_LIVE; 16var ua = USERAGENT; 17var userAgent = USERAGENT; 18 19(function($){ 20 21 //helper function to be used in console 22 //it locates empty tags and helps to point out where they are on the page 23 findEmptys = function(tag, parents){ 24 count = 0; 25 $(tag).each(function(){ 26 if($(this).html()==""){ 27 $(this).css("border", "2px solid red"); 28 $(this).addClass("empty_element"); 29 if(parents){ 30 $(this).parents(parents).css("border", "2px solid red"); 31 $(this).parents(parents).addClass("empty_element"); 32 } 33 count++; 34 } 35 }) 36 console.log("found: " + count + " links"); 37 } 38 39 $(function(){ 40 //fix target blank bug: (I'm sure this link will be valid forever .... right?) 41 // https://dev.to/ben/the-targetblank-vulnerability-by-example 42 window.opener=null; 43 $("a").each(function(){ 44 var tar = $(this).attr("target"); 45 if(tar = "_blank"){ 46 var rel = ($(this).attr("rel")==undefined)?"":$(this).attr("rel"); 47 if(rel.indexOf("noopener")<0){ 48 $(this).attr("rel", rel + " noopener"); 49 } 50 if(rel.indexOf("noreferrer")<0){ 51 $(this).attr("rel", rel + " noreferrer"); 52 } 53 } 54 }); 55 56 // prevent IE from throwing error 57 if (typeof console == "undefined") { 58 window.console = { 59 log: function () {} 60 }; 61 } 62 63 //check for ?login 64 if( getParameterByName("login") != null ){ 65 showLogin(); 66 } 67 68 69 //EMU 70 //move all emu code 71 //to a separate function 72 //modularity 73 applyEmuFixes(); 74 75 //initialize UA classes 76 //applyUAclasses(); 77 78 /////////// GUIDE ME - Checking Accounts //////// 79 //no #1 80 $('#checking.feature-wrap-guide-me .feature:nth-child(1) .feature-cta a').on('click',function(){ 81 $('.feature-wrap-guide-me .feature:nth-child(1)').hide(); 82 $('.feature-wrap-guide-me .feature:nth-child(2)').show(); 83 }); 84 //no #2 85 $('#checking.feature-wrap-guide-me .feature:nth-child(2) .feature-cta a').on('click',function(){ 86 $('.feature-wrap-guide-me .feature:nth-child(2)').hide(); 87 $('.feature-wrap-guide-me .feature:nth-child(3)').show(); 88 }); 89 //return to normal when opened up again 90 $('#checking.feature-wrap-guide-me').on('ncr-panel-opened', function(){ 91 $('.feature-wrap-guide-me .feature:nth-child(1)').show(); 92 $('.feature-wrap-guide-me .feature:nth-child(2)').hide(); 93 $('.feature-wrap-guide-me .feature:nth-child(3)').hide(); 94 }); 95 96 /////////// GUIDE ME - Business Accounts //////// 97 //no #1 98 $('#business.feature-wrap-guide-me .feature:nth-child(1) .feature-cta a').on('click',function(){ 99 $('.feature-wrap-guide-me .feature:nth-child(1)').hide(); 100 $('.feature-wrap-guide-me .feature:nth-child(2)').show(); 101 }); 102 //return to normal when opened up again 103 $('#business.feature-wrap-guide-me').on('ncr-panel-opened', function(){ 104 $('.feature-wrap-guide-me .feature:nth-child(1)').show(); 105 $('.feature-wrap-guide-me .feature:nth-child(2)').hide(); 106 }); 107 108 /////////// GUIDE ME - Which Account is Right for Me? //////// 109 //Personal 110 $('#which-account.feature-wrap-guide-me .feature:nth-child(1) .feature-content-text a').on('click',function(){ 111 $('.feature-wrap-guide-me .feature:nth-child(1)').hide(); 112 $('.feature-wrap-guide-me .feature:nth-child(2)').show(); 113 }); 114 //Business 115 $('#which-account.feature-wrap-guide-me .feature:nth-child(1) .feature-cta a').on('click',function(){ 116 $('.feature-wrap-guide-me .feature:nth-child(1)').hide(); 117 $('.feature-wrap-guide-me .feature:nth-child(5)').show(); 118 });
119 //Personal no #1 120 $('#which-account.feature-wrap-guide-me .feature:nth-child(2) .feature-cta a').on('click',function(){ 121 $('.feature-wrap-guide-me .feature:nth-child(2)').hide(); 122 $('.feature-wrap-guide-me .feature:nth-child(3)').show(); 123 }); 124 //Personal no #2 125 $('#which-account.feature-wrap-guide-me .feature:nth-child(3) .feature-cta a').on('click',function(){ 126 $('.feature-wrap-guide-me .feature:nth-child(3)').hide(); 127 $('.feature-wrap-guide-me .feature:nth-child(4)').show(); 128 }); 129 //Business no #1 130 $('#which-account.feature-wrap-guide-me .feature:nth-child(5) .feature-cta a').on('click',function(){ 131 $('.feature-wrap-guide-me .feature:nth-child(5)').hide(); 132 $('.feature-wrap-guide-me .feature:nth-child(6)').show(); 133 }); 134 //return to normal when opened up again 135 $('#which-account.feature-wrap-guide-me').on('ncr-panel-opened', function(){ 136 $('.feature-wrap-guide-me .feature:nth-child(1)').show(); 137 $('.feature-wrap-guide-me .feature:nth-child(2)').hide(); 138 $('.feature-wrap-guide-me .feature:nth-child(3)').hide(); 139 $('.feature-wrap-guide-me .feature:nth-child(4)').hide(); 140 $('.feature-wrap-guide-me .feature:nth-child(5)').hide(); 141 $('.feature-wrap-guide-me .feature:nth-child(6)').hide(); 142 }); 143 /////////// GUIDE ME //////// 144 145 // Adding in AudioEye 146 if( MstInc_audioeye_enabled ){!function(){var t=function(){var t=document.createElement("script");t.src="https://ws.audioeye.com/ae.js",t.type="text/javascript",t.setAttribute("async",""),document.getElementsByTagName("body")[0].appendChild(t)};"complete"!==document.readyState?window.addEventListener?window.addEventListener("load",t):window.attachEvent&&window.attachEvent("onload",t):t()}()} 147 148 149 //Backpage promo image mover 150 /* 151 var $moveTo = $(".moveTo") 152 var $moveFrom = $(".content .hed") 153 //see if there's stuff in the snippet (a per-page promo image) 154 if( $moveFrom.children().length > 0) { 155 var content = $moveFrom; 156 content.detach(); 157 if($(".editmode_workarea").children().length > 0){ 158 $moveTo.append(content); 159 } else { 160 $moveTo.html(content); 161 } 162} 163*/ 164 165 166//Replace top Image 167/* 168if($(".content .top-image").length > 0){ 169 var src = $(".content .top-image").attr("src"); 170 var alt = $(".content .top-image").attr("alt"); 171 if(alt == undefined){ 172 alt = ""; 173 } 174 if(src != undefined){ 175 $("#promo-replace").attr("src", src); 176 $("#promo-replace").attr("alt", alt); 177 $(".content .top-image").detach(); 178 } 179} 180 181$("#promo-replace").removeClass("hidden"); 182*/ 183 184 185 186/** 187 * apply tagReplace to any element with .tagReplace as a class 188 * Note: this is better done using velocity macro #tagReplace() 189 */ 190$(".tagReplace").each(function(){ 191 $(this).html($(this).text().tagReplace()); 192}); 193 194 /** 195 * if you add the class "missing" to empty links, this will add the popover class to it 196 * QA prefers this 197 * **/ 198 if(cfg_site_live =="false"){ 199 $("a.missing, a[href=#missing]").each(function(){ 200 $(this).click(function(event){ 201 event.preventDefault(); 202 alert("No URL was provided for this link."); 203 }); 204 $(this).addClass("popover-link"); 205 $(this).attr("data-toggle", "popover"); 206 $(this).attr("data-placement", "top"); 207 $(this).attr("data-container", "body"); 208 $(this).attr("data-template", '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title missing-link-title"></h3><div class="popover-content"></div></div>'); 209 $(this).attr("title", "Missing Link"); 210 $(this).attr("data-content", "No URL was provided for this link."); 211 }); 212 213 //$('.popover-link').popover({'html': true}); 214 $('.popover-link').on('shown.bs.popover', function () { 215 var $pop = $(this); 216 $pop.addClass("alert-danger"); 217 setTimeout(function () { 218 $pop.popover('hide'); 219 }, 3000); 220 }); 221 } 222 223 //DROPDOWNS 224 //ncr-custom-block 225 //block-dropdown.js 226 //initialize em 227 var count=0; 228 $(".dropdown").each(function(){ 229 $(this).find(".heading").addClass("discToggle"); 230 $(this).find(".content").addClass("disclaimer"); 231 $(this).find(".heading").attr("data-ncr-dropdown", count); 232 $(this).find(".content").attr("data-ncr-dropdown", count); 233 $(this).addClass("disclaimerBox"); 234 $(this).addClass("unhidden"); 235 $(this).attr("data-ncr-dropdown", count); 236 count++; 237 });
238 239 240//make em work 241$(".dropdown .heading").click(function(){ 242 expandDisc($(this)); 243}); 244 245$(".dropdown .heading").keypress(function() { 246 if (event.which == 13 || event.which==32) { 247 expandDisc($(this)); 248 return false; 249 } 250}); 251 252function expandDisc(target){ 253 var dropdown_id = target.attr("data-ncr-dropdown"); 254 $(".content[data-ncr-dropdown="+dropdown_id+"]").slideToggle(200); 255 target.toggleClass("open"); 256} 257 258 259 260// TPWS 261$(".open-tpw").click(function(){ 262 //console.log("open tpw clicked"); 263}); 264// END TPWS 265 266 267 268//if($(".sNav ul li").length <= 1){ 269//$(".sNav").detach(); 270//} 271 272 273 274//fix default wp table headers 275$("table.add-headers").addClass("table-hover") 276$("table.add-headers tr:first-child").each(function(){ 277 $(this).addClass("tableheader"); 278 $(this).find("td").each(function(){ 279 $(this).replaceWith("<th>" + $(this).html() + "</th>"); 280 }); 281}); 282//fix empty fields in blocks 283 284$(".wp-block-ncr-blocks-employee-bios-wrapper h2, .wp-block-ncr-blocks-employee-bios-wrapper h3, .wp-block-ncr-blocks-employee-bio .employee-name,.wp-block-ncr-blocks-employee-bio .employee-title, .wp-block-ncr-blocks-news-event .date, .wp-block-ncr-blocks-accordion h2, .wp-block-ncr-blocks-accordion h3, .edit-button-container a").each(function(){ 285 if($(this).html()===""){ 286 $(this).detach(); 287 } 288}); 289 290 291//init a modal for newsite redirects from WC 292// initializeNewsiteModal(); 293//setup tpw 294initializeTPWModal(); 295initializeTPWRules();
296 297//setup alert tpws 298initializeAlert(); 299//init wp fixes, etc 300initializeSeclinks(); 301initializeTablepress(); 302//fixTablepressTables(); 303 304 305//BLOG CODE 306if(ncr_blog_landing === "true"){ 307 initializeBlogLazyLoad(); 308} 309 310//NCR CUSTOM BLOCKS 311initializeQuicklinks(); 312initializeSmPromos(); 313initializeAccordionBock(); 314 315//set up the .clickableDiv class 316initializeClickableDivs(); 317 318 319if($("body").hasClass("ie")){ 320 fixIE(); 321} 322 323 324 325 326$("a.ncr-tpw").click(function(){ 327 var tpw = parseInt($(this).attr("data-ncr-tpw")) + 1; 328 if(!isNaN(tpw)){ 329 return displayThirdPartyAlert(tpw,this); 330 } 331}); 332 333//handle hashtags that aren't #login 334if (window.location.hash != undefined && window.location.hash != "") { 335 doHashtag(); 336} 337 338$(window).on('hashchange',function(){ 339 doHashtag(); 340}); 341 342 343 344$(".label_pw-eye").click(function(){ 345 let p = $(this).parents(".pw-field-wrap"); 346 let f = $("input#password",p); 347 if( $(f,p).prop("type")==="text" ){ 348 p.removeClass("pw-show"); 349 f.prop("type","password"); 350 }else{ 351 p.addClass("pw-show"); 352 f.prop("type","text"); 353 } 354}).each(function(){ 355 let p = $(this).parents(".pw-field-wrap"); 356 let f = $("input#password",p); 357 if( f.prop("type")==="text" ){ 358 p.addClass("pw-show"); 359 }else{ 360 p.removeClass("pw-show"); 361 } 362}); 363 364}); 365 366 367 368//BLOG CODE 369var STILL_LOADING = true; 370var POSTS_LOADED = 0; 371var CURRENT_PAGE = 0; 372 373function initializeBlogLazyLoad(){ 374 log("initializing blog lazy load"); 375 376 //load params from blog landing page 377 //console.log(BLOG_PARAMS); 378 379 //UPDATE THIS DIV CLASS (and/or just make sure it's on the landing page) 380 var dest_div = ".blog-post-appender"; 381 var per_row = 3; 382 var category = BLOG_PARAMS['category']; 383 var max_posts = BLOG_PARAMS['max_posts']; 384 var initial_posts = BLOG_PARAMS['posts_loaded']; 385 POSTS_LOADED = BLOG_PARAMS['posts_loaded']; //$(dest_div).find(".feature").length; 386 387 388 var category_str = ""; 389 if (category != -1){ 390 category_str = "&categories=" + category; 391 } 392 393 394 //pull all the posts from the wp db 395 //also, create all the divs, push to dom, hide em 396 //https://www.pnwfcu.org/wph/newsite/wp-json/wp/v2/posts 397 var api_call = contextPath + '/wp-json/wp/v2/posts?per_page=420&offset='+initial_posts+category_str; 398 $.get(api_call, function(data){ 399 //log("got more pages"); 400 //console.log("URL:"); 401 //console.log(api_call); 402 //console.log(data); 403 for(var i=0; i<data.length; i++){ 404 var new_div = ""; 405 406 407 //UPDATE THIS IMAGE PATH 408 var img_src=(typeof data[i].secondary_image_src != "undefined" )?data[i].secondary_image_src:"https://www.pnwfcu.org/wph/newsite/wp-content/uploads/2019/07/img_blog-post_default.jpg"; 409 var post_title=data[i].title.rendered; 410 var subtitle=(typeof data[i].meta.attr_subtitle[0] != "undefined" )?data[i].meta.attr_subtitle[0]:""; 411 var timestamp=(typeof data[i].meta.attr_date[0] != "undefined" )?data[i].meta.attr_date[0]:""; 412 var excerpt= (typeof data[i].meta.attr_excerpt[0] != "undefined" )?data[i].meta.attr_excerpt[0]:""; 413 var post_link=data[i].link; 414 var img_alt=(typeof data[i].secondary_image_alt != "undefined" )?data[i].secondary_image_alt:"thumbnail image for blog post: " + post_title; 415 416 417 //UPDATE THIS HTML 418 new_div += '<div class="feature clickable-div clickableDiv blog-archive-entry appended-post hidden">'; 419 new_div += '<div class="feature-image cover-image">'; 420 new_div += '<img src="'+img_src+'" alt="'+img_alt+'" />'; 421 new_div += '</div>'; 422 new_div += '<div class="feature-content">'; 423 new_div += '<div class="feature-text">'; 424 new_div += '<h3>'+post_title+'</h3>'; 425 if (subtitle!=""){ 426 new_div += '<h4>'+subtitle+'</h4>'; 427 } 428 new_div += '<span>'+timestamp+'</span>'; 429 new_div += '<div class="text-container">'; 430 new_div += "<p>"+excerpt+"</p>"; 431 new_div += '</div><!--text-container-->'; 432 new_div += '</div><!--feature-text-->'; 433 new_div += '<div class="feature-cta">'; 434 new_div += '<a href="'+post_link+'"></a>'; 435 new_div += '</div><!--feature-cta-->'; 436 new_div += '</div><!--feature-content-->'; 437 new_div += '</div><!--feature-->'; 438 439 440 $(dest_div).append(new_div); 441 initializeClickableDivs(); 442 $('.blog-archive-entry .cover-image').moveImageToBg({ 443 bgPosition: 'center center', 444 bgType: 'cover' 445 }); 446 447 } 448 449 if(data.length == 0){ 450 $(dest_div).append("<div id='no-more-posts'><p><strong>No more posts in this category.</strong></p></div>"); 451 } 452 453 }).done(function(){ 454 STILL_LOADING = false; 455 }); 456 457 458 //on scroll, show a row 459 $(document).scroll( function(){ 460 var curr_top = $(this).scrollTop(); 461 var screen_height = $(window).height(); 462 var curr_bottom = curr_top + screen_height; 463 var container_top = $(dest_div).offset().top; 464 var container_height = $(dest_div).height(); 465 var container_bottom = container_top + container_height; 466 var buffer = 300; //number of pixels from bottom of container to trigger the ajax call 467 468 var showMore = false; 469 if(curr_bottom>(container_bottom-buffer) && $("#no-more-posts").length == 0 ){ 470 showMore = true; 471 log("show more posts"); 472 473 count = 0; 474 $(".blog-archive-entry.hidden").each(function(){ 475 count++; 476 if (count < 4){ 477 $(this).removeClass("hidden"); 478 } 479 }); 480 //log("curr_top: " + curr_top); 481 //log("screen_height: " + screen_height); 482 //log("curr_bottom: " + curr_bottom); 483 //log("container_top: " + container_top); 484 //log("container_height: " + container_height); 485 //log("container_bottom: " + container_bottom); 486 487 } 488 489 if ($(".blog-archive-entry.appended-post.hidden").length == 0 && $("#no-more-posts").length == 0 && STILL_LOADING==false){ 490 $(dest_div).append("<div id='no-more-posts'><p><strong>No more posts in this category.</strong></p></div>"); 491 } 492 });//end scroll 493 494} 495//END BLOG CODE 496 497 498function initializeClickableDivs(){ 499 500 /** 501 * make a div clickable by finding an <a> tag inside it 502 */ 503 $(".clickableDiv").each(function(){ 504 if($(this).attr("data-initialized") === "true" ){ 505 return; 506 } 507 var src = $(this).find("a").attr("href"); 508 if(src == undefined){ 509 $(this).removeClass("clickableDiv"); 510 return; 511 } 512 var tpw = false; 513 var tpw_index = false; 514 var target = $(this).find("a").attr("target"); 515 var emu = false; //set to true to enable enter key to trigger click 516 var t_ind = $(this).attr("tabindex"); 517 518 //check for existing tab index 519 if(t_ind == undefined && emu == true){ 520 //here's where we should figure out a "scope" and set these indices within some context instead of globally 521 //issues: 522 //with ind = 0, the div will lose focus when we highlight the <a>, which is a problem for some sites 523 //with ind = 1, the div keeps focus, but the <a>
523 never gets focused 524 $(this).attr("tabindex", "0"); 525 } 526 527 //check for tpw 528 if(($(this).find("a").attr("onclick")!=undefined && $(this).find("a").attr("onclick").indexOf("displayThirdPartyAlert")>-1) || $(this).find("a.ncr-tpw").length>0 ){ 529 if($(this).find("a.ncr-tpw").attr("data-ncr-tpw")){ 530 tpw = true; 531 tpw_index = parseInt($(this).find("a.ncr-tpw").attr("data-ncr-tpw"))+1; 532 } else { 533 log("found ncr-tpw, but no 'data-ncr-tpw' attr"); 534 } 535 } 536 537 //check for locally hosted pdf 538 if(src.indexOf(contextPath)>-1 && src.indexOf(".pdf")>-1){ 539 log("pdf in a clickable div, ignoring it"); 540 //log("clickableDiv contains pdf, this might not work with external pdfs"); 541 //src = fiDocs + src.substring((src.indexOf(contextPath)+contextPath.length), src.length); 542 //target = "_blank"; 543 } 544 545 //if we're doing emu mode, enable enter to trigger links 546 if(emu == true){ 547 $(this).keypress(function (e) { 548 var key = e.which; 549 if(key == 13 || key == 32) { 550 $(this).trigger("click"); 551 } 552 }); 553 } 554 555 //process click 556 $(this).click(function(){ 557 if(tpw){ 558 if(tpw_index!=undefined){ 559 return showWarning(src, "", "", tpw_index) 560 } else { 561 return showWarning(src, "", "", 1) 562 } 563 //return displayThirdPartyAlert(1,$(this).find("a")); 564 } 565 else if(target == "_blank"){ 566 target_blank(src); 567 } 568 else { 569 window.location = src; 570 } 571 }); 572 573 //display the right url in the status bar 574 $(this).mouseover(function(){ 575 window.status = src; 576 }).mouseout(function(){ 577 window.status = ''; 578 }); 579 $(this).attr("data-initialized", "true"); 580 }); 581} 582 583function initializeSeclinks(){ 584 if($(".section-links.section-index").length>0){ 585 $(".contentback .zone.zone1.content").addClass("section-index"); 586 } 587} 588function initializeTablepress(){ 589 log("initializing tablepress tables"); 590 $(".tablepress .row-1").addClass("tableheader"); 591} 592 593function showLogin(){ 594 log("showing login."); 595 //this needs to be updated to use ?login instead of #login 596 $("[ncr-panel='Login']").on("ncr-panel-opened", function(){ 597 setTimeout(function() {$('input[name=username]').focus();}, 300); 598 }); 599 600 $("[ncr-panel='Bank Login']").trigger("ncr-open-panel"); 601 602 //$("#loginToggle").trigger("click"); 603 //$("input[name=userid]").focus(); 604 //$(".ibDropdown").addClass("active"); 605 //$("#login").show(); 606 //document.getElementById("username1").focus(); 607} 608 609function initializeQuicklinks(){ 610 if($(".ncr-quicklinks-mover").length>0){ 611 log("moving quicklinks"); 612 $("#quicklinks-landing").html($(".ncr-quicklinks-mover")); 613 } 614} 615function initializeSmPromos(){ 616 if($(".ncr-sm-promo-mover").length>0){ 617 log("moving sm promos"); 618 $("#sm-promo-landing").html($(".ncr-sm-promo-mover")); 619 } 620} 621 622 623function initializeAlert(){ 624 $("#ncr-alert-wrapper .alert").on("ncr-panel-closed", function(){ 625 closeNCRalert(); //defined in class-alert.php 626 }); 627} 628 629 630//set up a "new website" modal 631function initializeNewsiteModal(){ 632 if(typeof(SHOW_NEWSITE_POPUP)!=="undefined"){ 633 if(SHOW_NEWSITE_POPUP == true){ 634 $("#ncr-newsite-popup-panel").trigger("ncr-open-panel"); 635 } 636 637 $("#ncr-newsite-popup-panel").on("ncr-panel-closed", function(){ 638 incrementNCRNewsiteCookie(); 639 }); 640 } 641} //end initializeNewsiteModal 642 643 644//set up the TPW to be a dialog 645function initializeTPWModal(){ 646 //handled in design js, could manually call via: 647 //$("div[ncr-panel='ncr-tpw']").tabTrapping({}); 648 649 //close the modal after you click continue 650 $(".btn-go").on("click", function(){ 651 $("#ncr-tpw-popup-panel").trigger("ncr-close-panel"); 652 }); 653} 654 655 656//sitewide TPW settings 657function initializeTPWRules(){ 658 log("initializing global tpw rules"); 659 var rules = NCR_TPW_RULES; 660 var all_external = NCR_TPW_ALL_EXTERNAL_SITES; 661 $("a[href]:not(.ncr-tpw)").each(function(){ 662 var href = $(this).attr("href"); 663 664 if(all_external.enabled === "true"){ 665 console.log("add to all links"); 666 var local_domain = all_external.local; 667 var tpw = all_external.tpw; 668 if( href.indexOf(local_domain) >-1 || href.startsWith("/") || href.startsWith("#") || href.startsWith("javascript:") ){ 669 //continue; 670 } else { 671 $(this).addClass("ncr-tpw"); 672 $(this).attr("data-ncr-tpw", tpw); 673 } 674 } else { 675 //handle individual rules 676 //console.log(href); 677 for(i=0; i<rules.length; i++){ 678 //console.log("found rule: " + rules[i]); 679 var domain = rules[i].domain; 680 //do regex search 681 if(rules[i].regex === "true"){ 682 var res = href.match(new RegExp(domain, 'gi')) 683 if(res){ 684 //$(this).css("border", "3px solid red"); 685 $(this).addClass("ncr-tpw"); 686 $(this).attr("data-ncr-tpw", rules[i].tpw); 687 } 688 //not regex 689 } else { 690 if(href.indexOf(domain) > -1){ 691 //$(this).css("border", "3px solid red"); 692 $(this).addClass("ncr-tpw"); 693 $(this).attr("data-ncr-tpw", rules[i].tpw); 694 } 695 696 } //end regex check 697 } //end rules foreach 698 699 } 700 }); 701 702} //end initializeTPWRules 703 704//ncr-accordion 705// ncr-accordion-panel 706// ncr-accordion-panel-heading 707// ncr-accordion-panel-body 708function initializeAccordionBock(){ 709 log("initializing custom accordion block(s)"); 710 711 if($(".ncr-accordion").length>0){ 712 var curr = 1; 713 var panel = 1; 714 715 $(".ncr-accordion").each(function(){ 716 $(this).find(".ncr-accordion-panel-heading, .ncr-accordion-panel-body").attr("data-accordion", "#NCR-accordion-"+curr);
717 $(this).attr("id", "NCR-accordion-" + curr); 718 var isFirst = true; 719 $(this).find(".ncr-accordion-panel").each(function(){ 720 var anchor_id = $(this).attr("id"); 721 $(this).attr("id", "ncr-accordion-panel-" + panel); 722 var $heading = $(this).find(".ncr-accordion-panel-heading"); 723 var $body = $(this).find(".ncr-accordion-panel-body"); 724 $heading.attr('id', "ncr-accordion-panel-heading-" + panel); 725 $heading.attr('aria-controls', "ncr-accordion-panel-body-" + panel); 726 $heading.attr('data-target', "ncr-accordion-panel-body-" + panel); 727 $heading.attr('data-parent', "ncr-accordion-panel-" + panel); 728 $heading.attr('data-accordion', "NCR-accordion-" + curr); 729 $heading.attr('data-anchor-id', anchor_id); 730 $heading.find('a').attr("href", "javascript:void(0)"); 731 $body.attr('id', "ncr-accordion-panel-body-" + panel); 732 if(!isFirst){ 733 $(this).addClass("entry-closed"); 734 $heading.attr("aria-expanded", "false"); 735 } else { 736 isFirst = false; 737 $heading.attr("aria-expanded", "true"); 738 $(this).addClass("entry-opened"); 739 } 740 panel++; 741 }); 742 //$(this).attr("role", "tablist"); 743 //$(this).attr("aria-multiselectable", "true"); 744 //$(this).attr("tabindex", "0"); 745 curr++; 746 }); 747 748 749 $(".ncr-accordion-panel-heading").each(function(){ 750 //set up the heading 751 //$(this).attr("aria-controls", "false"); 752 //$(this).attr("id", "ncr-accordion-panel-heading-" + panel); 753 //$(this).attr("data-target", "#ncr-accordion-panel-body-" + panel); 754 755 //panel++; 756 }); 757 758 759 $(".ncr-accordion-panel-heading").click(function(){ 760 var src = $(this); 761 var tar = $(this).attr("data-target"); 762 expandHandler(src, tar); 763 }); 764 $(".ncr-accordion-panel-heading").keypress(function(event) { 765 var src = $(this); 766 var tar = $(this).attr("data-target"); 767 if (event.which == 13 || event.which==32) { 768 expandHandler(src, tar); 769 return false; 770 } 771 }); 772 773 } 774} 775 776 777//handles the ncr accordions 778function expandHandler(src, tar){ 779 var $accordion = $("#" + src.attr("data-accordion")); 780 var isStyleDefault = $accordion.hasClass("is-style-default"); 781 var onlyOneOpen = $accordion.hasClass("is-style-one-open"); 782 783 //if no style is set, go with the default one. 784 if (!isStyleDefault && !onlyOneOpen){ 785 isStyleDefault = true; 786 } 787 788 log("accordion: default: " + isStyleDefault + ", one: " + onlyOneOpen); 789 790 var target = "#" + src.attr("data-parent"); 791 if(isStyleDefault){ 792 //just toggle this panel 793 $(target).toggleClass("entry-closed").toggleClass("entry-opened"); 794 if($(target).hasClass("entry-opened")){ 795 //this selector is weird in case we're toggling this panel by other means. 796 //src.attr("aria-expanded") should be the same thing. 797 $(src.attr("data-parent")).find(".ncr-accordion-panel-heading").attr("aria-expanded", "true"); 798 } else { 799 $(src.attr("data-parent")).find(".ncr-accordion-panel-heading").attr("aria-expanded", "false"); 800 } 801 } 802 803 if(onlyOneOpen){ 804 //don't do anything if this is the only panel in this acc 805 //otherwise, close the open one, and open the new one. 806 if($(target).hasClass("entry-opened")){ 807 //$(target).toggleClass("entry-closed"); 808 } else { 809 $accordion.find(".ncr-accordion-panel").removeClass("entry-opened").addClass("entry-closed"); 810 $(target).addClass("entry-opened"); 811 $(target).removeClass("entry-closed"); 812 if($(target).hasClass("entry-opened")){ 813 //this selector is weird in case we're toggling this panel by other means. 814 //src.attr("aria-expanded") should be the same thing. 815 $(src.attr("data-parent")).find(".ncr-accordion-panel-heading").attr("aria-expanded", "true"); 816 } else { 817 $(src.attr("data-parent")).find(".ncr-accordion-panel-heading").attr("aria-expanded", "false"); 818 } 819 820 } 821 } 822 823 return; 824 //var isAccordion = src.parent().hasClass("accordion"); 825} //end expandHandler 826 827//url with hash? 828//guess we gotta process that 829//lots of fun stuff here 830function doHashtag(){ 831 var full_hash = window.location.hash; 832 var hash_name = full_hash.split("#")[1] 833 log("handling hashtag: " + hash_name); 834 835 if(hash_name==undefined){ 836 return; 837 } 838 839 if (hash_name==="login" || hash_name==="skip-to-login"){ 840 showLogin(); 841 $('html,body').animate({scrollTop: $("#login-panel .feature-wrap1").offset().top-10}, 800); 842 843 } 844 845 //handle accordions 846 if($(".ncr-accordion-panel-heading[data-anchor-id=" + hash_name + "]").length>0){ 847 //log('$(".ncr-accordion-panel-heading[data-anchor-id="' + hash_name + '"]'); 848 849 expandHandler($(".ncr-accordion-panel-heading[data-anchor-id=" + hash_name + "]"), $(".ncr-accordion-panel-heading[data-anchor-id=" + hash_name + "]").attr("data-target")); 850 851 //$(".ncr-accordion-panel-heading[data-anchor-id=" + hash_name + "]").trigger("click"); 852 var $target = $(".ncr-accordion-panel-heading[data-anchor-id=" + hash_name + "]"); 853 var top_buffer = $(".sticky-mast").height() + 20; 854 var topset = ($target.offset().top)?$target.offset().top:0; 855 ////console.log($("a[name=" + hash_name + "]")); 856 //$('html,body').animate({scrollTop: }, 400); 857 $('html,body').animate({scrollTop: topset - top_buffer}, 400); 858 } 859 860 $("a").each(function(){ 861 if($(this).attr("href") == full_hash && $(this).attr("data-toggle") == "tab" ){ 862 $("a[href=" + full_hash + "]").trigger("click"); 863 $('html,body').animate({scrollTop: $(".product-tabs").offset().top-$(".mast-wrap").height()-10}, 400); 864 //log("tab anchor"); 865 }
865 else if ($(this).attr("name") == hash_name) { 866 867//handle question/answers 868$("a[name=" + hash_name + "]").parents('.question').trigger("click"); 869var $target = $("a[name=" + hash_name + "]"); 870var top_buffer = $(".mast-wrap").height() + 10; 871 872if($target.parents('.question').length>0){ 873 $target = $target.parents('.question'); 874} 875 876var topset = ($target.offset().top)?$target.offset().top:0; 877//console.log($("a[name=" + hash_name + "]")); 878$('html,body').animate({scrollTop: topset - top_buffer}, 400); 879} 880}); 881} 882 883 884function fixIE(){ 885 console.log("fix IE issues."); 886 887}//end fixIE 888 889 890//accordions, eh? 891//give the people what they want 892//even if it's trash 893function fixFAQIcons(stop){ 894 //log('fixing icons') 895 //log(stop) 896 $(".question").each(function(){ 897 var $content = $(this).next(".answer"); 898 if ($content.is(":visible") == true){ 899 $(this).find(".plus-icon").hide(); 900 $(this).find(".minus-icon").show(); 901 } else { 902 $(this).find(".plus-icon").show(); 903 $(this).find(".minus-icon").hide(); 904 } 905 }); 906 //if(stop == "undefined"){ 907 if(!stop){ 908 var p = setTimeout(function(){fixFAQIcons(true);}, 410); 909 //log("running it again") 910 } 911} 912 913 914 915//Apply useragent classes 916//these should be done via velocity too 917function applyUAclasses(){ 918 // Opera 8.0+ 919 var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; 920 921 // Firefox 1.0+ 922 var isFirefox = typeof InstallTrigger !== 'undefined'; 923 924 // Safari 3.0+ "[object HTMLElementConstructor]" 925 var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification)); 926 927 // Internet Explorer 6-11 928 var isIE = /*@cc_on!@*/false || !!document.documentMode; 929 930 // Edge 20+ 931 var isEdge = !isIE && !!window.StyleMedia; 932 933 // Chrome 1+ 934 var isChrome = !!window.chrome && !!window.chrome.webstore; 935 936 // Blink engine detection 937 var isBlink = (isChrome || isOpera) && !!window.CSS; 938 939 940 var body_class = ""; 941 if (isIE) { 942 body_class = "ie ie11"; 943 } else if(isEdge) { 944 body_class = "ie edge"; 945 } else if(isChrome){ 946 body_class = "chrome non_ie"; 947 } else { 948 body_class = "non_ie"; 949 } 950 951 $("body").addClass(body_class); 952 953 954 //Add body classes for mobile based on UA 955 if(ua == "android"){ 956 $("body").addClass("android"); 957 $("body").addClass("mobile"); 958 } 959 if(ua == "ios"){ 960 $("body").addClass("ios"); 961 $("body").addClass("mobile"); 962 } 963} 964 965 966function applyEmuFixes(){ 967 968 //fix custom blocks 969 $(".wp-block-ncr-blocks-news-event").each(function(){ 970 $btn = $(this).find(".cta-btn"); 971 $heading = $(this).find(".heading"); 972 $btn.attr("aria-label", "call to action for: " + $heading.text()); 973 }); 974 975 //EMU: 976 //using the b tag? 977 //it's twenty eighteen my friend 978 //we use the strong tag 979 $("b").each(function(){ 980 $(this).replaceWith("<strong>" + $(this).text() + "</strong"); 981 }); 982 983 984 //EMU: 985 //weird stuff from design? 986 //just detach the empty links 987 //and move on with life 988 $("a").each(function(){ 989 var href = $(this).attr("href"); 990 var txt = $(this).text(); 991 992 //if(txt=="~" && href=="javascript:void(0);"){ 993 if(txt=="~"){ 994 $(this).detach(); 995 } 996 }); 997 998 //EMU: 999 //image has no alt? 1000 //we can put in the filename 1001 //better than nothing 1002 $("img").each(function(){ 1003 var alt = $(this).attr("alt"); 1004 var src = $(this).attr("src"); 1005 if (src != "" && src != undefined && (alt == "" || alt == undefined)){ 1006 src = src.split("/"); 1007 alt = src[src.length-1]; 1008 alt = alt.replace(/\.png/gi, "").replace(/\.jpg/gi, "").replace(/\.gif/gi, "").replace(/\.jpeg/gi, "").replace(/-/gi, " ").replace(/_/gi, " "); 1009 } 1010 $(this).attr("alt", alt); 1011 }); 1012 1013 1014 //EMU: 1015 //not in a section? 1016 //wrap everything in sections 1017 //surely this is good .... 1018 $("body > *:not(section,main,header,footer,.ignore-wrap)").each(function(){$(this).wrap("<section></section>");}); 1019 1020 //EMU: 1021 //sections need labels? 1022 //well ... we should just make one up 1023 //I think this will work? 1024 var sections = [] 1025 $("section").each(function(){ 1026 if($(this).attr("aria-label") == "" || $(this).attr("aria-label") == undefined){ 1027 var txt; 1028 if ($(this).text() == undefined){ 1029 txt = ""; 1030 } else { 1031 txt = $(this).text().trim().split(/\s/); //snag text from the html ele 1032 } 1033 var words = 3; //number of words to grab 1034 var max = 10; //make sure we don't loop forever 1035 words = (txt.length>words)?words:txt.length; //make sure there are enough words 1036 var label = ""; //string builder 1037 for(i=0; i<words; i++){ 1038 if(txt[i] != undefined && txt[i].trim().length>0){ 1039 word = txt[i].trim(); 1040 label += word + " "; 1041 } else if (words<max){ 1042 words++; 1043 } 1044 } 1045 label += "..."; 1046 txt = label; 1047 //check for duplicate aria-label (does not handle 3rd/4th/5th instance) 1048 if (sections.indexOf(txt) > -1){
1049 txt += " (duplicate)"; 1050 } 1051 sections.push(txt); 1052 $(this).attr("aria-label", txt); 1053 } 1054 }); 1055 1056 //EMU: 1057 //no h1 on page? 1058 //that's a problem for emus 1059 //let's just inject one 1060 if($("h1").length<1){ 1061 var h1 = '<h1 class="bankNameH1">' + fiName + '</h1>'; 1062 //implied: <a href="$contextPath/home" id="logoLink"><img src="$templateimages/logo.png" alt="$fiFriendlyName Logo" /> 1063 $("#logoLink").append(h1); 1064 } 1065 1066 //EMU: 1067 //roles will get Added 1068 //by megamenu js 1069 //so just remove it 1070 //$("#search-bar").removeAttr("role") 1071 1072 //EMU 1073 //aria-labels 1074 //let's try to add them in bulk 1075 //to shut up qa 1076 //Help: 1077 //relies on 'div.add-labels[data-prefix=whatever] a' 1078 //ex: 1079 // <div class="add-labels" data-prefix="footer link to: "> 1080 // <a>Login</a> 1081 // <a>Home</a> 1082 // <a>learn more</a> 1083 // </div> 1084 //result: 1085 // <a aria-label="footer link to: Login">Login</a> 1086 // <a aria-label="footer link to: Home">Home</a> 1087 // <a aria-label="footer link to: learn more">learn more</a> 1088 $(".add-labels a:not(.editorLink)").each(function(){ 1089 var label = $(this).attr("aria-label"); 1090 var prefix = ($(this).parents(".add-labels").attr("data-prefix"))?$(this).parents(".add-labels").attr("data-prefix"):"autogenerated link to "; 1091 if(label == "" || label == undefined){ 1092 var text = $(this).text().trim(); 1093 $(this).attr("aria-label", prefix + text); 1094 } 1095 }); 1096 1097 1098 //EMU: 1099 //add titles to frames 1100 //if they don't have a title 1101 //remove inline style 1102 var title_count = 0; 1103 $("iframe").each(function(){ 1104 $(this).removeAttr("border"); 1105 $(this).removeAttr("frameborder"); 1106 var title = $(this).attr("title"); 1107 if (title == undefined || title == ""){ 1108 $(this).attr("title", "untitled iframe: " + title_count); 1109 title_count++; 1110 } 1111 }); 1112 1113 //EMU: 1114 //fa icons fix 1115 //they don't have emu labels 1116 //so we make one up 1117 var c=0; 1118 $("svg.svg-inline--fa").each(function(){ 1119 var classes = $(this).attr("class"); 1120 faclass = classes.split("fa-")[1].replace(/-/g, " ").trim(); 1121 $(this).attr("aria-label", faclass + " icon, id: " + c); 1122 c++; 1123 }); 1124 1125 1126} 1127 1128//generate randome numbers 1129//randomBetween(1, 3) ==> 1, 2, 3 1130function randomBetween(min, max){ 1131 return Math.floor(Math.random() * max) + min; 1132} 1133 1134 1135 1136 1137//generic parameter pulling 1138function getParameterByName(name, url) { 1139 if (!url) url = window.location.href; 1140 name = name.replace(/[\[\]]/g, "\\$&"); 1141 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), 1142 results = regex.exec(url); 1143 if (!results) return null; 1144 if (!results[2]) return ''; 1145 return decodeURIComponent(results[2].replace(/\+/g, " ")); 1146} 1147 1148 1149 1150//console.log, eh? 1151//we should hide our messages 1152//and save our keystrokes 1153function log(log_message){ 1154 if((cfg_enable_logging == true && region != "live") || cfg_site_live == "false"){ 1155 if($("body.ie").length>0){ 1156 console.log(log_message); 1157 } else { 1158 console.log("%c" + log_message, "background: #2e0058; color: #00c0ff; padding:2px 4px; font-weight: bold; font-family: 'Comic Sans MS'"); 1159 } 1160 } 1161} 1162 1163// iframed form resizing 1164var int = self.setInterval(function(){isize()},2000); 1165var isize = function() { 1166 $('iframe.isize').each(function() { 1167 $(this).height($(this).contents().height()); 1168 }); 1169} 1170 1171 1172 1173function target_blank(url){ 1174 tmp = window.open(url); 1175 tmp = null; 1176} 1177 1178 1179/************************************************************************************************************ 1180 * This function is used in the onclick of the a tag to display the external site warning. 1181 * @param msg - Integer specifying the which message to display. 1182 * @param lk - The a link object 1183 * Usage: <a href="http://wwww.mysite.com" onclick="return displayThirdPartyAlert(1,this);">My Site</a> 1184 **************************************************************************************************************/ 1185function displayThirdPartyAlert(msg,lk){ 1186 var description = lk.innerHTML;
1187 if(description.indexOf('alt="') != -1){ 1188 var x = description.indexOf('alt="')+5; 1189 var temp = description.substring(x); 1190 description = temp.substring(0,temp.indexOf("\"")); 1191 } 1192 showWarning(lk.href, description, lk.target, msg) 1193 return false; 1194} 1195 1196/************************************************************************************************************ 1197 * This function is used in the href of the a tag to display the external site warning. 1198 * @param lk - The url of the site to be opened 1199 * @param desc - The description of the site to be opened, i.e. the name of the site. 1200 * @param target - Allows for the window to opened in a new window 1201 * @param msg - Integer specifying the which message to display. 1202 * Usage: <a href="javascript:showWarning('http://wwww.mysite.com');">My Site</a> 1203 **************************************************************************************************************/ 1204 1205function showWarning(lk, desc, target, msg){ 1206 desc = (desc) ? desc : "Third Party Site"; 1207 target="_blank"; 1208 if (lk.indexOf("http:")!=0&&lk.indexOf("https:")!=0&&lk.indexOf("mailto:")!=0) target = "_self"; 1209 msg = (msg) ? msg : 0; 1210 1211 /* 1212 var titles = new Array(); 1213 1214 titles[0] = titles[1] = '<h2>Third Party Site Disclaimer</h2>'; 1215 titles[2] = '<h2>Partner Site Disclaimer</h2>'; 1216 titles[3] = '<h2>Affiliate Site Disclaimer</h2>'; 1217 titles[4] = '<h2>Third Party Site Disclaimer</h2>'; 1218 titles[5] = '<h2>Email Disclaimer</h2>'; 1219 titles[6] = '<h2>Calculators Disclaimer</h2>'; 1220 1221 1222 var messages = new Array(); 1223 // Standard 3rd Party Warning 1224 messages[0] = messages[1] = "<p>By accessing the noted link you will be leaving "+fiName+"'s website and entering a website hosted by another party. "+fiName+" has not approved this as a reliable partner site. Please be advised that you will no longer be subject to, or under the protection of, the privacy and security policies of "+fiName+"'s website. We encourage you to read and evaluate the privacy and security policies of the site you are entering, which may be different than those of "+fiName+".</p>"; 1225 messages[2] = "<p>By accessing the noted link you will be leaving our website and entering a partner site which is hosted by another party. Please be advised that you will no longer be subject to, or under the protection of, the privacy and security policies of our website. We encourage you to read and evaluate the privacy and security policies of the site which you are entering, which may be different than those of ours.</p>"; 1226 messages[3] = "<p>By accessing the noted link you will be leaving our website and entering an affiliate site which is hosted by another party. Please be advised that you will no longer be subject to, or under the protection of, the privacy and security policies of our website. We encourage you to read and evaluate the privacy and security policies of the site which you are entering, which may be different than those of ours.</p>"; 1227 messages[4] = "<p>By accessing the noted link you will be leaving our website and entering a site which is hosted by another party. Please be advised that you will no longer be subject to, or under the protection of, the privacy and security policies of our website. We encourage you to read and evaluate the privacy and security policies of the site which you are entering, which may be different than those of ours.</p>"; 1228 messages[5] = "<p>This is NOT a secured e-mail transmission. Please do not send personal/financial information via this method.</p>"; 1229 messages[6] = "<p>The information provided by these calculators is intended for illustrative purposes only and is not intended to purport actual user-defined parameters. The default figures shown are hypothetical and may not be applicable to your individual situation. Be sure to consult a financial professional prior to relying on the results.</p>"; 1230 */ 1231 1232 var titles = NCR_TPW_LABELS; 1233 var messages = NCR_TPW_CONTENT; 1234 1235 //$('#tpwModal .modal-title').html(titles[msg]); 1236 //$('#tpwModal .modal-body').html(messages[msg]); 1237 //$('#tpwModal .modal-footer .btn-go').attr('href',lk); 1238 //$('#tpwModal').show() 1239 if(msg !== 0){ 1240 $('#ncr-tpw-popup-panel .ncr-tpw-title').html(titles[msg]); 1241 $('#ncr-tpw-popup-panel .ncr-tpw-body').html(messages[msg]); 1242 $('#ncr-tpw-popup-panel .btn-go').attr('href',lk); 1243 //open the panel 1244 $("#ncr-tpw-popup-panel").trigger("ncr-open-panel"); 1245 } 1246 1247} 1248 1249 1250function getUrl(){ 1251 var url = document.location.href; 1252 var urlstart = url.indexOf("newUrl=") + 7; 1253 var urlToReturn = url.substring(urlstart); 1254 return urlToReturn; 1255} 1256 1257 1258String.prototype.tagReplace = function() { 1259 var result = (this == "") ? " " : this; 1260 1261 return result.replace(/\(%tr%([^)]*)\)/g, '\<$1\>') 1262 .replace(/\(br\)/gi, "<br />") 1263 .replace(/\(bold\)/gi, "<strong>") 1264 .replace(/\(\/bold\)/gi, "</strong>") 1265 .replace(/\(strong\)/gi, "<strong>") 1266 .replace(/\(\/strong\)/gi, "</strong>") 1267 .replace(/\(h2\)/gi, "<h2>") 1268 .replace(/\(\/h2\)/gi, "</h2>") 1269 .replace(/\(h3\)/gi, "<h3>") 1270 .replace(/\(\/h3\)/gi, "</h3>") 1271 .replace(/\(sup\)/gi, "<sup>") 1272 .replace(/\(\/sup\)/gi, "</sup>") 1273 .replace(/\(em\)/gi, "<em>") 1274 .replace(/\(\/em\)/gi, "</em>") 1275 .replace(/\(tm\)/gi, "™") 1276 .replace(/\(trade\)/gi, "™") 1277 .replace(/\(reg\)/gi, "®") 1278 .replace(/\(copy\)/gi, "©") 1279 .replace(/\(amp\)/gi, "&") 1280 .replace(/\(lt\)/gi, "<") 1281 .replace(/\(gt\)/gi, ">"); 1282 1283} 1284 1285 1286 1287})(jQuery); // or even jQuery.noConflict()
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.