From 79c169b214fa41c929fb66c016ead258e86f1e64 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 23 Jan 2013 21:59:31 -0500 Subject: [PATCH] Fix unsaved changes warning --- js/id/id.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/id/id.js b/js/id/id.js index 4e13a3cfc..34184d5b3 100644 --- a/js/id/id.js +++ b/js/id/id.js @@ -95,12 +95,6 @@ window.iD = function(container) { .attr('class', 'save col12') .call(iD.ui.save().map(map).controller(controller)); - history.on('change.editor', function() { - window.onbeforeunload = history.hasChanges() ? function() { - return 'You have unsaved changes.'; - } : null; - }); - var zoom = container.append('div') .attr('class', 'zoombuttons map-control') .selectAll('button') @@ -184,6 +178,10 @@ window.iD = function(container) { .attr('class', 'contributor-count'); history.on('change.editor', function() { + window.onbeforeunload = history.hasChanges() ? function() { + return 'You have unsaved changes.'; + } : null; + var undo = history.undoAnnotation(), redo = history.redoAnnotation();