From 406267372bde74cf051588fe99ca355ea4908e08 Mon Sep 17 00:00:00 2001 From: Mathias Markl Date: Thu, 1 Feb 2018 00:39:15 +0100 Subject: [PATCH] update --- muk_web_utils/__manifest__.py | 2 +- muk_web_utils/static/src/js/jquery.js | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) 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