Ver código fonte

Merge remote-tracking branch 'origin/ConfirmationChrome' into dev

Alexandre Alapetite 11 anos atrás
pai
commit
a39e48e811
1 arquivos alterados com 5 adições e 7 exclusões
  1. 5 7
      p/scripts/main.js

+ 5 - 7
p/scripts/main.js

@@ -1230,13 +1230,11 @@ function init_slider_observers() {
 }
 }
 
 
 function init_configuration_alert() {
 function init_configuration_alert() {
-	$(window).on('beforeunload', function(e){
-		if (e.originalEvent.explicitOriginalTarget.type === 'submit') {
-			// we don't want an alert when submitting the form with the submit button
-			return;
-		}
-		if ($(e.originalEvent.explicitOriginalTarget).attr('data-leave-validation') !== undefined) {
-			// we don't want an alert when submitting the form by pressing the enter key
+	$(window).on('submit', function(e) {
+		window.hasSubmit = true;
+	});
+	$(window).on('beforeunload', function(e) {
+		if (window.hasSubmit) {
 			return;
 			return;
 		}
 		}
 		var fields = $("[data-leave-validation]");
 		var fields = $("[data-leave-validation]");