diff --git a/static/application.js b/static/application.js index 0220d132..d7e0792c 100644 --- a/static/application.js +++ b/static/application.js @@ -1029,6 +1029,10 @@ function sortableOnStop(event, ui) { next_sibling = ui.item.next().next().attr("num"); } next_sibling = parseInt(next_sibling); + if(Number.isNaN(next_sibling)) { + $(this).sortable("cancel"); + return; + } socket.send({'cmd': 'wimoveitem', 'destination': next_sibling, 'data': parseInt(ui.item.attr("num"))}); } else { // Do the same thing for WI folders @@ -1038,6 +1042,10 @@ function sortableOnStop(event, ui) { } else { next_sibling = parseInt(next_sibling); } + if(Number.isNaN(next_sibling)) { + $(this).sortable("cancel"); + return; + } socket.send({'cmd': 'wimovefolder', 'destination': next_sibling, 'data': parseInt(ui.item.attr("folder-uid"))}); } } @@ -1873,6 +1881,7 @@ $(document).ready(function(){ start: sortableOnStart, stop: sortableOnStop, placeholder: "wisortable-placeholder", + delay: 2, cursor: "move", tolerance: "pointer", opacity: 0.21,