Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(swap_me){
- swap_me.addEvent('click', function(e){
- e.stop();
- var whichClass = this.get('class');
- var myParent = this.getParent('li');
- var myPos = sortables.indexOf(myParent);
- var otherPos = ['down_me', 'up_me'].contains(whichClass)?
- (whichClass === 'down_me'?
- sortables.indexOf(myParent.getNext('li')):
- sortables.indexOf(myParent.getPrevious('li'))
- ):
- 'error';
- otherPos = !([null, 'error'].contains(otherPos))? otherPos: myPos;
- swapReq.addEvent('success', function(response){
- if(!response.error){
- sortables[otherPos].inject(myParent, (myPos > otherPos? 'before': 'after'));
- sortables = droppable.getElements('.dragable');
- }
- });
- if(myPos !== otherPos){
- swapReq.send($H({
- act: 'swap',
- order1: myPos,
- order2: otherPos,
- perfil: $_GET['perfil'],
- playlist: playlist,
- token: token
- }).toQueryString());
- }
- });
- }
Add Comment
Please, Sign In to add comment