Mathias Markl 7 years ago
parent
commit
406267372b
  1. 2
      muk_web_utils/__manifest__.py
  2. 27
      muk_web_utils/static/src/js/jquery.js

2
muk_web_utils/__manifest__.py

@ -25,7 +25,7 @@
"description": """
Technical module to provide some utility features.
""",
"version": "11.0.1.0.1",
"version": "11.0.1.0.2",
"category": "Extra Tools",
"license": "AGPL-3",
"website": "http://www.mukit.at",

27
muk_web_utils/static/src/js/jquery.js

@ -22,3 +22,30 @@ $.fn.textWidth = function(text, font) {
$.fn.textWidth.fakeEl.text(text || this.val() || this.text()).css('font', font || this.css('font'));
return $.fn.textWidth.fakeEl.width();
};
$.fn.dndHover = function(options) {
return this.each(function() {
var self = $(this);
var collection = $();
self.on('dragenter', function(event) {
if (collection.size() === 0) {
self.trigger('dndHoverStart');
}
collection = collection.add(event.target);
});
self.on('dragleave', function(event) {
setTimeout(function() {
collection = collection.not(event.target);
if (collection.size() === 0) {
self.trigger('dndHoverEnd');
}
}, 1);
});
self.on('drop', function(event) {
setTimeout(function() {
collection = $();
self.trigger('dndHoverEnd');
}, 1);
});
});
};
Loading…
Cancel
Save