Advertisement
Guest User

Untitled

a guest
May 19th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. _getPost(post){
  2.         const model = this._postModel.cloneNode(true);
  3.         model.setAttribute('data-id', this._size);
  4.         model.querySelector('.name p').textContent = post.author;
  5.         model.querySelector('.date p').textContent = this._formatDate(post.createdAt);
  6.         model.querySelector('.time p').textContent = this._formatTime(post.createdAt);
  7.         model.querySelector('.message h1').textContent = post.description;
  8.         model.querySelector('.tags').innerHTML = '';
  9.         const tagsContainer = model.querySelector('.tags');
  10.         const tag = document.createElement('a');
  11.         tag.setAttribute('href', '#');
  12.         post.hashTags.forEach(item=>{
  13.             tag.textContent = item;
  14.             tagsContainer.appendChild(tag.cloneNode(true));
  15.         });
  16.         model.querySelector('.photo img').setAttribute('src', post.photoLink);
  17.         model.querySelector('.count1 p').textContent = post.likes.length;
  18.         return model;
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement