B2G/gaia/apps/communications/dialer/js/call_log.js
/**
   * Visually update the contact information of a group in the DOM.
   *
   * param element
   *        DOM element containing the group information.
   * param contact
   *        Object containing the contact information associated to the group
   *        of calls.
   * param matchingTel
   *        Object containing the phone number associated with the group of
   *        calls. It contains 'type', 'carrier' and 'value' parameters.
   *
   */
Visually update the contact information of a group in the DOM.
param element
DOM element containing the group information.
param contact
Object containing the contact information associated to the group
of calls.
param matchingTel
Object containing the phone number associated with the group of
calls.
Visually update the contact information of a group in the DOM . param element DOM element containing the group information . param contact Object containing the contact information associated to the group of calls . param matchingTel Object containing the phone number associated with the group of calls .
function cl_updateContactInfo(element, contact,
                                                   matchingTel) {
    var primInfoCont = element.getElementsByClassName('primary-info-main')[0];
    var contactPhoto = element.querySelector('.call-log-contact-photo');
    var addInfo = element.getElementsByClassName('call-additional-info');
    var addInfoCont;
    if (addInfo && addInfo[0]) {
      addInfoCont = addInfo[0];
    } else {
      addInfoCont = document.createElement('p');
      addInfoCont.className = 'call-additional-info';
      var primElem = primInfoCont.parentNode;
      var parent = primElem.parentNode;
      parent.insertBefore(addInfoCont, primElem.nextElementSibling);
    }
    if (!matchingTel) {
      if (element.dataset.contactId) {
        primInfoCont.textContent = element.dataset.phoneNumber;
        addInfoCont.textContent = '';
        contactPhoto.src = '';
        element.classList.remove('hasPhoto');
        delete element.dataset.contactId;
      }
      return;
    }
    var primaryInfo =
      Utils.getPhoneNumberPrimaryInfo(matchingTel, contact);
    if (primaryInfo) {
      primInfoCont.textContent = primaryInfo;
    }
    if (contact && contact.photo && contact.photo[0]) {
      var image_url = contact.photo[0];
      var photoURL;
      var isString = (typeof image_url == 'string');
      contactPhoto.src = isString ? image_url : URL.createObjectURL(image_url);
      element.classList.add('hasPhoto');
    } else {
      contactPhoto.src = '';
      element.classList.remove('hasPhoto');
    }
    var phoneNumberAdditionalInfo =
      Utils.getPhoneNumberAdditionalInfo(matchingTel);
    if (phoneNumberAdditionalInfo && phoneNumberAdditionalInfo.length) {
      addInfoCont.textContent = phoneNumberAdditionalInfo;
    }
    if (contact) {
      element.dataset.contactId = contact.id;
    }
  }
function cl_updateContactInfo ( element , contact , matchingTel ) { var primInfoCont = element . getElementsByClassName ( 'primary-info-main' ) [ 0 ] ; var contactPhoto = element . querySelector ( '.call-log-contact-photo' ) ; var addInfo = element . getElementsByClassName ( 'call-additional-info' ) ; var addInfoCont ; if ( addInfo && addInfo [ 0 ] ) { addInfoCont = addInfo [ 0 ] ; } else { addInfoCont = document . createElement ( 'p' ) ; addInfoCont . className = 'call-additional-info' ; var primElem = primInfoCont . parentNode ; var parent = primElem . parentNode ; parent . insertBefore ( addInfoCont , primElem . nextElementSibling ) ; } if ( ! matchingTel ) { if ( element . dataset . contactId ) { primInfoCont . textContent = element . dataset . phoneNumber ; addInfoCont . textContent = '' ; contactPhoto . src = '' ; element . classList . remove ( 'hasPhoto' ) ; delete element . dataset . contactId ; } return ; } var primaryInfo = Utils . getPhoneNumberPrimaryInfo ( matchingTel , contact ) ; if ( primaryInfo ) { primInfoCont . textContent = primaryInfo ; } if ( contact && contact . photo && contact . photo [ 0 ] ) { var image_url = contact . photo [ 0 ] ; var photoURL ; var isString = ( typeof image_url == 'string' ) ; contactPhoto . src = isString ? image_url : URL . createObjectURL ( image_url ) ; element . classList . add ( 'hasPhoto' ) ; } else { contactPhoto . src = '' ; element . classList . remove ( 'hasPhoto' ) ; } var phoneNumberAdditionalInfo = Utils . getPhoneNumberAdditionalInfo ( matchingTel ) ; if ( phoneNumberAdditionalInfo && phoneNumberAdditionalInfo . length ) { addInfoCont . textContent = phoneNumberAdditionalInfo ; } if ( contact ) { element . dataset . contactId = contact . id ; } }
Visually update the contact information of a group in the DOM.
Visually update the contact information of a group in the DOM .
// Remove contact info.