app/assets/javascripts/abracadabra.js in abracadabra-1.1.0 vs app/assets/javascripts/abracadabra.js in abracadabra-1.1.1

- old
+ new

@@ -1,8 +1,8 @@ $(function() { abracadabraSubmissionInProgress = false; - abracadabraDeleteMousedown = false; + abracadabraButtonMousedown = false; abracadabraEscapeKeydown = false; function closeAbracadabra(element, destroy, valueChanged) { $element = $(element); if($element.hasClass("abracadabra-container")) { @@ -66,21 +66,21 @@ return false; } abracadabraSubmissionInProgress = true; }); - $("body").on("mousedown", ".abracadabra-delete", function() { - abracadabraDeleteMousedown = true; + $("body").on("mousedown", ".abracadabra-delete, .abracadabra-submit, .abracadabra-cancel", function() { + abracadabraButtonMousedown = true; }); $("body").on("ajax:success", ".abracadabra-form", function(e) { target = $(e.target); + abracadabraButtonMousedown = false; /* If form is a DELETE, remove abracadabra instance, if not, call tabToNextSelector */ if(target.hasClass("abracadabra-delete")) { closeAbracadabra(target, true, true); - abracadabraDeleteMousedown = false; } else { input = $(target).find(".abracadabra-input"); tabToNextSelector = input.data("tab-to-next-selector"); tabToNextAbracadabra(target, tabToNextSelector); } @@ -94,10 +94,10 @@ closeAbracadabra(this, false, false); } }); $("body").on("blur", ".abracadabra-input", function() { - if(abracadabraSubmissionInProgress == false && abracadabraDeleteMousedown == false) { + if(abracadabraSubmissionInProgress == false && abracadabraButtonMousedown == false) { if($(this).data("submit-on-blur") == true) { $(this.form).submit(); } else { closeAbracadabra(this, false, false); } \ No newline at end of file