Advertisement
ArtEze

Chatovod Usuarios Tampermonkey

Jul 21st, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Chatovod usuarios
  3. // @version      0.2
  4. // @description  Mejoras para usuarios Chatovod
  5. // @author       ArtEze
  6. // @include      /^https?:\/\/.+chatovod.+users.+/
  7. // @grant        none
  8. // ==/UserScript==
  9.  
  10. window.href_sumar = function(cantidad){
  11.     var p_href = location.href.split("/")
  12.     var p_fin = p_href.slice(-1)[0].split("&")
  13.     var p_cant = p_fin[0].split("=")
  14.     p_cant[1]=(+p_cant[1])+cantidad
  15.     p_cant = p_cant.join("=")
  16.     p_fin[0] = p_cant
  17.     p_fin = p_fin.join("&")
  18.     p_href[p_href.length-1] = p_fin
  19.     p_href = p_href.join("/")
  20.     location.href = p_href
  21. }
  22. window.acomodar_columnas = function(){
  23.     var tabla = document.createElement("table")
  24.     var tr = document.createElement("tr")
  25.     var td_1 = document.createElement("td")
  26.     var td_2 = document.createElement("td")
  27.     var td_3 = document.createElement("td")
  28.  
  29.     td_2.appendChild(document.querySelector(".nickSearchResult"))
  30.  
  31.     var porcentaje = 5
  32.  
  33.     td_1.style.width = porcentaje+"%"
  34.     td_1.style["background-color"]="black"
  35.     td_1.addEventListener("click",function(){
  36.         window.href_sumar(-20)
  37.     })
  38.  
  39.     td_3.style.width = porcentaje+"%"
  40.     td_3.style["background-color"]="black"
  41.     td_3.addEventListener("click",function(){
  42.         window.href_sumar(20)
  43.     })
  44.  
  45.     tr.appendChild(td_1)
  46.     tr.appendChild(td_2)
  47.     tr.appendChild(td_3)
  48.     tabla.appendChild(tr)
  49.  
  50.     document.querySelector(".container").appendChild(tabla)
  51.  
  52.     document.querySelector(".container.contentPopup .row").remove()
  53.     document.querySelector(".container.contentPopup").style = "width: auto"
  54.  
  55. }
  56. window.mejorar_estilo = function(){
  57.     window.lista_usuarios = Array.from(document.querySelectorAll(".list-unstyled .clearfix"))
  58.     .map(function(x){return [x.querySelector(".info"),x.querySelector("a")]})
  59.     var div = document.createElement("div")
  60.     window.lista_usuarios.map(function(x){
  61.         var contenedor = document.createElement("li")
  62.         var tabla = document.createElement("table")
  63.         var tr_1 = document.createElement("tr")
  64.         var tr_2 = document.createElement("tr")
  65.         var td_1 = document.createElement("td")
  66.         var td_2 = document.createElement("td")
  67.         contenedor.style.width = "169px"
  68.         contenedor.style.height = "190px"
  69.         x[0].classList.remove("info")
  70.         td_1.appendChild(x[0])
  71.         td_2.appendChild(x[1])
  72.         tr_1.appendChild(td_1)
  73.         tr_2.appendChild(td_2)
  74.         tabla.appendChild(tr_1)
  75.         tabla.appendChild(tr_2)
  76.         contenedor.appendChild(tabla)
  77.         div.appendChild(contenedor)
  78.     })
  79.     document.querySelector(".list-unstyled").innerHTML = div.innerHTML
  80.     document.querySelector("h5").innerHTML+=" "
  81.     document.querySelector("h5").appendChild(document.querySelector("a"))
  82.     document.querySelector(".headerPopup.clearfix").remove()
  83.     document.querySelector(".container.contentPopup").style.paddingTop="0px"
  84. }
  85.  
  86. var h5 = document.querySelector("h5")
  87. var texto = h5.textContent
  88. var num = +texto.match(/\d+/g).join("")
  89. var paginas = Math.ceil(num/20)
  90. var actual = Math.ceil((+location.href.match(/\d+/)[0])/20)+1
  91. h5.innerHTML += " - " + actual + " de " + paginas + " páginas. "
  92.  
  93. var boton = document.createElement("button")
  94. boton.innerHTML = "Con foto"
  95. boton.addEventListener("click",function(){
  96.     location.href = location.origin + "/es/users/?p=0&s=0&f=1&_a=on"
  97. })
  98. h5.appendChild(boton)
  99.  
  100. window.acomodar_columnas()
  101. window.window.mejorar_estilo()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement