Changes

Jump to navigation Jump to search
682 bytes removed ,  16:49, 5 August 2021
Undo revision 1816 by Stencil (talk)
Line 26: Line 26:  
});
 
});
 
});
 
});
  −
`mw.loader.load('jquery.ui').then(function(){
  −
jQuery.fn.swap = function(b){
  −
b = jQuery(b)[0];
  −
var a = this[0];
  −
var t = a.parentNode.insertBefore(document.createTextNode(''), a);
  −
b.parentNode.insertBefore(a, b);
  −
t.parentNode.insertBefore(b, t);
  −
t.parentNode.removeChild(t);
  −
return this;
  −
};
  −
  −
$( ".wagon-slot" ).draggable({helper: "clone"});
  −
$( ".wagon-slot" ).droppable({
  −
accept: ".wagon-slot",
  −
activeClass: "ui-state-hover",
  −
hoverClass: "ui-state-active",
  −
drop: function(event, ui){
  −
var draggable = ui.draggable, droppable = $(this),
  −
dragPos = draggable.position(), dropPos = droppable.position();
  −
draggable.swap(droppable);
  −
}
  −
});
  −
})`
 

Navigation menu