Advertisement
NecromancerCoding

Módulo de ranking de puntos JS

Apr 26th, 2024
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.25 KB | None | 0 0
  1. $(function(){
  2. /*Edita la cantidad de miembros que quieres mostrar*/
  3. const quantity = 10;
  4. /*Edita el nombre de tus puntos*/
  5. const points = 'créditos';
  6. /*Edita tus clases del template memberlist_body para que puedan ser localizadas correctamente. Estos datos están hechos con el template memberlist_body por defecto de FA*/
  7. const memberRow = '#memberlist tbody tr'; /*Cada caja de miembro*/
  8. /*En estos, excluye lo que hayas puesto de valor en memberRow*/
  9. const memberAvatar = '.avatar-mini img'; /*Imagen de avatar*/
  10. const memberName = '.avatar-mini a span'; /*Nombre de usuario*/
  11. const memberPoints = 'td:nth-of-type(3)'; /*Puntos*/
  12.  
  13. /*No edites a partir de aquí*/
  14. const memberlistLink = '/memberlist?mode=point&order=DESC&submit=Ok&username';
  15. $('.pointranking').each(function(){
  16. var self = $(this);
  17. $.get(memberlistLink, function(data){
  18. $(data).find(memberRow+':nth-of-type(-n+'+quantity+')').each(function(){
  19. var thisAvatar = $(this).find(memberAvatar).prop('outerHTML');
  20. var thisName = $(this).find(memberName).prop('outerHTML');
  21. var thisPoints = $(this).find(memberPoints).text();
  22. var thisRow = '<div class="pr-member">'+thisAvatar+'<span><b>'+thisName+':</b> <i>'+thisPoints+' '+points+'</i></span></div>';
  23. $(self).append(thisRow);
  24. });
  25. });
  26. });
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement