Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         players.on('add', function (key, item) {
  2.             var html = '<li id="player-' + key + '"><a id="player-locate-' + key + '" data-id="' + key + '">' + item.player.name + '</a></li>';
  3.             var added = false;
  4.                 $('li a', '#players ul').each(function(){
  5.                     if ($(this).text().toLowerCase() > item.player.name.toLowerCase()) {
  6.                         $(html).insertBefore($(this)).fadeIn('fast');
  7.  
  8.                         added = true;
  9.  
  10.                         return false;
  11.                     }
  12.                 });
  13.                 if(!added) $(html).appendTo($('#players ul')).fadeIn('fast');
  14.  
  15.             $('#players-title').html('Spieler (' + players.count() + ') <span class="accordion-toggle accordion-toggle-closed"></span>');
  16.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement