Changes

Jump to navigation Jump to search
22 bytes removed ,  16:45, 5 August 2021
no edit summary
Line 25: Line 25:  
$(this).css("background-image", 'url(' + ')');
 
$(this).css("background-image", 'url(' + ')');
 
});
 
});
 +
});
   −
`mw.loader.load('jquery.ui').then(function(){  
+
`mw.loader.load('jquery.ui').then(function(){  
jQuery.fn.swap = function(b){
+
jQuery.fn.swap = function(b){
b = jQuery(b)[0];  
+
b = jQuery(b)[0];  
var a = this[0];  
+
var a = this[0];  
var t = a.parentNode.insertBefore(document.createTextNode(''), a);  
+
var t = a.parentNode.insertBefore(document.createTextNode(''), a);  
b.parentNode.insertBefore(a, b);  
+
b.parentNode.insertBefore(a, b);  
t.parentNode.insertBefore(b, t);  
+
t.parentNode.insertBefore(b, t);  
t.parentNode.removeChild(t);  
+
t.parentNode.removeChild(t);  
return this;  
+
return this;  
};
+
};
   −
$( ".wagon-slot" ).draggable({helper: "clone"});
+
$( ".wagon-slot" ).draggable({helper: "clone"});
$( ".wagon-slot" ).droppable({
+
$( ".wagon-slot" ).droppable({
accept: ".wagon-slot",
+
accept: ".wagon-slot",
activeClass: "ui-state-hover",
+
activeClass: "ui-state-hover",
hoverClass: "ui-state-active",
+
hoverClass: "ui-state-active",
drop: function(event, ui){
+
drop: function(event, ui){
var draggable = ui.draggable, droppable = $(this),
+
var draggable = ui.draggable, droppable = $(this),
dragPos = draggable.position(), dropPos = droppable.position();
+
dragPos = draggable.position(), dropPos = droppable.position();
draggable.swap(droppable);
+
draggable.swap(droppable);
}
+
}
});
+
});
})`
+
})`
});
 

Navigation menu