aboutsummaryrefslogtreecommitdiff
path: root/p/scripts
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-08-06 20:52:08 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-08-06 20:52:08 +0200
commit157781c8eb91531627adfe9220ac3197e6b15325 (patch)
tree1b56cd51104fd65a7c7379056170206e3039fdee /p/scripts
parentde2c6fab7ae2f6c456c2e98196b01f368dba9917 (diff)
Fix drag in Internet Explorer
Internet Explorer does not support setData('text/html') and setData() is deprecated https://msdn.microsoft.com/en-us/library/ms536744(v=vs.85).aspx
Diffstat (limited to 'p/scripts')
-rw-r--r--p/scripts/category.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/p/scripts/category.js b/p/scripts/category.js
index e882da0c8..29c049924 100644
--- a/p/scripts/category.js
+++ b/p/scripts/category.js
@@ -27,6 +27,9 @@ function dragend_process(t) {
}
}
+var dragFeedId = '',
+ dragHtml = '';
+
function init_draggable() {
if (!(window.$ && window.i18n)) {
if (window.console) {
@@ -42,8 +45,9 @@ function init_draggable() {
$('.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', drag.outerHTML);
- e.originalEvent.dataTransfer.setData('text', drag.getAttribute('data-feed-id'));
+ dragHtml = drag.outerHTML;
+ dragFeedId = drag.getAttribute('data-feed-id');
+ e.originalEvent.dataTransfer.setData('text', dragFeedId);
drag.style.opacity = 0.3;
dnd_successful = false;
@@ -81,27 +85,25 @@ function init_draggable() {
return false;
});
$('.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;
$.ajax({
type: 'POST',
url: './?c=feed&a=move',
data : {
- f_id: feed_id,
- c_id: cat_id
+ f_id: dragFeedId,
+ c_id: e.target.parentNode.getAttribute('data-cat-id'),
}
}).done(function() {
- $(e.target).after(html);
+ $(e.target).after(dragHtml);
if ($(e.target).hasClass('disabled')) {
$(e.target).remove();
}
dnd_successful = true;
}).always(function() {
loading = false;
+ dragFeedId = '';
+ dragHtml = '';
});
$(this).removeClass('drag-hover');