John Paul II - Louisville, KY

Staff - if no extension, don't display "x"

Assigned to
Kyle Sullivan, Web Development at Diocesan Kyle S.
Notes

Comments & Events

Kyle Sullivan, Web Development at Diocesan
I rewrote staff.js to fix this issue. Here's the nuts and bolts of it.
jQuery(document).ready(function($) {
  $('.staff-member-listing .tel-link').each(function(){
    let phone = $(this).text();
    let ph = phone.replace(/\D/g, '');
    if(ph != ''){
      let link = 'tel:+1-' + ph.substring(0, 3) + '-' + ph.substring(3, 6) + '-' + ph.substring(6, 10);
      phone = '(' +  ph.substring(0, 3) + ') ' + ph.substring(3, 6) + '-' + ph.substring(6, 10);
      if( ph.length > 10 ){
        link += ';' + ph.substring(10, );
        phone += ' x ' + ph.substring(10, );
      }

      $(this).html('<a href="' + link + '">' + phone + '</a>');
    }
  });
});

Kyle Sullivan, Web Development at Diocesan
Kyle Sullivan completed this to-do.