Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. ////ESTA FUNCION LLAMA RENDER
  2.  
  3. function reccomendations() {
  4. var class_div = "widgetviral";
  5.  
  6. var widgets = document.getElementsByClassName(class_div);
  7.  
  8. for (i = 0; i < 4; i++) {
  9.  
  10.  
  11. order = widgets[i].getAttribute("data-order");
  12. count = widgets[i].getAttribute("data-count");
  13. nsfw = widgets[i].getAttribute("data-nsfw");
  14. div_actual = widgets[i];
  15.  
  16.  
  17.  
  18. var premium = document.createElement("h3");
  19. premium.className += " wid_tit";
  20. premium.innerHTML = "Recommend Content";
  21.  
  22.  
  23.  
  24. var ul = document.createElement("ul");
  25. ul.className += " pics_widget";
  26.  
  27. widgets[i].appendChild(premium);
  28.  
  29. widgets[i].appendChild(ul);
  30.  
  31. render(order, count, nsfw, ul);
  32.  
  33. var classname = document.getElementsByClassName("item_ad");
  34.  
  35.  
  36. /* for (var a = 0; a < classname.length; a++) {
  37.  
  38. classname[a].addEventListener('click', onClickFunction, false);
  39.  
  40. }*/
  41.  
  42.  
  43. }
  44.  
  45.  
  46. return true;
  47. }
  48.  
  49.  
  50. ////ESTA ES RENDER
  51. function render(order, count, nsfw, div_actual){
  52.  
  53. for (i = 0; i < count; i++) {
  54.  
  55.  
  56.  
  57. var li = document.createElement("li");
  58. li.className += "item_ad";
  59.  
  60. if(size)
  61. li.style.width = size + "%";
  62.  
  63. var div = document.createElement("div");
  64. div.innerHTML = lista[i].title;
  65.  
  66. var a = document.createElement("a");
  67. a.href = slugify(lista[i].title);
  68. a.setAttribute('target', '_blank');
  69. //a.setAttribute('onclick', 'token_key()');//"'+ reverse(encodeURIComponent(lista[i].url)) +'","' + lista[i].id_tols + '"
  70. //a.setAttribute('data-tols', lista[i].id_tols);
  71. a.setAttribute('rel', 'nofollow');
  72. a.setAttribute('data-alt', lista[i].url);
  73. a.className = "item_a_"+lista[i].id_tols+" magic-link";
  74. /*a.target = "_blank";*/
  75.  
  76. var figure = document.createElement("figure");
  77. var image = document.createElement("img");
  78.  
  79. image.src = lista[i].image;
  80.  
  81.  
  82.  
  83. figure.appendChild(image);
  84. a.appendChild(figure);
  85. a.appendChild(div);
  86. li.appendChild(a);
  87.  
  88. div_actual.appendChild(li);
  89.  
  90.  
  91. }
  92.  
  93. var classname = document.getElementsByClassName("item_ad");
  94.  
  95. for (var i = 0; i < classname.length; i++) {
  96. classname[i].addEventListener('click', function(){
  97. moveElementToBottom(this);
  98. }, false);
  99. }
  100.  
  101. }
  102.  
  103.  
  104.  
  105. DONDE PONER EL CALLBACK Y COMO LLAMAR TU CODIGO, CON UNA FUNCION?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement