diff --git a/muk_web_utils/__manifest__.py b/muk_web_utils/__manifest__.py index f3973b5..8ef197a 100644 --- a/muk_web_utils/__manifest__.py +++ b/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", diff --git a/muk_web_utils/static/src/js/jquery.js b/muk_web_utils/static/src/js/jquery.js index d2c8502..8d18964 100644 --- a/muk_web_utils/static/src/js/jquery.js +++ b/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); + }); + }); +}; \ No newline at end of file