function createFriendElement(friendKey){
    var friendData;
    for (var i = 0; i < userArr.length; i++){
      if(friendKey == userArr[i].uid){
        friendData = userArr[i];
        break;
      }
    }

    if(friendData != null) {
      try{
        document.getElementById("TestGift").remove();
      } catch (err) {}

      var userUid = friendData.uid;
      var friendName = friendData.name;
      var friendUserName = friendData.userName;
      var friendShareCode = friendData.shareCode;
      var liItem = document.createElement("LI");
      liItem.id = "user" + userUid;
      liItem.className = "gift";
      liItem.onclick = function () {
        var span = document.getElementsByClassName("close")[0];
        var friendSendMessage = document.getElementById('sendPrivateMessage');
        var friendInviteRemove = document.getElementById('userInviteRemove');
        var friendNameField = document.getElementById('userName');
        var friendUserNameField = document.getElementById('userUName');
        var friendShareCodeField = document.getElementById('userShareCode');

        if (friendShareCode == undefined || friendShareCode == "") {
          friendShareCode = "This User Does Not Have A Share Code";
        }

        friendNameField.innerHTML = friendName;
        friendUserNameField.innerHTML = "User Name: " + friendUserName;
        friendShareCodeField.innerHTML = "Share Code: " + friendShareCode;

        friendSendMessage.onclick = function() {
          generatePrivateMessageDialog(friendData);
        };

        friendInviteRemove.onclick = function () {
          modal.style.display = "none";
          deleteFriend(userUid);
        };

        //show modal
        modal.style.display = "block";

        //close on close
        span.onclick = function () {
          modal.style.display = "none";
        };

        //close on click
        window.onclick = function (event) {
          if (event.target == modal) {
            modal.style.display = "none";
          }
        };
      };
      var textNode = document.createTextNode(friendName);
      liItem.appendChild(textNode);

      userList.insertBefore(liItem, document.getElementById("userListContainer").childNodes[0]);

      friendCount++;
    }
  }
//respective user names/share codes will appear, as well as a couple helpful buttons/interactive text fields.
respective user names/share codes will appear, as well as a couple helpful buttons/interactive text fields.
respective user names / share codes will appear as well as a couple helpful buttons / interactive text fields .
function createFriendElement(friendKey){
    var friendData;
    for (var i = 0; i < userArr.length; i++){
      if(friendKey == userArr[i].uid){
        friendData = userArr[i];
        break;
      }
    }
    if(friendData != null) {
      try{
        document.getElementById("TestGift").remove();
      } catch (err) {}
      var userUid = friendData.uid;
      var friendName = friendData.name;
      var friendUserName = friendData.userName;
      var friendShareCode = friendData.shareCode;
      var liItem = document.createElement("LI");
      liItem.id = "user" + userUid;
      liItem.className = "gift";
      liItem.onclick = function () {
        var span = document.getElementsByClassName("close")[0];
        var friendSendMessage = document.getElementById('sendPrivateMessage');
        var friendInviteRemove = document.getElementById('userInviteRemove');
        var friendNameField = document.getElementById('userName');
        var friendUserNameField = document.getElementById('userUName');
        var friendShareCodeField = document.getElementById('userShareCode');
        if (friendShareCode == undefined || friendShareCode == "") {
          friendShareCode = "This User Does Not Have A Share Code";
        }
        friendNameField.innerHTML = friendName;
        friendUserNameField.innerHTML = "User Name: " + friendUserName;
        friendShareCodeField.innerHTML = "Share Code: " + friendShareCode;
        friendSendMessage.onclick = function() {
          generatePrivateMessageDialog(friendData);
        };
        friendInviteRemove.onclick = function () {
          modal.style.display = "none";
          deleteFriend(userUid);
        };
        modal.style.display = "block";
        span.onclick = function () {
          modal.style.display = "none";
        };
        window.onclick = function (event) {
          if (event.target == modal) {
            modal.style.display = "none";
          }
        };
      };
      var textNode = document.createTextNode(friendName);
      liItem.appendChild(textNode);
      userList.insertBefore(liItem, document.getElementById("userListContainer").childNodes[0]);
      friendCount++;
    }
  }
function createFriendElement ( friendKey ) { var friendData ; for ( var i = 0 ; i < userArr . length ; i ++ ) { if ( friendKey == userArr [ i ] . uid ) { friendData = userArr [ i ] ; break ; } } if ( friendData != null ) { try { document . getElementById ( "TestGift" ) . remove ( ) ; } catch ( err ) { } var userUid = friendData . uid ; var friendName = friendData . name ; var friendUserName = friendData . userName ; var friendShareCode = friendData . shareCode ; var liItem = document . createElement ( "LI" ) ; liItem . id = "user" + userUid ; liItem . className = "gift" ; liItem . onclick = function ( ) { var span = document . getElementsByClassName ( "close" ) [ 0 ] ; var friendSendMessage = document . getElementById ( 'sendPrivateMessage' ) ; var friendInviteRemove = document . getElementById ( 'userInviteRemove' ) ; var friendNameField = document . getElementById ( 'userName' ) ; var friendUserNameField = document . getElementById ( 'userUName' ) ; var friendShareCodeField = document . getElementById ( 'userShareCode' ) ; if ( friendShareCode == undefined || friendShareCode == "" ) { friendShareCode = "This User Does Not Have A Share Code" ; } friendNameField . innerHTML = friendName ; friendUserNameField . innerHTML = "User Name: " + friendUserName ; friendShareCodeField . innerHTML = "Share Code: " + friendShareCode ; friendSendMessage . onclick = function ( ) { generatePrivateMessageDialog ( friendData ) ; } ; friendInviteRemove . onclick = function ( ) { modal . style . display = "none" ; deleteFriend ( userUid ) ; } ; modal . style . display = "block" ; span . onclick = function ( ) { modal . style . display = "none" ; } ; window . onclick = function ( event ) { if ( event . target == modal ) { modal . style . display = "none" ; } } ; } ; var textNode = document . createTextNode ( friendName ) ; liItem . appendChild ( textNode ) ; userList . insertBefore ( liItem , document . getElementById ( "userListContainer" ) . childNodes [ 0 ] ) ; friendCount ++ ; } }
respective user names/share codes will appear, as well as a couple helpful buttons/interactive text fields.
respective user names / share codes will appear as well as a couple helpful buttons / interactive text fields .
//show modal //close on close //close on click