Matthias Mees c731c371d3 Only execute dragdrop.js if device does not support touch events.
Also hide noscript controls for plugin manager differently, but show
them on no-js and touch devices. This is supposed to compensate the
fact that the dragdrop JS does not work on touch devices. Might need
a better solution long-term here.
2014-01-20 12:32:36 +01:00

32 lines
1.4 KiB
JavaScript

$("document").ready(function() {
if (! Modernizr.touch){
$('.pluginmanager_sidebar .pluginmanager_container').sortable(getDragdropConfiguration('plugins_sidebar'));
$('.pluginmanager_event .pluginmanager_container').sortable(getDragdropConfiguration('plugins_event'));
$('.configuration_group .pluginmanager_container').sortable(getDragdropConfiguration('plugins_event'));
function getDragdropConfiguration(group) {
return {
containerSelector: '.pluginmanager_container',
group: group,
handle: '.pluginmanager_grablet',
onDrop: function ($item, container, _super) {
var placement = $item.parents('.pluginmanager_container').data("placement");
$item.find('input[name$="placement]"]').val(placement);
$item.removeClass("dragged").removeAttr("style")
$("body").removeClass("dragging")
$.autoscroll.stop();
},
onDragStart: function ($item, container, _super) {
$.autoscroll.init();
$item.css({
height: $item.height(),
width: $item.width()
})
$item.addClass("dragged")
$("body").addClass("dragging")
}
}
}
}
});