aboutsummaryrefslogtreecommitdiff
path: root/p/scripts
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-08-06 15:43:28 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-08-06 15:43:28 +0200
commitde2c6fab7ae2f6c456c2e98196b01f368dba9917 (patch)
tree0af3a0c34c0ac06d7303130baddebdf968e1a8d2 /p/scripts
parent6d5b868b343d4a3410945d559b3caa8f786a05ec (diff)
Fix drag in Chrome
Diffstat (limited to 'p/scripts')
-rw-r--r--p/scripts/category.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/p/scripts/category.js b/p/scripts/category.js
index fe8b4c058..e882da0c8 100644
--- a/p/scripts/category.js
+++ b/p/scripts/category.js
@@ -40,10 +40,11 @@ function init_draggable() {
dropzone = '[dropzone="move"]';
$('.drop-section').on('dragstart', draggable, function(e) {
+ var drag = $(e.target).closest('[draggable]')[0];
e.originalEvent.dataTransfer.effectAllowed = 'move';
- e.originalEvent.dataTransfer.setData('text/html', e.target.outerHTML);
- e.originalEvent.dataTransfer.setData('text', e.target.getAttribute('data-feed-id'));
- e.target.style.opacity = 0.3;
+ e.originalEvent.dataTransfer.setData('text/html', drag.outerHTML);
+ e.originalEvent.dataTransfer.setData('text', drag.getAttribute('data-feed-id'));
+ drag.style.opacity = 0.3;
dnd_successful = false;
});
@@ -81,6 +82,7 @@ function init_draggable() {
});
$('.drop-section').on('drop', dropzone, function(e) {
var feed_id = e.originalEvent.dataTransfer.getData('text'),
+ html = e.originalEvent.dataTransfer.getData('text/html'),
cat_id = e.target.parentNode.getAttribute('data-cat-id');
loading = true;
@@ -93,7 +95,7 @@ function init_draggable() {
c_id: cat_id
}
}).done(function() {
- $(e.target).after(e.originalEvent.dataTransfer.getData('text/html'));
+ $(e.target).after(html);
if ($(e.target).hasClass('disabled')) {
$(e.target).remove();
}