Guest User

Untitled

a guest
Jun 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. if(swap_me){
  2. swap_me.addEvent('click', function(e){
  3. e.stop();
  4.  
  5. var whichClass = this.get('class');
  6. var myParent = this.getParent('li');
  7. var myPos = sortables.indexOf(myParent);
  8. var otherPos = ['down_me', 'up_me'].contains(whichClass)?
  9. (whichClass === 'down_me'?
  10. sortables.indexOf(myParent.getNext('li')):
  11. sortables.indexOf(myParent.getPrevious('li'))
  12. ):
  13. 'error';
  14.  
  15. otherPos = !([null, 'error'].contains(otherPos))? otherPos: myPos;
  16.  
  17. swapReq.addEvent('success', function(response){
  18. if(!response.error){
  19. sortables[otherPos].inject(myParent, (myPos > otherPos? 'before': 'after'));
  20. sortables = droppable.getElements('.dragable');
  21. }
  22. });
  23.  
  24. if(myPos !== otherPos){
  25. swapReq.send($H({
  26. act: 'swap',
  27. order1: myPos,
  28. order2: otherPos,
  29. perfil: $_GET['perfil'],
  30. playlist: playlist,
  31. token: token
  32. }).toQueryString());
  33. }
  34. });
  35. }
Add Comment
Please, Sign In to add comment