I made what I think is a simple change to idrop.js (latest version) to facilitate multiple drop classes.
Basically, dropCfg.a becomes an array in function "build", and when drag starts iterate over all accept classes.
this.dropCfg = {
a : (typeof(o.accept) == 'string') ? [o.accept] : o.accept, //MODIFIED
ac: o.activeclass||false,
and then from about line 87 becomes:
if (jQuery.iDrop.zones[i] != null) {
var iEL = jQuery.iDrop.zones[i].get(0);
jQuery.each(iEL.dropCfg.a, function (n, a){ //NEW
if (jQuery(jQuery.iDrag.dragged).is('.' + a)) { //MODIFIED
if (iEL.dropCfg.m == false) {
iEL.dropCfg.p = jQuery.extend(
jQuery.iUtil.getPositionLite(iEL),
jQuery.iUtil.getSizeLite(iEL)
);//jQuery.iUtil.getPos(iEL);
iEL.dropCfg.m = true;
}
if (iEL.dropCfg.ac) {
jQuery.iDrop.zones[i].addClass(iEL.dropCfg.ac);
}
jQuery.iDrop.highlighted[i] = jQuery.iDrop.zones[i];
//if (jQuery.iSort && jQuery.iDrag.dragged.dragCfg.so) {
if (jQuery.iSort && iEL.dropCfg.s && jQuery.iDrag.dragged.dragCfg.so) {
iEL.dropCfg.el = jQuery('.' + iEL.dropCfg.a, iEL);
elm.style.display = 'none';
jQuery.iSort.measure(iEL);
iEL.dropCfg.os = jQuery.iSort.serialize(jQuery.attr(iEL, 'id')).hash;
elm.style.display = elm.dragCfg.oD;
oneIsSortable = true;
}
if (iEL.dropCfg.onActivate) {
iEL.dropCfg.onActivate.apply(jQuery.iDrop.zones[i].get(0), [jQuery.iDrag.dragged]);
}
}
}); //NEW
}
If it's a good idea, I'd be happy to see this go into core - if not then my feelings won't be hurt.
I made what I think is a simple change to idrop.js (latest version) to facilitate multiple drop classes.
Basically, dropCfg.a becomes an array in function "build", and when drag starts iterate over all accept classes.
this.dropCfg = { a : (typeof(o.accept) == 'string') ? [o.accept] : o.accept, //MODIFIED ac: o.activeclass||false,and then from about line 87 becomes:
if (jQuery.iDrop.zones[i] != null) { var iEL = jQuery.iDrop.zones[i].get(0); jQuery.each(iEL.dropCfg.a, function (n, a){ //NEW if (jQuery(jQuery.iDrag.dragged).is('.' + a)) { //MODIFIED if (iEL.dropCfg.m == false) { iEL.dropCfg.p = jQuery.extend( jQuery.iUtil.getPositionLite(iEL), jQuery.iUtil.getSizeLite(iEL) );//jQuery.iUtil.getPos(iEL); iEL.dropCfg.m = true; } if (iEL.dropCfg.ac) { jQuery.iDrop.zones[i].addClass(iEL.dropCfg.ac); } jQuery.iDrop.highlighted[i] = jQuery.iDrop.zones[i]; //if (jQuery.iSort && jQuery.iDrag.dragged.dragCfg.so) { if (jQuery.iSort && iEL.dropCfg.s && jQuery.iDrag.dragged.dragCfg.so) { iEL.dropCfg.el = jQuery('.' + iEL.dropCfg.a, iEL); elm.style.display = 'none'; jQuery.iSort.measure(iEL); iEL.dropCfg.os = jQuery.iSort.serialize(jQuery.attr(iEL, 'id')).hash; elm.style.display = elm.dragCfg.oD; oneIsSortable = true; } if (iEL.dropCfg.onActivate) { iEL.dropCfg.onActivate.apply(jQuery.iDrop.zones[i].get(0), [jQuery.iDrag.dragged]); } } }); //NEW }If it's a good idea, I'd be happy to see this go into core - if not then my feelings won't be hurt.