Guest User

Untitled

a guest
Jan 15th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function AddBlockX(operation)
  2. {
  3.     var listWrapper = document.getElementById('items_list_wrapper');
  4.     var main_div = document.createElement("div");
  5.     main_div.classList.add("col-xs-12","q_wrapper");
  6.     var metadata = JSON.parse(operation.json_metadata);
  7.     if(metadata.image)
  8.     {
  9.         var image = metadata.image[0];
  10.     }
  11.     else
  12.     {
  13.         var image = '/components/com_q/noimage.png';
  14.     }
  15.     var img_div = document.createElement("div");
  16.     img_div.classList.add("img_div");
  17.     main_div.appendChild(img_div);
  18.     img_div.style.backgroundImage = "url('"+image+"')";
  19.  
  20.     var q_div = document.createElement("div");
  21.     q_div.classList.add("q_div");
  22.     main_div.appendChild(q_div);
  23.  
  24.     var title = operation.title;
  25.     var author = operation.author;
  26.     var created = operation.created;
  27.     var last_update = operation.last_update;
  28.     var total_payout_value = operation.total_payout_value;
  29.     var pending_payout_value = operation.pending_payout_value;
  30.     var total_pending_payout_value = operation.total_pending_payout_value;
  31.     var votes = operation.active_votes.length;
  32.     var vl = total_pending_payout_value;
  33.     if(total_payout_value > total_pending_payout_value)
  34.     {
  35.         vl = total_payout_value;
  36.     }
  37.  
  38.     var tags = '';
  39.     if(typeof metadata.tags !== "undefined")
  40.     {
  41.         var tags_count = metadata.tags.length;
  42.  
  43.         for(var i = 0;i < tags_count;i++)
  44.         {
  45.             if(tags_count > 1)
  46.             {
  47.                 tags = tags + " <span class='label label-warning'><a href='/created/" + metadata.tags[i] + "'>"+detransliterate(metadata.tags[i], 0)+'</a></span>';
  48.             }
  49.         }
  50.     }  
  51.  
  52.     var dt = getCommentDate(created);
  53.     var s = 'onClick="getContentX(\''+operation.permlink.trim() +'\', \''+operation.author.trim() +'\');"';
  54.     q_div.innerHTML = '<div class="q_header_wrapper"><h3><a href="javascript:void(0)" '+s+'>'+ title + '</a></h3></div>' +  dt +' - Автор: <a href="/@'+ author +'" title="Все посты пользователя">@' + author + '</a>' + '<br/> Голосов <strong>' + votes + '</strong> на сумму <strong>' + vl + '</strong><br/>' + tags;
  55.  
  56.     var clearFix = document.createElement("div");
  57.     clearFix.classList.add("clearFix");
  58.     main_div.appendChild(clearFix);
  59.     listWrapper.appendChild(main_div);
  60. }
Add Comment
Please, Sign In to add comment