daily pastebin goal
64%
SHARE
TWEET

ShowPositions

cristianpark Jul 13th, 2013 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var positionsString='';
  2. var formation=getItem("formation");  //Integer defining formation number (1...4)
  3. var defenders=formations[formation]["defenders"]; //Array with positions of the defenders
  4.        
  5. //Goalkeeper
  6. var player=getItem("player"+1);
  7. playerPhoto=player!=null?'<img src="lib/img/players/'+players[player]["photo"]+'" />':'';
  8. positionsString+='<a href="#DVselectPlayer" style="position: absolute; top: 13.5em; right: 3.5em;" data-rel="popup" class="HRplayer" id="gk_1">'+playerPhoto+'</a>';
  9.        
  10. //Variables for positioning the players
  11. var playerNum=2;
  12. var pos=new Array();
  13. var top=0;
  14. var right=0;
  15.        
  16. //Defenders
  17. for(d in defenders){
  18.     pos=defenders[d].split("_");
  19.     top=pos[0];
  20.     right=pos[1];
  21.     //Get player photo (if a player is selected on this position)
  22.     player=getItem("player"+playerNum);
  23.     playerPhoto=player!=null?'<img src="lib/img/players/'+players[player]["photo"]+'" />':'';
  24.                
  25.     positionsString+='<a href="#DVselectPlayer" style="position: absolute; top:'+top+'em; right:'+right+'em;" data-rel="popup" class="HRplayer" id="df_'+playerNum+'">'+
  26.                 playerPhoto+
  27.     '</a>';
  28.                        
  29.    playerNum++;
  30. }//End for (defenders)
  31.  
  32. ....
  33.  
  34. $("#container".html(positionsString);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top