Advertisement
NecromancerCoding

Leyenda automática v4

Dec 24th, 2022
3,039
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.80 KB | None | 0 0
  1. $(document).ready(function(){
  2. $('.stgroups a').each(function(){
  3. var color = $(this).css('color');
  4. var name = $(this).text();
  5. var clase = $(this).text().slice(0,20).replace(/\s/g, '').toLowerCase().replace(/'/g, "").replace(/\(|\)/g, "");
  6. var censo = $(this).attr('title');
  7. var censonumbers = censo.match(/\d+/g).map(Number);
  8. var resta = censonumbers[0] - 1;
  9. $(this).attr('style', '--group:'+color+';');
  10. $(this).parent('b').replaceWith(this);
  11. $(this).addClass('gr'+clase).removeClass('gensmall').removeAttr('title');
  12. $(this).html('<em></em><span>'+name+'</span><i></i>');
  13. if ($(this).is('.grstaff')) {
  14.   $(this).find('i').html(censonumbers[0]);
  15. } else {
  16.   $(this).find('i').html(resta);
  17. }
  18. });
  19.  
  20. $('.stgroups').each(function(){
  21. var content = $(this).children('a');
  22. $(this).html(content);
  23. });
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement